Social Share WordPress Plugin – AccessPress Social Share - Version 1.0.4

Version Description

  • Code modification for the pinterest share options for images.
  • Share count using ajax to store it in cache.
  • Changes in the upgrade banner images.
  • Fixed the bug for share options if not selected to any.
  • Fixed the bug in the twitter share and added twitter share via in the twitter share link.
Download this release

Release Info

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

Code changes from version 1.0.3 to 1.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: 1.0.3
8
  Author: AccessPress Themes
9
  Author URI: http://accesspressthemes.com
10
  Text Domain:apss-share
@@ -31,7 +31,7 @@ if( !defined( 'APSS_LANG_DIR' ) ) {
31
  }
32
 
33
  if( !defined( 'APSS_VERSION' ) ) {
34
- define( 'APSS_VERSION', '1.0.3' );
35
  }
36
 
37
  if(!defined('APSS_TEXT_DOMAIN')){
@@ -42,11 +42,18 @@ if(!defined('APSS_SETTING_NAME')){
42
  define( 'APSS_SETTING_NAME','apss_share_settings' );
43
  }
44
 
 
 
 
 
45
  //Decleration of the class for necessary configuration of a plugin
46
 
47
  if( !class_exists( 'APSS_Class' ) ){
48
  class APSS_Class{
 
 
49
  function __construct() {
 
50
  register_activation_hook( __FILE__, array( $this, 'plugin_activation' ) ); //load the default setting for the plugin while activating
51
  add_action( 'init', array( $this, 'plugin_text_domain' ) ); //load the plugin text domain
52
  add_action('init',array( $this,'session_init')); //start the session if not started yet.
@@ -58,6 +65,8 @@ if( !class_exists( 'APSS_Class' ) ){
58
  add_action('admin_post_apss_save_options', array( $this, 'apss_save_options')); //save the options in the wordpress options table.
59
  add_action('admin_post_apss_restore_default_settings',array($this,'apss_restore_default_settings'));//restores default settings.
60
  add_action('admin_post_apss_clear_cache',array($this,'apss_clear_cache'));//clear the cache of the social share counter.
 
 
61
  }
62
 
63
  //called when plugin is activated
@@ -65,6 +74,11 @@ if( !class_exists( 'APSS_Class' ) ){
65
  if( !get_option( APSS_SETTING_NAME ) ){
66
  include( 'inc/backend/activation.php' );
67
  }
 
 
 
 
 
68
  }
69
 
70
  //loads the text domain for translation
@@ -119,120 +133,23 @@ if( !class_exists( 'APSS_Class' ) ){
119
 
120
  //function to return the content filter for the posts and pages
121
  function apss_the_content_filter( $content ) {
122
- $options = get_option( APSS_SETTING_NAME );
123
- $apss_link_open_option=($options['dialog_box_options']=='1') ? "_blank": "";
124
- $twitter_user=$options['twitter_username'];
125
- $counter_enable_options=$options['counter_enable_options'];
126
- $api_link='';
127
- $icon_set_value=$options['social_icon_set'];
128
- $url= get_the_permalink();//$this->curPageURL();
129
- $text= get_the_title();
130
- $cache_period = ($options['cache_period'] != '') ? $options['cache_period']*60*60 : 24 * 60 * 60 ;
131
- $counter_share='';
132
- $count_share='';
133
- $counter_tweets='';
134
- $counter_googleplus='';
135
- $counter_pinterest='';
136
- $counter_linkedin='';
137
- $counter_digg='';
138
- foreach( $options['social_networks'] as $key=>$value ){
139
- if( intval($value)=='1' ){
140
- switch($key){
141
- case 'facebook':
142
- if($counter_enable_options ==='1'){
143
- $count_share=$this->get_fb( $url, $cache_period );
144
- $counter_share="<div class='count'>$count_share</div>";
145
- }
146
- $api_link .= "<div class='apss-facebook apss-single-icon'><a title='Share on Facebook' target='$apss_link_open_option' href='https://www.facebook.com/sharer/sharer.php?u=$url'><div class='apss-icon-block'><i class='fa fa-facebook'></i><span class='apss-social-text'>Share on Facebook</span><span class='apss-share'>share</span></div>$counter_share</a></div>";
147
- break;
148
-
149
- case 'twitter':
150
- if( $counter_enable_options ==='1' ){
151
- $count_tweets=$this->get_tweets( $url, $cache_period );
152
- $counter_tweets="<div class='count'>$count_tweets</div>";
153
- }
154
- if(isset( $twitter_user) && $twitter_user !='' ){
155
- $url=$url."@$twitter_user";
156
- }else{
157
- $url=$url;
158
- }
159
- $api_link .= "<div class='apss-twitter apss-single-icon'><a title='Share on Twitter' target='$apss_link_open_option' href='"."https://twitter.com/intent/tweet?source=webclient&amp;original_referer=$url&amp;text=$text&amp;url=$url'"."><div class='apss-icon-block'><i class='fa fa-twitter'></i><span class='apss-social-text'>Share on Twitter</span><span class='apss-share'>tweet</span></div>$counter_tweets</a></div>";
160
- break;
161
-
162
- case 'google-plus':
163
- if($counter_enable_options ==='1'){
164
- $count_googleplus=$this->get_plusones( $url, $cache_period );
165
- $counter_googleplus="<div class='count'>$count_googleplus</div>";
166
- }
167
- $link = 'https://plus.google.com/share?url='.$url;
168
- $api_link .="<div class='apss-google-plus apss-single-icon'><a title='Share on Google+' target='$apss_link_open_option' href='$link'><div class='apss-icon-block'><i class='fa fa-google-plus'></i><span class='apss-social-text'>Share on Google Plus</span><span class='apss-share'>share</span></div>$counter_googleplus</a></div>";
169
- break;
170
-
171
- case 'pinterest':
172
- $count=0;
173
- if($counter_enable_options ==='1'){
174
- $count_pinterest=$this->get_pinterest( $url, $cache_period );
175
- $counter_pinterest="<div class='count'>$count_pinterest</div>";
176
- }
177
- global $post;
178
- // if(has_post_thumbnail()){
179
- // $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
180
- // $link = 'http://pinterest.com/pin/create/bookmarklet/?media='.$image[0].'&amp;url='.$url.'&amp;title='.get_the_title().'&amp;description='.$post->post_excerpt;
181
- // $api_link .="<div class='apss-pinterest apss-single-icon'><a title='Share on Pinterest' target='$apss_link_open_option' href='$link'><div class='apss-icon-block'><i class='fa fa-pinterest'></i><span class='apss-social-text'>Share on $key</span><span class='apss-share'>share</span></div>$counter_pinterest</a></div>";
182
- // }else{
183
-
184
- // }
185
- $api_link .="<div class='apss-pinterest apss-single-icon'><a href='javascript:void((function()%7Bvar%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;http://assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)%7D)());'><div class='apss-icon-block'><i class='fa fa-pinterest'></i><span class='apss-social-text'>Share on $key</span><span class='apss-share'>share</span></div>$counter_pinterest</a></div>";
186
- break;
187
-
188
- case 'linkedin':
189
- if($counter_enable_options ==='1'){
190
- $count=$this->get_linkedin( $url, $cache_period );
191
- $counter_linkedin="<div class='count'>$count</div>";
192
- }
193
- $link = "http://www.linkedin.com/shareArticle?mini=true&amp;ro=true&amp;trk=JuizSocialPostSharer&amp;title=".$text."&amp;url=".$url;
194
- $api_link .="<div class='apss-linkedin apss-single-icon'><a title='Share on LinkedIn' target='$apss_link_open_option' href='$link'><div class='apss-icon-block'><i class='fa fa-linkedin'></i><span class='apss-social-text'>Share on $key</span><span class='apss-share'>share</span></div>$counter_linkedin</a></div>";
195
- break;
196
-
197
- case 'digg':
198
- if( $counter_enable_options ==='1' ){
199
- $count_digg=0;
200
- $counter_digg="<div class='count'>$count_digg</div>";
201
- }
202
- $link = "http://digg.com/submit?phase=2%20&amp;url=".$url."&amp;title=".$text;
203
- $api_link .="<div class='apss-digg apss-single-icon'><a title='Share on Digg' target='$apss_link_open_option' href='$link'><div class='apss-icon-block'><i class='fa fa-digg'></i><span class='apss-social-text'>Share on $key</span><span class='apss-share'>share</span></div>$counter_digg</a></div>";
204
- break;
205
-
206
- case 'email':
207
- if ( strpos( $options['apss_email_body'], '%%' ) || strpos( $options['apss_email_subject'], '%%' ) ) {
208
- $link = 'mailto:?subject='.$options['apss_email_subject'].'&amp;body='.$options['apss_email_body'];
209
- $link = preg_replace( array( '#%%title%%#', '#%%siteurl%%#', '#%%permalink%%#', '#%%url%%#' ), array( get_the_title(), get_site_url(), get_permalink(), $url ), $link );
210
- }
211
- else {
212
- $link = 'mailto:?subject='.$options['apss_email_subject'].'&amp;body='.$options['apss_email_body'].": ".$url;
213
- }
214
- $api_link .="<div class='apss-email apss-single-icon'><a title='Share it on Email' target='$apss_link_open_option' href='$link'><div class='apss-icon-block'><i class='fa fa-envelope'></i><span class='apss-social-text'>Send a mail</span><span class='apss-share'>mail</span></div><div class='count'></div></a></div>";
215
- break;
216
-
217
- case 'print':
218
- $api_link .="<div class='apss-print apss-single-icon'><a title='Print' href='javascript:void(0);' onclick='window.print();return false;'><div class='apss-icon-block'><i class='fa fa-print'></i><span class='apss-social-text'>Print</span><span class='apss-share'>print</span></div><div class='count'></div></a></div>";
219
- break;
220
-
221
- default:
222
- echo "should not reach here";
223
-
224
- }
225
- }
226
-
227
- }
228
-
229
  $share_shows_in_options=$options['share_options'];
230
 
231
- $all = in_array('all', $options['share_options']);
232
  $is_lists_authorized = (is_search()) && $all ? true : false;
233
 
234
-
235
-
236
  $all = in_array('all', $options['share_options']);
237
  $is_lists_authorized = (is_search()) && $all ? true : false;
238
 
@@ -241,10 +158,13 @@ if( !class_exists( 'APSS_Class' ) ){
241
 
242
  $share_shows_in_options=$options['share_options'];
243
  $is_singular = is_singular($share_shows_in_options) && !is_front_page() ? true : false;
 
244
  if(!empty($share_shows_in_options)){
245
  $is_tax =is_tax($share_shows_in_options);
 
246
  }else{
247
  $is_tax=false;
 
248
  }
249
 
250
  $is_category = in_array('categories', $options['share_options']);
@@ -253,27 +173,30 @@ if( !class_exists( 'APSS_Class' ) ){
253
  $is_default_archive=in_array('archives', $options['share_options']);
254
  $default_archives=( (is_archive() && !is_tax() )&& !is_category() ) && $is_default_archive ? true : false;
255
 
 
 
 
 
 
 
 
256
 
 
 
 
257
 
258
- if($is_lists_authorized || $is_singular || $is_tax || $is_front_page || $default_category || $default_archives){
259
- if($options['share_positions']=='below_content'){
260
- return $content."<div class='apss-social-share apss-theme-$icon_set_value clearfix' >$api_link</div>";
261
- }
262
-
263
- if($options['share_positions']=='above_content'){
264
- return "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$api_link</div>".$content;
265
- }
266
 
267
- if($options['share_positions']=='on_both'){
268
- return "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$api_link</div>".$content."<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$api_link</div>";
269
- }
270
- }else{
271
- return $content;
272
- }
273
 
274
 
275
  }
276
 
 
277
  function register_admin_assets(){
278
  /**
279
  * Backend CSS
@@ -297,6 +220,9 @@ if( !class_exists( 'APSS_Class' ) ){
297
  wp_enqueue_style( 'apss-font-awesome',APSS_CSS_DIR.'/font-awesome.min.css',array(),APSS_VERSION );
298
  wp_enqueue_style( 'apss-font-opensans','http://fonts.googleapis.com/css?family=Open+Sans',array(),false);
299
  wp_enqueue_style( 'apss-frontend-css', APSS_CSS_DIR . '/frontend.css', array( 'apss-font-awesome' ), APSS_VERSION );
 
 
 
300
  }
301
 
302
  /**
@@ -327,108 +253,230 @@ if( !class_exists( 'APSS_Class' ) ){
327
 
328
 
329
 
330
- ////////////////////////////////////for count //////////////////////////////////////////////////////
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
 
332
- //for facebook url share count
333
- function get_fb( $url, $cache_period ) {
334
- $facebook_count=get_transient('apss_fb_count');
335
- if(false===$facebook_count){
336
- $json_string = $this->get_json_values( 'http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls='.$url );
337
- $json = json_decode( $json_string, true );
338
- $facebook_count = isset( $json[0]['total_count'] )?intval( $json[0]['total_count'] ):0;
339
- set_transient('apss_fb_count', $facebook_count, $cache_period);
340
- return $facebook_count;
341
- }else{
342
- return $facebook_count;
343
- }
344
- }
345
 
346
- //for twitter url share count
347
- function get_tweets( $url, $cache_period ) {
348
- $tweet_count = get_transient('apss_tweets_count');
349
- if(false===$tweet_count){
350
- $json_string = $this->get_json_values( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
351
- $json = json_decode( $json_string, true );
352
- $tweet_count = isset( $json['count'])?intval($json['count'] ):0;
353
- set_transient('apss_tweets_count', $tweet_count, $cache_period);
354
- return $tweet_count;
355
- }else{
356
- return $tweet_count;
357
- }
358
-
359
- }
 
 
 
 
 
 
360
 
361
- //for google plus url share count
362
- function get_plusones( $url, $cache_period ) {
363
- $plusones_count = get_transient('apss_google_plus_count');
364
- if(false === $plusones_count){
365
- $curl = curl_init();
366
- curl_setopt( $curl, CURLOPT_URL, "https://clients6.google.com/rpc");
367
- curl_setopt( $curl, CURLOPT_POST, true);
368
- curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false);
369
- curl_setopt( $curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"'.rawurldecode($url).'","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]');
370
- curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);
371
- curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-type: application/json' ));
372
- $curl_results = curl_exec ( $curl );
373
- curl_close ( $curl );
374
- $json = json_decode( $curl_results, true );
375
- $plusones_count = isset( $json[0]['result']['metadata']['globalCounts']['count'])?intval( $json[0]['result']['metadata']['globalCounts']['count'] ):0;
376
- set_transient('apss_google_plus_count', $plusones_count, $cache_period );
377
- return $plusones_count;
378
- }else{
379
- return $plusones_count;
380
- }
381
- }
382
 
383
- //for pinterest url share count
384
- function get_pinterest( $url, $cache_period ){
385
- $pinterest_count = get_transient('apss_pin_count');
386
- if(false===$pinterest_count){
387
- $json_string = $this->get_json_values( 'http://api.pinterest.com/v1/urls/count.json?url='.$url );
388
- $json_string = preg_replace( '/^receiveCount\((.*)\)$/', "\\1", $json_string );
389
- $json = json_decode( $json_string, true );
390
- $pinterest_count = isset( $json['count'])? intval( $json['count'] ) : 0;
391
- set_transient('apss_pin_count', $pinterest_count, $cache_period );
392
- return $pinterest_count;
393
- }else{
394
- return $pinterest_count;
395
- }
396
-
397
- }
 
 
 
 
 
 
 
 
 
 
 
 
398
 
399
- //for linkedin url share count
400
- function get_linkedin( $url, $cache_period ) {
401
- $linkedin_count=get_transient('apss_linkedin_count');
402
- if(false===$linkedin_count){
403
- $json_string = $this->get_json_values( "https://www.linkedin.com/countserv/count/share?url=$url&format=json" );
404
- $json = json_decode( $json_string, true );
405
- $linkedin_count = isset( $json['count'])?intval($json['count'] ):0;
406
- set_transient('apss_linkedin_count', $linkedin_count, $cache_period);
407
- return $linkedin_count;
408
- }else{
409
- return $linkedin_count;
410
- }
411
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
 
413
 
414
  //function to return json values from social media urls
415
  private function get_json_values( $url ){
416
- $args=array( 'timeout' => 10 );
417
- $response = wp_remote_get( $url, $args );
418
- if(is_wp_error($response)){
419
- //echo 'Error Found ( '.$response->get_error_message().' )';
420
- }else{
421
- return $response['body'];
422
- }
423
  }
424
 
425
  ////////////////////////////////////for count ends here/////////////////////////////////////////////
426
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
427
  /**
428
  * Clears the social share counter cache
429
  */
430
  function apss_clear_cache() {
431
  if (!empty($_GET) && wp_verify_nonce($_GET['_wpnonce'], 'apss-clear-cache-nonce')) {
 
 
 
 
 
 
 
432
  $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');
433
  foreach ($transient_array as $transient) {
434
  delete_transient($transient);
@@ -440,7 +488,6 @@ if( !class_exists( 'APSS_Class' ) ){
440
 
441
  }//APSS_Class termination
442
 
443
-
444
  $apss_object = new APSS_Class();
445
 
446
  }
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: 1.0.4
8
  Author: AccessPress Themes
9
  Author URI: http://accesspressthemes.com
10
  Text Domain:apss-share
31
  }
32
 
33
  if( !defined( 'APSS_VERSION' ) ) {
34
+ define( 'APSS_VERSION', '1.0.4' );
35
  }
36
 
37
  if(!defined('APSS_TEXT_DOMAIN')){
42
  define( 'APSS_SETTING_NAME','apss_share_settings' );
43
  }
44
 
45
+ if(!defined('APSS_COUNT_TRANSIENTS')){
46
+ define( 'APSS_COUNT_TRANSIENTS','apss_social_counts_transients' );
47
+ }
48
+
49
  //Decleration of the class for necessary configuration of a plugin
50
 
51
  if( !class_exists( 'APSS_Class' ) ){
52
  class APSS_Class{
53
+ var $apss_settings;
54
+ var $apss_social_counts_transients;
55
  function __construct() {
56
+ $this->apss_settings = get_option( APSS_SETTING_NAME ); //get the plugin variable contents from the options table.
57
  register_activation_hook( __FILE__, array( $this, 'plugin_activation' ) ); //load the default setting for the plugin while activating
58
  add_action( 'init', array( $this, 'plugin_text_domain' ) ); //load the plugin text domain
59
  add_action('init',array( $this,'session_init')); //start the session if not started yet.
65
  add_action('admin_post_apss_save_options', array( $this, 'apss_save_options')); //save the options in the wordpress options table.
66
  add_action('admin_post_apss_restore_default_settings',array($this,'apss_restore_default_settings'));//restores default settings.
67
  add_action('admin_post_apss_clear_cache',array($this,'apss_clear_cache'));//clear the cache of the social share counter.
68
+ add_action('wp_ajax_nopriv_frontend_counter', array($this, 'frontend_counter'));
69
+ add_action('wp_ajax_frontend_counter', array($this, 'frontend_counter'));
70
  }
71
 
72
  //called when plugin is activated
74
  if( !get_option( APSS_SETTING_NAME ) ){
75
  include( 'inc/backend/activation.php' );
76
  }
77
+
78
+ if( !get_option( APSS_COUNT_TRANSIENTS ) ){
79
+ $apss_social_counts_transients = array();
80
+ update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients);
81
+ }
82
  }
83
 
84
  //loads the text domain for translation
133
 
134
  //function to return the content filter for the posts and pages
135
  function apss_the_content_filter( $content ) {
136
+ global $post;
137
+ $post_content=$content;
138
+ $title = get_the_title();
139
+ $content = strip_tags(get_the_content());
140
+ $excerpt = substr($content, 0, 50);
141
+ $options = $this->apss_settings;
142
+ ob_start();
143
+ include('inc/frontend/content-filter.php');
144
+ $html_content = ob_get_contents();
145
+ ob_get_clean();
146
+
147
+ $options = $this->apss_settings;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  $share_shows_in_options=$options['share_options'];
149
 
150
+ $all = in_array('all', $options['share_options']);
151
  $is_lists_authorized = (is_search()) && $all ? true : false;
152
 
 
 
153
  $all = in_array('all', $options['share_options']);
154
  $is_lists_authorized = (is_search()) && $all ? true : false;
155
 
158
 
159
  $share_shows_in_options=$options['share_options'];
160
  $is_singular = is_singular($share_shows_in_options) && !is_front_page() ? true : false;
161
+
162
  if(!empty($share_shows_in_options)){
163
  $is_tax =is_tax($share_shows_in_options);
164
+
165
  }else{
166
  $is_tax=false;
167
+
168
  }
169
 
170
  $is_category = in_array('categories', $options['share_options']);
173
  $is_default_archive=in_array('archives', $options['share_options']);
174
  $default_archives=( (is_archive() && !is_tax() )&& !is_category() ) && $is_default_archive ? true : false;
175
 
176
+ if(empty($options['share_options'])){
177
+ return $post_content;
178
+
179
+ }else if($is_lists_authorized || $is_singular || $is_tax || $is_front_page || $default_category || $default_archives){
180
+ if ($options['share_positions'] == 'below_content') {
181
+ return $post_content . "<div class='apss-social-share apss-theme-$icon_set_value clearfix' >" . $html_content . "</div>";
182
+ }
183
 
184
+ if ($options['share_positions'] == 'above_content') {
185
+ return "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$html_content</div>" . $post_content;
186
+ }
187
 
188
+ if ($options['share_positions'] == 'on_both') {
189
+ return "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$html_content</div>" . $post_content . "<div class='apss-social-share apss-theme-$icon_set_value clearfix'>$html_content</div>";
190
+ }
 
 
 
 
 
191
 
192
+ } else {
193
+ return $post_content;
194
+ }
 
 
 
195
 
196
 
197
  }
198
 
199
+ //functions to register frontend styles and scripts
200
  function register_admin_assets(){
201
  /**
202
  * Backend CSS
220
  wp_enqueue_style( 'apss-font-awesome',APSS_CSS_DIR.'/font-awesome.min.css',array(),APSS_VERSION );
221
  wp_enqueue_style( 'apss-font-opensans','http://fonts.googleapis.com/css?family=Open+Sans',array(),false);
222
  wp_enqueue_style( 'apss-frontend-css', APSS_CSS_DIR . '/frontend.css', array( 'apss-font-awesome' ), APSS_VERSION );
223
+ wp_enqueue_script('apss-frontend-mainjs', APSS_JS_DIR . '/frontend.js', array('jquery'), APSS_VERSION, true);
224
+ $ajax_nonce = wp_create_nonce('apss-ajax-nonce');
225
+ wp_localize_script('apss-frontend-mainjs', 'frontend_ajax_object', array('ajax_url' => admin_url() . 'admin-ajax.php', 'ajax_nonce' => $ajax_nonce));
226
  }
227
 
228
  /**
253
 
254
 
255
 
256
+ ////////////////////////////////////for count //////////////////////////////////////////////////////
257
+ //for facebook url share count
258
+ function get_fb($url) {
259
+ $apss_settings = $this->apss_settings;
260
+ $cache_period = $apss_settings['cache_period']*60*60;
261
+ $fb_transient = 'fb_' . md5($url);
262
+ $fb_transient_count = get_transient($fb_transient);
263
+
264
+ //for setting the counter transient in separate options value
265
+ $apss_social_counts_transients = get_option( APSS_COUNT_TRANSIENTS );
266
+ if (false === $fb_transient_count) {
267
+ $json_string = $this->get_json_values('https://graph.facebook.com/?id=' . $url);
268
+ $json = json_decode($json_string, true);
269
+ $facebook_count = isset($json['shares']) ? intval($json['shares']) : 0;
270
+ set_transient($fb_transient, $facebook_count, $cache_period);
271
+ if(!in_array( $fb_transient, $apss_social_counts_transients)){
272
+ $apss_social_counts_transients[] = $fb_transient;
273
+ update_option(APSS_COUNT_TRANSIENTS,$apss_social_counts_transients);
274
+ }
275
+
276
 
277
+ } else {
278
+ $facebook_count = $fb_transient_count;
279
+ }
280
+
281
+ return $facebook_count;
282
+ }
 
 
 
 
 
 
 
283
 
284
+ //for twitter url share count
285
+ function get_tweets($url) {
286
+ $apss_settings = $this->apss_settings;
287
+ $cache_period = $apss_settings['cache_period']*60*60;
288
+ $twitter_transient = 'twitter_' . md5($url);
289
+ $twitter_transient_count = get_transient($twitter_transient);
290
+
291
+ //for setting the counter transient in separate options value
292
+ $apss_social_counts_transients = get_option(APSS_COUNT_TRANSIENTS);
293
+
294
+
295
+ if (false === $twitter_transient_count) {
296
+ $json_string = $this->get_json_values('http://urls.api.twitter.com/1/urls/count.json?url=' . $url);
297
+ $json = json_decode($json_string, true);
298
+ $tweet_count = isset($json['count']) ? intval($json['count']) : 0;
299
+ set_transient($twitter_transient, $tweet_count, $cache_period);
300
+ if(!in_array($twitter_transient, $apss_social_counts_transients)){
301
+ $apss_social_counts_transients[] = $twitter_transient;
302
+ update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
303
+ }
304
 
305
+ } else {
306
+ $tweet_count = $twitter_transient_count;
307
+ }
308
+ return $tweet_count;
309
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
 
311
+ //for google plus url share count
312
+ function get_plusones($url) {
313
+ $apss_settings = $this->apss_settings;
314
+ $cache_period = $apss_settings['cache_period']*60*60;
315
+ $googlePlus_transient = 'gp_' . md5($url);
316
+ $googlePlus_transient_count = get_transient($googlePlus_transient);
317
+
318
+ //for setting the counter transient in separate options value
319
+ $apss_social_counts_transients = get_option(APSS_COUNT_TRANSIENTS);
320
+
321
+ if (false === $googlePlus_transient_count) {
322
+ $curl = curl_init();
323
+ curl_setopt($curl, CURLOPT_URL, "https://clients6.google.com/rpc");
324
+ curl_setopt($curl, CURLOPT_POST, true);
325
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
326
+ curl_setopt($curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' . rawurldecode($url) . '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]');
327
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
328
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
329
+ $curl_results = curl_exec($curl);
330
+ curl_close($curl);
331
+ $json = json_decode($curl_results, true);
332
+ $plusones_count = isset($json[0]['result']['metadata']['globalCounts']['count']) ? intval($json[0]['result']['metadata']['globalCounts']['count']) : 0;
333
+ set_transient($googlePlus_transient, $plusones_count, $cache_period);
334
+ if(!in_array($googlePlus_transient, $apss_social_counts_transients)){
335
+ $apss_social_counts_transients[] = $googlePlus_transient;
336
+ update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
337
+ }
338
 
339
+ } else {
340
+ $plusones_count = $googlePlus_transient_count;
341
+
342
+ }
343
+ return $plusones_count;
344
+ }
345
+
346
+ //for pinterest url share count
347
+ function get_pinterest($url) {
348
+ $apss_settings = $this->apss_settings;
349
+ $cache_period = $apss_settings['cache_period']*60*60;
350
+ $pinterest_transient = 'pinterest_' . md5($url);
351
+ $pinterest_transient_count = get_transient($pinterest_transient);
352
+
353
+ //for setting the counter transient in separate options value
354
+ $apss_social_counts_transients = get_option(APSS_COUNT_TRANSIENTS);
355
+
356
+
357
+ if (false === $pinterest_transient_count) {
358
+ $json_string = $this->get_json_values('http://api.pinterest.com/v1/urls/count.json?url=' . $url);
359
+ $json_string = preg_replace('/^receiveCount\((.*)\)$/', "\\1", $json_string);
360
+ $json = json_decode($json_string, true);
361
+ $pinterest_count = isset($json['count']) ? intval($json['count']) : 0;
362
+ set_transient($pinterest_transient, $pinterest_count, $cache_period);
363
+ if(!in_array($pinterest_transient, $apss_social_counts_transients)){
364
+ $apss_social_counts_transients[] = $pinterest_transient;
365
+ update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
366
+ }
367
+
368
+ } else {
369
+ $pinterest_count = $pinterest_transient_count;
370
+
371
+ }
372
+ return $pinterest_count;
373
+ }
374
+
375
+ //for linkedin url share count
376
+ function get_linkedin($url) {
377
+ $apss_settings = $this->apss_settings;
378
+ $cache_period = $apss_settings['cache_period']*60*60;
379
+ $linkedin_transient = 'linkedin_' . md5($url);
380
+ $linkedin_transient_count = get_transient($linkedin_transient);
381
+
382
+ //for setting the counter transient in separate options value
383
+ $apss_social_counts_transients = get_option(APSS_COUNT_TRANSIENTS);
384
+ if (false === $linkedin_transient_count) {
385
+ $json_string = $this->get_json_values("https://www.linkedin.com/countserv/count/share?url=$url&format=json");
386
+ $json = json_decode($json_string, true);
387
+ $linkedin_count = isset($json['count']) ? intval($json['count']) : 0;
388
+ set_transient($linkedin_transient, $linkedin_count, $cache_period);
389
+ if(!in_array($linkedin_transient, $apss_social_counts_transients)){
390
+ $apss_social_counts_transients[] = $linkedin_transient;
391
+ update_option( APSS_COUNT_TRANSIENTS, $apss_social_counts_transients );
392
+ }
393
+
394
+ } else {
395
+ $linkedin_count = $linkedin_transient_count;
396
+
397
+ }
398
+ return $linkedin_count;
399
+ }
400
 
401
 
402
  //function to return json values from social media urls
403
  private function get_json_values( $url ){
404
+ $apss_settings = $this->apss_settings;
405
+ $cache_period = $apss_settings['cache_period']*60*60;
406
+ $args = array('timeout' => 10);
407
+ $response = wp_remote_get($url, $args);
408
+ $json_response = wp_remote_retrieve_body($response);
409
+ return $json_response;
 
410
  }
411
 
412
  ////////////////////////////////////for count ends here/////////////////////////////////////////////
413
 
414
+ function get_count($profile_name, $url) {
415
+ switch ($profile_name) {
416
+ case 'facebook':
417
+ $count = $this->get_fb($url);
418
+ break;
419
+
420
+ case 'twitter':
421
+ $count = $this->get_tweets($url);
422
+ break;
423
+
424
+ case 'google-plus':
425
+ $count = $this->get_plusones($url);
426
+ break;
427
+
428
+ case 'linkedin':
429
+ $count = $this->get_linkedin($url);
430
+ break;
431
+
432
+ case 'pinterest':
433
+ $count = $this->get_pinterest($url);
434
+ break;
435
+
436
+ default:
437
+ $count = 0;
438
+ break;
439
+ }
440
+ return $count;
441
+ }
442
+
443
+
444
+ function frontend_counter() {
445
+ if (!empty($_GET) && wp_verify_nonce($_GET['_wpnonce'], 'apss-ajax-nonce')) {
446
+ $apss_settings = $this->apss_settings;
447
+ $new_detail_array = array();
448
+ if (isset($_POST['data'])) {
449
+ $details = $_POST['data'];
450
+ foreach ($details as $detail) {
451
+ $new_detail_array[$detail['network']] = $this->get_count($detail['network'], $detail['url']);
452
+ }
453
+ } else {
454
+ $shortcode_data = $_POST['shortcode_data'];
455
+ foreach ($shortcode_data as $detail) {
456
+ $detail_array = explode('_', $detail);
457
+ $url = trim($detail_array[0]);
458
+ $network = $detail_array[1];
459
+ $new_detail_array[] = $this->get_count($network, $url);
460
+ }
461
+ }
462
+ die(json_encode($new_detail_array));
463
+ }
464
+ }
465
+
466
+
467
+
468
  /**
469
  * Clears the social share counter cache
470
  */
471
  function apss_clear_cache() {
472
  if (!empty($_GET) && wp_verify_nonce($_GET['_wpnonce'], 'apss-clear-cache-nonce')) {
473
+ $apss_settings = $this->apss_settings;
474
+
475
+ $apss_social_counts_transients = get_option(APSS_COUNT_TRANSIENTS);
476
+ foreach ($apss_social_counts_transients as $transient) {
477
+ delete_transient($transient);
478
+ }
479
+ update_option( APSS_COUNT_TRANSIENTS, array() );
480
  $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');
481
  foreach ($transient_array as $transient) {
482
  delete_transient($transient);
488
 
489
  }//APSS_Class termination
490
 
 
491
  $apss_object = new APSS_Class();
492
 
493
  }
css/backend.css CHANGED
@@ -20,7 +20,7 @@
20
  color:#fff;
21
 
22
  /*transition: all 0.5s ease-in-out;
23
- -webkit-transition:all 0.5s ease-in-out;
24
  -moz-transition: all 0.5s ease-in-out;
25
  -o-transition:all 0.5s ease-in-out;
26
  -ms-transition: all 0.5s ease-in-out;*/
@@ -33,51 +33,51 @@
33
  }
34
 
35
  .apss-setting-tabs li:first-child a{
36
- border-left:none;
37
  }
38
 
39
  .apss-setting-tabs li a.apss-active-tab,.apss-setting-tabs li a:hover{
40
- background-color: #fff;
41
- color:#0074a2;
42
  }
43
 
44
  .apss-setting-tabs li a:before{
45
- border-top: 2px solid #0074a2;
46
- height:2px;
47
- width:100%;
48
- position:absolute;
49
- content:"";
50
- left:0;
51
- bottom:-4px;
52
- opacity: 0;
53
- /*transition: all 0.5s ease-in-out;
54
- -webkit-transition:all 0.5s ease-in-out;
55
  -moz-transition: all 0.5s ease-in-out;
56
  -o-transition:all 0.5s ease-in-out;
57
  -ms-transition: all 0.5s ease-in-out;*/
58
  }
59
 
60
  .apss-setting-tabs li a:hover:before{
61
- border-top: 2px solid #0074a2;
62
- height:2px;
63
- width:100%;
64
- position:absolute;
65
- content:"";
66
- left:0;
67
- bottom: 44px;
68
- opacity:1;
69
 
70
  }
71
 
72
  .apss-setting-tabs li a.apss-active-tab:before{
73
- border-top: 2px solid #0074a2;
74
- height:2px;
75
- width:100%;
76
- position:absolute;
77
- content:"";
78
- left:0;
79
- top:0;
80
- opacity: 1;
81
  }
82
 
83
  .apss-wrapper {
@@ -105,7 +105,7 @@
105
  .apss-wrapper-block {
106
  width: 833px;
107
  padding: 20px 0;
108
- float:left;
109
  }
110
 
111
  .apss-setting-header {
@@ -144,7 +144,7 @@
144
  }
145
 
146
  .apss-message{
147
- background: none repeat scroll 0 0 #fff;
148
  border-left: 4px solid #7ad03a;
149
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
150
  margin: 5px 0 30px;
@@ -215,7 +215,7 @@
215
 
216
  .apss_notes_cache_settings {
217
  color: #666666;
218
- display: block;
219
  font-style: italic;
220
  line-height: 1.6;
221
  margin-left: 2px;
@@ -225,7 +225,7 @@
225
  }
226
 
227
  .error{
228
- color: #ef1515;
229
  font-size: 13px;
230
  }
231
 
@@ -312,7 +312,7 @@
312
  }
313
 
314
  .other-products h3.get-header:after{
315
- transform: perspective(8px) rotateX(1.93deg) translateZ(-1px);
316
  -webkit-transform: perspective(8px) rotateX(1.93deg) translateZ(-1px);
317
  }
318
 
@@ -323,14 +323,14 @@
323
  }
324
 
325
  .social-icon li a{
326
- width:36px;
327
- height:36px;
328
- display:block;
329
- transition: all 0.2s ease-in;
330
- -webkit-transition:all 0.2s ease-in;
331
- -moz-transition: all 0.2s ease-in;
332
- -o-transition:all 0.2s ease-in;
333
- -ms-transition: all 0.2s ease-in;
334
  }
335
 
336
 
@@ -381,16 +381,16 @@
381
  }
382
 
383
  .apss-promoFloat{
384
- background: #f1f1f1;
385
- float: left;
386
- width: 311px;
387
- padding: 20px 10px;
388
  }
389
  .apss-promo-buttons{
390
- padding:20px 0;
391
- text-align:center;
392
  }
393
  .apss-promo-buttons a{
394
- display:inline-block;
395
  }
396
 
20
  color:#fff;
21
 
22
  /*transition: all 0.5s ease-in-out;
23
+ -webkit-transition:all 0.5s ease-in-out;
24
  -moz-transition: all 0.5s ease-in-out;
25
  -o-transition:all 0.5s ease-in-out;
26
  -ms-transition: all 0.5s ease-in-out;*/
33
  }
34
 
35
  .apss-setting-tabs li:first-child a{
36
+ border-left:none;
37
  }
38
 
39
  .apss-setting-tabs li a.apss-active-tab,.apss-setting-tabs li a:hover{
40
+ background-color: #fff;
41
+ color:#0074a2;
42
  }
43
 
44
  .apss-setting-tabs li a:before{
45
+ border-top: 2px solid #0074a2;
46
+ height:2px;
47
+ width:100%;
48
+ position:absolute;
49
+ content:"";
50
+ left:0;
51
+ bottom:-4px;
52
+ opacity: 0;
53
+ /*transition: all 0.5s ease-in-out;
54
+ -webkit-transition:all 0.5s ease-in-out;
55
  -moz-transition: all 0.5s ease-in-out;
56
  -o-transition:all 0.5s ease-in-out;
57
  -ms-transition: all 0.5s ease-in-out;*/
58
  }
59
 
60
  .apss-setting-tabs li a:hover:before{
61
+ border-top: 2px solid #0074a2;
62
+ height:2px;
63
+ width:100%;
64
+ position:absolute;
65
+ content:"";
66
+ left:0;
67
+ bottom: 44px;
68
+ opacity:1;
69
 
70
  }
71
 
72
  .apss-setting-tabs li a.apss-active-tab:before{
73
+ border-top: 2px solid #0074a2;
74
+ height:2px;
75
+ width:100%;
76
+ position:absolute;
77
+ content:"";
78
+ left:0;
79
+ top:0;
80
+ opacity: 1;
81
  }
82
 
83
  .apss-wrapper {
105
  .apss-wrapper-block {
106
  width: 833px;
107
  padding: 20px 0;
108
+ float:left;
109
  }
110
 
111
  .apss-setting-header {
144
  }
145
 
146
  .apss-message{
147
+ background: none repeat scroll 0 0 #fff;
148
  border-left: 4px solid #7ad03a;
149
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
150
  margin: 5px 0 30px;
215
 
216
  .apss_notes_cache_settings {
217
  color: #666666;
218
+ display: block;
219
  font-style: italic;
220
  line-height: 1.6;
221
  margin-left: 2px;
225
  }
226
 
227
  .error{
228
+ color: #ef1515;
229
  font-size: 13px;
230
  }
231
 
312
  }
313
 
314
  .other-products h3.get-header:after{
315
+ transform: perspective(8px) rotateX(1.93deg) translateZ(-1px);
316
  -webkit-transform: perspective(8px) rotateX(1.93deg) translateZ(-1px);
317
  }
318
 
323
  }
324
 
325
  .social-icon li a{
326
+ width:36px;
327
+ height:36px;
328
+ display:block;
329
+ transition: all 0.2s ease-in;
330
+ -webkit-transition:all 0.2s ease-in;
331
+ -moz-transition: all 0.2s ease-in;
332
+ -o-transition:all 0.2s ease-in;
333
+ -ms-transition: all 0.2s ease-in;
334
  }
335
 
336
 
381
  }
382
 
383
  .apss-promoFloat{
384
+ background: #f1f1f1;
385
+ float: left;
386
+ width: 311px;
387
+ padding: 20px 10px;
388
  }
389
  .apss-promo-buttons{
390
+ padding:20px 0;
391
+ text-align:center;
392
  }
393
  .apss-promo-buttons a{
394
+ display:inline-block;
395
  }
396
 
css/frontend.css CHANGED
@@ -62,7 +62,7 @@ a:hover, a:focus {
62
  font-size:18px;
63
  border: 1px solid #dcdcdc;
64
  border-radius: 5px;
65
- padding: 1px 6px;
66
  position: relative;
67
  background-color: #f7f7f7;
68
  width: 82px;
62
  font-size:18px;
63
  border: 1px solid #dcdcdc;
64
  border-radius: 5px;
65
+ padding: 1px 4px;
66
  position: relative;
67
  background-color: #f7f7f7;
68
  width: 82px;
images/Thumbs.db CHANGED
Binary file
images/theme/Thumbs.db CHANGED
Binary file
inc/backend/activation.php CHANGED
@@ -18,8 +18,9 @@ defined('ABSPATH') or die("No script kiddies please!");
18
  $apss_share_settings['twitter_username'] = '';
19
  $apss_share_settings['counter_enable_options']='0';
20
  $apss_share_settings['cache_period']='24';
 
21
  $apss_share_settings['dialog_box_options'] ='1';
22
  $apss_share_settings['footer_javascript'] = '1';
23
  $apss_share_settings['apss_email_subject'] = 'Please visit this link %%url%%';
24
  $apss_share_settings['apss_email_body'] = 'Hey Buddy!, I found this information for you: "%%title%%". Here is the website link: %%permalink%%. Thank you.';
25
- update_option( APSS_SETTING_NAME, $apss_share_settings);
18
  $apss_share_settings['twitter_username'] = '';
19
  $apss_share_settings['counter_enable_options']='0';
20
  $apss_share_settings['cache_period']='24';
21
+ $apss_share_settings['apss_social_counts_transients']=array();
22
  $apss_share_settings['dialog_box_options'] ='1';
23
  $apss_share_settings['footer_javascript'] = '1';
24
  $apss_share_settings['apss_email_subject'] = 'Please visit this link %%url%%';
25
  $apss_share_settings['apss_email_body'] = 'Hey Buddy!, I found this information for you: "%%title%%". Here is the website link: %%permalink%%. Thank you.';
26
+ update_option( APSS_SETTING_NAME, $apss_share_settings);
inc/backend/main-page.php CHANGED
@@ -184,7 +184,7 @@ if(isset($_SESSION['apss_message'])){ ?>
184
  <div class="apss-promoFloat">
185
  <img src="<?php echo APSS_IMAGE_DIR . '/promo-top.png' ?>" alt="promo-top" />
186
  <div class="apss-promo-buttons"><a target='_blank' href="http://accesspressthemes.com/demo/wordpress-plugins/accesspress-social-pro" /><img src="<?php echo APSS_IMAGE_DIR . '/demo-btn.png' ?>" alt="demo link" /></a><a target='_blank' href="http://codecanyon.net/item/accesspress-social-pro/10429645?ref=AccessKeys" ><img src="<?php echo APSS_IMAGE_DIR . '/upgrade-btn.png' ?>" alt="upgrade link" /></a></div>
187
- <img src="<?php echo APSS_IMAGE_DIR . '/promo-top.png' ?>" alt="promo-bottom" />
188
  <div class="apss-promo-buttons"><a target='_blank' href="http://accesspressthemes.com/demo/wordpress-plugins/accesspress-social-pro" /><img src="<?php echo APSS_IMAGE_DIR . '/demo-btn.png' ?>" alt="demo link" /></a><a target='_blank' href="http://codecanyon.net/item/accesspress-social-pro/10429645?ref=AccessKeys" ><img src="<?php echo APSS_IMAGE_DIR . '/upgrade-btn.png' ?>" alt="upgrade link" /></a></div>
189
  </div>
190
- <div class="clear"></div>
184
  <div class="apss-promoFloat">
185
  <img src="<?php echo APSS_IMAGE_DIR . '/promo-top.png' ?>" alt="promo-top" />
186
  <div class="apss-promo-buttons"><a target='_blank' href="http://accesspressthemes.com/demo/wordpress-plugins/accesspress-social-pro" /><img src="<?php echo APSS_IMAGE_DIR . '/demo-btn.png' ?>" alt="demo link" /></a><a target='_blank' href="http://codecanyon.net/item/accesspress-social-pro/10429645?ref=AccessKeys" ><img src="<?php echo APSS_IMAGE_DIR . '/upgrade-btn.png' ?>" alt="upgrade link" /></a></div>
187
+ <img src="<?php echo APSS_IMAGE_DIR . '/promo-bottom.png' ?>" alt="promo-bottom" />
188
  <div class="apss-promo-buttons"><a target='_blank' href="http://accesspressthemes.com/demo/wordpress-plugins/accesspress-social-pro" /><img src="<?php echo APSS_IMAGE_DIR . '/demo-btn.png' ?>" alt="demo link" /></a><a target='_blank' href="http://codecanyon.net/item/accesspress-social-pro/10429645?ref=AccessKeys" ><img src="<?php echo APSS_IMAGE_DIR . '/upgrade-btn.png' ?>" alt="upgrade link" /></a></div>
189
  </div>
190
+ <div class="clear"></div>
inc/backend/save-settings.php CHANGED
@@ -26,11 +26,15 @@
26
  $apss_share_settings['footer_javascript'] = $_POST['apss_share_settings']['footer_javascript'];
27
  $apss_share_settings['apss_email_subject'] = stripslashes_deep($_POST['apss_share_settings']['apss_email_subject']);
28
  $apss_share_settings['apss_email_body'] = stripslashes_deep($_POST['apss_share_settings']['apss_email_body']);
 
 
 
29
 
30
  // The option already exists, so we just update it.
31
  update_option(APSS_SETTING_NAME, $apss_share_settings );
32
  $_SESSION['apss_message'] = __('Settings Saved Successfully.', APSS_TEXT_DOMAIN);
33
  wp_redirect(admin_url().'admin.php?page=apss-share');
34
  exit;
 
35
  }
36
 
26
  $apss_share_settings['footer_javascript'] = $_POST['apss_share_settings']['footer_javascript'];
27
  $apss_share_settings['apss_email_subject'] = stripslashes_deep($_POST['apss_share_settings']['apss_email_subject']);
28
  $apss_share_settings['apss_email_body'] = stripslashes_deep($_POST['apss_share_settings']['apss_email_body']);
29
+ if(!isset($apss_share_settings['apss_social_counts_transients'])){
30
+ $apss_share_settings['apss_social_counts_transients']=array();
31
+ }
32
 
33
  // The option already exists, so we just update it.
34
  update_option(APSS_SETTING_NAME, $apss_share_settings );
35
  $_SESSION['apss_message'] = __('Settings Saved Successfully.', APSS_TEXT_DOMAIN);
36
  wp_redirect(admin_url().'admin.php?page=apss-share');
37
  exit;
38
+
39
  }
40
 
inc/frontend/content-filter.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $apss_link_open_option=($options['dialog_box_options']=='1') ? "_blank": "";
3
+ $twitter_user=$options['twitter_username'];
4
+ $counter_enable_options=$options['counter_enable_options'];
5
+ $api_link='';
6
+ $icon_set_value=$options['social_icon_set'];
7
+ $url = get_the_permalink(); //$this->curPageURL();
8
+ $text= get_the_title();
9
+ $cache_period = ($options['cache_period'] != '') ? $options['cache_period']*60*60 : 24 * 60 * 60 ;
10
+ foreach( $options['social_networks'] as $key=>$value ){
11
+ if( intval($value)=='1' ){
12
+ switch($key){
13
+ //counter available for facebook
14
+ case 'facebook':
15
+ $link = 'https://www.facebook.com/sharer/sharer.php?u='.$url;
16
+ ?>
17
+ <div class='apss-facebook apss-single-icon'>
18
+ <a title='Share on Facebook' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
19
+ <div class='apss-icon-block clearfix'>
20
+ <i class='fa fa-facebook'></i>
21
+ <span class='apss-social-text'><?php _e('Share on', APSS_TEXT_DOMAIN ); ?> <?php echo ucfirst($key); ?></span>
22
+ <span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
23
+ </div>
24
+ <?php if(isset($counter_enable_options) && $counter_enable_options=='1'){ ?>
25
+ <div class='count apss-count' data-url='<?php echo $url;?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url.'_'.$key;?>">Loading...</div>
26
+ <?php } ?>
27
+ </a>
28
+ </div>
29
+ <?php
30
+ break;
31
+
32
+ //counter available for twitter
33
+ case 'twitter':
34
+ $url_twitter = $url;
35
+ $url_twitter=urlencode($url_twitter);
36
+ if(isset( $twitter_user) && $twitter_user !='' ){
37
+ $twitter_user = 'via='.$twitter_user;
38
+ }
39
+ $link ="https://twitter.com/intent/tweet?text=$title&amp;url=$url_twitter&amp;$twitter_user";
40
+ ?>
41
+ <div class='apss-twitter apss-single-icon'>
42
+ <a title='Share on Twitter' target='<?php echo $apss_link_open_option; ?>' href="<?php echo $link; ?>">
43
+ <div class='apss-icon-block clearfix'>
44
+ <i class='fa fa-twitter'></i>
45
+ <span class='apss-social-text'><?php _e('Share on', APSS_TEXT_DOMAIN ); ?> <?php echo ucfirst($key); ?></span><span class='apss-share'><?php _e( 'Tweet', APSS_TEXT_DOMAIN ); ?></span>
46
+ </div>
47
+ <?php if(isset($counter_enable_options) && $counter_enable_options=='1'){ ?>
48
+ <div class='count apss-count' data-url='<?php echo $url;?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url.'_'.$key;?>">Loading...</div>
49
+ <?php } ?>
50
+ </a>
51
+ </div>
52
+ <?php
53
+ break;
54
+
55
+ //counter available for google plus
56
+ case 'google-plus':
57
+ $link = 'https://plus.google.com/share?url='.$url;
58
+ ?>
59
+ <div class='apss-google-plus apss-single-icon'>
60
+ <a title='Share on Google+' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
61
+ <div class='apss-icon-block clearfix'>
62
+ <i class='fa fa-google-plus'></i>
63
+ <span class='apss-social-text'><?php _e('Share on', APSS_TEXT_DOMAIN ); ?> Google Plus</span>
64
+ <span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
65
+ </div>
66
+ <?php if(isset($counter_enable_options) && $counter_enable_options=='1'){ ?>
67
+ <div class='count apss-count' data-url='<?php echo $url;?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url.'_'.$key;?>">Loading...</div>
68
+ <?php } ?>
69
+ </a>
70
+ </div>
71
+ <?php
72
+ break;
73
+
74
+ //counter available for pinterest
75
+ case 'pinterest':
76
+ // if(has_post_thumbnail()){
77
+ // $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
78
+ // $link = 'http://pinterest.com/pin/create/bookmarklet/?media='.$image[0].'&amp;url='.$url.'&amp;title='.$title.'&amp;description='.$excerpt;
79
+ ?>
80
+
81
+ <div class='apss-pinterest apss-single-icon'>
82
+ <a title='Share on Pinterest' href='javascript:void((function()%7Bvar%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;http://assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)%7D)());'>
83
+ <div class='apss-icon-block clearfix'>
84
+ <i class='fa fa-pinterest'></i>
85
+ <span class='apss-social-text'><?php _e('Share on', APSS_TEXT_DOMAIN ); ?> <?php echo ucfirst($key); ?></span>
86
+ <span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
87
+ </div>
88
+
89
+ <?php if(isset($counter_enable_options) && $counter_enable_options=='1'){ ?>
90
+ <div class='count apss-count' data-url='<?php echo $url;?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url.'_'.$key;?>">Loading...</div>
91
+ <?php } ?>
92
+
93
+ </a>
94
+ </div>
95
+ <?php
96
+ //}
97
+ break;
98
+
99
+ //couter available for linkedin
100
+ case 'linkedin':
101
+ $link = "http://www.linkedin.com/shareArticle?mini=true&amp;ro=true&amp;trk=JuizSocialPostSharer&amp;title=".$title."&amp;url=".$url;
102
+ ?>
103
+ <div class='apss-linkedin apss-single-icon'>
104
+ <a title='Share on LinkedIn' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
105
+ <div class='apss-icon-block clearfix'><i class='fa fa-linkedin'></i>
106
+ <span class='apss-social-text'><?php _e('Share on', APSS_TEXT_DOMAIN ); ?> <?php echo ucfirst($key); ?></span>
107
+ <span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
108
+ </div>
109
+
110
+ <?php if(isset($counter_enable_options) && $counter_enable_options=='1'){ ?>
111
+ <div class='count apss-count' data-url='<?php echo $url;?>' data-social-network='<?php echo $key; ?>' data-social-detail="<?php echo $url.'_'.$key;?>">Loading...</div>
112
+ <?php } ?>
113
+
114
+ </a>
115
+ </div>
116
+ <?php
117
+ break;
118
+
119
+ //there is no counter available for digg
120
+ case 'digg':
121
+ $link = "http://digg.com/submit?phase=2%20&amp;url=".$url."&amp;title=".$title;
122
+ ?>
123
+ <div class='apss-digg apss-single-icon'>
124
+ <a title='Share on Digg' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
125
+ <div class='apss-icon-block clearfix'>
126
+ <i class='fa fa-digg'></i>
127
+ <span class='apss-social-text'><?php _e('Share on', APSS_TEXT_DOMAIN ); ?> <?php echo ucfirst($key); ?></span>
128
+ <span class='apss-share'><?php _e( 'Share', APSS_TEXT_DOMAIN ); ?></span>
129
+ </div>
130
+ </a>
131
+ </div>
132
+
133
+ <?php
134
+ break;
135
+
136
+ case 'email':
137
+ if ( strpos( $options['apss_email_body'], '%%' ) || strpos( $options['apss_email_subject'], '%%' ) ) {
138
+ $link = 'mailto:?subject='.$options['apss_email_subject'].'&amp;body='.$options['apss_email_body'];
139
+ $link = preg_replace( array( '#%%title%%#', '#%%siteurl%%#', '#%%permalink%%#', '#%%url%%#' ), array( get_the_title(), get_site_url(), get_permalink(), $url ), $link );
140
+ }
141
+ else {
142
+ $link = 'mailto:?subject='.$options['apss_email_subject'].'&amp;body='.$options['apss_email_body'].": ".$url;
143
+ }
144
+ ?>
145
+ <div class='apss-email apss-single-icon'>
146
+ <a class='share-email-popup' title='Share it on Email' target='<?php echo $apss_link_open_option; ?>' href='<?php echo $link; ?>'>
147
+ <div class='apss-icon-block clearfix'>
148
+ <i class='fa fa-envelope'></i>
149
+ <span class='apss-social-text'><?php _e( 'Send email', APSS_TEXT_DOMAIN ); ?></span>
150
+ <span class='apss-share'><?php _e( 'Mail', APSS_TEXT_DOMAIN ); ?></span>
151
+ </div>
152
+ </a>
153
+ </div>
154
+
155
+ <?php
156
+ break;
157
+
158
+ case 'print':
159
+ ?>
160
+ <div class='apss-print apss-single-icon'>
161
+ <a title='Print' href='javascript:void(0);' onclick='window.print();return false;'>
162
+ <div class='apss-icon-block clearfix'><i class='fa fa-print'></i>
163
+ <span class='apss-social-text'><?php _e( 'Print', APSS_TEXT_DOMAIN ); ?></span>
164
+ <span class='apss-share'><?php _e( 'Print', APSS_TEXT_DOMAIN ); ?></span>
165
+ </div>
166
+ </a>
167
+ </div>
168
+ <?php
169
+ break;
170
+
171
+ }
172
+ }
173
+
174
+ }
175
+ ?>
js/backend.js CHANGED
@@ -15,7 +15,6 @@ jQuery('.'+args).html('');
15
  profile_array.push($(this).attr('data-key')) ;
16
  });
17
  var social_networks_orders = profile_array.join(',');
18
- //console.log(social_networks_orders);
19
  $('#apss_social_newtwork_order').val(social_networks_orders);
20
  }
21
  });
15
  profile_array.push($(this).attr('data-key')) ;
16
  });
17
  var social_networks_orders = profile_array.join(',');
 
18
  $('#apss_social_newtwork_order').val(social_networks_orders);
19
  }
20
  });
js/frontend.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function ($) {
2
+
3
+ var shortcode_profile_array = [];
4
+ $('.apss-count').each(function () {
5
+ var social_detail = $(this).attr('data-social-detail');
6
+ if ($.inArray(social_detail, shortcode_profile_array) == -1) {
7
+ shortcode_profile_array.push(social_detail);
8
+ }
9
+ });
10
+ if (shortcode_profile_array.length > 0)
11
+ {
12
+ $.ajax({
13
+ type: 'post',
14
+ url: frontend_ajax_object.ajax_url + '/?action=frontend_counter&_wpnonce=' + frontend_ajax_object.ajax_nonce,
15
+ data: {shortcode_data: shortcode_profile_array},
16
+ success: function (res) {
17
+ res = $.parseJSON(res);
18
+ for (var i=0;i<=shortcode_profile_array.length;i++) {
19
+ var social_detail = shortcode_profile_array[i];
20
+ var count = (res[i])?res[i]:0;
21
+ $('.apss-count[data-social-detail="' + social_detail + '"]').html(count);
22
+ }
23
+ }
24
+ });
25
+ }
26
+
27
+ });
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.1
7
- Stable tag: 1.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -89,12 +89,17 @@ Once you install the plugin , you can check some general documentation about how
89
  6. Backend Miscellaneous Settings Section
90
 
91
  == Changelog ==
 
 
 
 
 
 
 
92
  = 1.0.3 =
93
  * Fixed the bug for pinterest images share.
94
  * Fixed the bug for the post and page share url.
95
 
96
-
97
- == Changelog ==
98
  = 1.0.2 =
99
  * Fixed the bug for pre-selected page share options.
100
  * Done the bug fixing for label attributes for display settings tab and miscellaneous tab.
4
  Donate link: http://accesspressthemes.com/donation/
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
+ Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
89
  6. Backend Miscellaneous Settings Section
90
 
91
  == Changelog ==
92
+ = 1.0.4 =
93
+ * Code modification for the pinterest share options for images.
94
+ * Share count using ajax to store it in cache.
95
+ * Changes in the upgrade banner images.
96
+ * Fixed the bug for share options if not selected to any.
97
+ * Fixed the bug in the twitter share and added twitter share via in the twitter share link.
98
+
99
  = 1.0.3 =
100
  * Fixed the bug for pinterest images share.
101
  * Fixed the bug for the post and page share url.
102
 
 
 
103
  = 1.0.2 =
104
  * Fixed the bug for pre-selected page share options.
105
  * Done the bug fixing for label attributes for display settings tab and miscellaneous tab.