Shariff Wrapper - Version 4.2.1

Version Description

  • fix WhatsApp button on Android when using Chrome
  • fix Shariff being added to RSS feeds under certain conditions
  • update to latest Facebook Graph API for share count requests
Download this release

Release Info

Developer starguide
Plugin Icon 128x128 Shariff Wrapper
Version 4.2.1
Comparing to
See all releases

Code changes from version 4.2.0 to 4.2.1

admin/admin_menu.php CHANGED
@@ -481,7 +481,7 @@ function shariff3UU_multiplecheckbox_add_after_render() {
481
  // add after all excerpts
482
  echo '<p><input type="checkbox" name="shariff3UU_basic[add_after][excerpt]" ';
483
  if ( isset( $GLOBALS["shariff3UU_basic"]["add_after"]["excerpt"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_after"]["excerpt"], 1, 0 );
484
- echo ' value="1">' . __('Excerpt', 'shariff') . '</p>';
485
 
486
  // add after custom post types - choose after which to add
487
  $post_types = get_post_types( array( '_builtin' => FALSE ) );
@@ -520,7 +520,7 @@ function shariff3UU_multiplecheckbox_add_before_render() {
520
  // Add before all excerpts
521
  echo '<p><input type="checkbox" name="shariff3UU_basic[add_before][excerpt]" ';
522
  if ( isset( $GLOBALS["shariff3UU_basic"]["add_before"]["excerpt"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_before"]["excerpt"], 1, 0 );
523
- echo ' value="1">' . __('Excerpt', 'shariff') . '</p>';
524
  }
525
 
526
  // disable on password protected posts
481
  // add after all excerpts
482
  echo '<p><input type="checkbox" name="shariff3UU_basic[add_after][excerpt]" ';
483
  if ( isset( $GLOBALS["shariff3UU_basic"]["add_after"]["excerpt"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_after"]["excerpt"], 1, 0 );
484
+ echo ' value="1">' . __('Excerpts', 'shariff') . '</p>';
485
 
486
  // add after custom post types - choose after which to add
487
  $post_types = get_post_types( array( '_builtin' => FALSE ) );
520
  // Add before all excerpts
521
  echo '<p><input type="checkbox" name="shariff3UU_basic[add_before][excerpt]" ';
522
  if ( isset( $GLOBALS["shariff3UU_basic"]["add_before"]["excerpt"] ) ) echo checked( $GLOBALS["shariff3UU_basic"]["add_before"]["excerpt"], 1, 0 );
523
+ echo ' value="1">' . __('Excerpts', 'shariff') . '</p>';
524
  }
525
 
526
  // disable on password protected posts
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === Shariff Wrapper ===
2
  Contributors: 3UU, starguide
3
  Tags: Shariff, Facebook, Twitter, VKontakte, VK, GooglePlus, WhatsApp, share buttons, sharing, privacy, social
4
  Requires at least: 4.4
5
  Tested up to: 4.6
6
- Stable tag: 4.2.0
7
  License: MIT
8
  License URI: http://opensource.org/licenses/MIT
9
  Donate link: http://folge.link/?bitcoin=1Ritz1iUaLaxuYcXhUCoFhkVRH6GWiMTP
@@ -172,6 +172,11 @@ fixed in the future - if we have time to spend or you provide us with a lot of "
172
 
173
  == Changelog ==
174
 
 
 
 
 
 
175
  = 4.2.0 =
176
  - new option to set the rate limit for sending mails using the mail form
177
  - added home url as fallback for share count requests
1
+ === Shariff Wrapper ===
2
  Contributors: 3UU, starguide
3
  Tags: Shariff, Facebook, Twitter, VKontakte, VK, GooglePlus, WhatsApp, share buttons, sharing, privacy, social
4
  Requires at least: 4.4
5
  Tested up to: 4.6
6
+ Stable tag: 4.2.1
7
  License: MIT
8
  License URI: http://opensource.org/licenses/MIT
9
  Donate link: http://folge.link/?bitcoin=1Ritz1iUaLaxuYcXhUCoFhkVRH6GWiMTP
172
 
173
  == Changelog ==
174
 
175
+ = 4.2.1 =
176
+ - fix WhatsApp button on Android when using Chrome
177
+ - fix Shariff being added to RSS feeds under certain conditions
178
+ - update to latest Facebook Graph API for share count requests
179
+
180
  = 4.2.0 =
181
  - new option to set the rate limit for sending mails using the mail form
182
  - added home url as fallback for share count requests
services/shariff-facebook.php CHANGED
@@ -70,17 +70,17 @@ elseif ( isset( $backend ) && $backend == '1' ) {
70
  }
71
  // otherwise use the normal way
72
  else {
73
- $facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/fql?q=SELECT%20total_count%20FROM%20link_stat%20WHERE%20url="' . $post_url . '"' ) ) );
74
  $facebook_json = json_decode( $facebook, true );
75
  }
76
 
77
  // store results - use total_count if it exists, otherwise use share_count - ordered based on proximity of occurrence
78
- if ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['total_count'] ) ) {
79
- $share_counts['facebook'] = intval( $facebook_json['data'][0]['total_count'] );
80
- }
81
- elseif ( isset($facebook_json['share'] ) && isset( $facebook_json['share']['share_count'] ) ) {
82
  $share_counts['facebook'] = intval( $facebook_json['share']['share_count'] );
83
  }
 
 
 
84
  elseif ( isset($facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['share_count'] ) ) {
85
  $share_counts['facebook'] = intval( $facebook_json['data'][0]['share_count'] );
86
  }
70
  }
71
  // otherwise use the normal way
72
  else {
73
+ $facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/?id=' . $post_url ) ) );
74
  $facebook_json = json_decode( $facebook, true );
75
  }
76
 
77
  // store results - use total_count if it exists, otherwise use share_count - ordered based on proximity of occurrence
78
+ if ( isset( $facebook_json['share'] ) && isset( $facebook_json['share']['share_count'] ) ) {
 
 
 
79
  $share_counts['facebook'] = intval( $facebook_json['share']['share_count'] );
80
  }
81
+ elseif ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['total_count'] ) ) {
82
+ $share_counts['facebook'] = intval( $facebook_json['data'][0]['total_count'] );
83
+ }
84
  elseif ( isset($facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['share_count'] ) ) {
85
  $share_counts['facebook'] = intval( $facebook_json['data'][0]['share_count'] );
86
  }
shariff.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Shariff Wrapper
4
  * Plugin URI: https://de.wordpress.org/plugins/shariff/
5
  * Description: The Shariff Wrapper provides share buttons that respect the privacy of your visitors and are compliant to the German data protection laws.
6
- * Version: 4.2.0
7
  * Author: Jan-Peter Lambeck & 3UU
8
  * Author URI: https://de.wordpress.org/plugins/shariff/
9
  * License: MIT
@@ -26,7 +26,7 @@ $shariff3UU = array_merge( $shariff3UU_basic, $shariff3UU_design, $shariff3UU_ad
26
  // update function to perform tasks _once_ after an update, based on version number to work for automatic as well as manual updates
27
  function shariff3UU_update() {
28
  /******************** ADJUST VERSION ********************/
29
- $code_version = "4.2.0"; // set code version - needs to be adjusted for every new version!
30
  /******************** ADJUST VERSION ********************/
31
 
32
  // get options
@@ -484,6 +484,14 @@ function shariff3UU_hideshariff( $content ) {
484
  }
485
  add_filter( 'the_content', 'shariff3UU_hideshariff', 999 );
486
 
 
 
 
 
 
 
 
 
487
  // add mailform to bbpress_replies
488
  function bbp_add_mailform_to_bbpress_replies() {
489
  $content = '';
@@ -768,7 +776,9 @@ function shariff3UU_render( $atts, $content = null ) {
768
  $button_text_array = '';
769
 
770
  // build the actual button
771
- $output .= '<a href="' . $button_url . '" title="' . $button_title . '" aria-label="' . $button_title . '" role="button" rel="noopener noreferrer nofollow" class="shariff-link" ';
 
 
772
  // same window?
773
  if ( ! isset( $same_window ) || isset( $same_window ) && $same_window != '1' ) $output .= 'target="_blank" ';
774
  $output .= 'style="background-color:' . $main_color . $border_radius;
3
  * Plugin Name: Shariff Wrapper
4
  * Plugin URI: https://de.wordpress.org/plugins/shariff/
5
  * Description: The Shariff Wrapper provides share buttons that respect the privacy of your visitors and are compliant to the German data protection laws.
6
+ * Version: 4.2.1
7
  * Author: Jan-Peter Lambeck & 3UU
8
  * Author URI: https://de.wordpress.org/plugins/shariff/
9
  * License: MIT
26
  // update function to perform tasks _once_ after an update, based on version number to work for automatic as well as manual updates
27
  function shariff3UU_update() {
28
  /******************** ADJUST VERSION ********************/
29
+ $code_version = "4.2.1"; // set code version - needs to be adjusted for every new version!
30
  /******************** ADJUST VERSION ********************/
31
 
32
  // get options
484
  }
485
  add_filter( 'the_content', 'shariff3UU_hideshariff', 999 );
486
 
487
+ // remove shariff from rss feeds
488
+ function shariff3UU_removefromrss( $content ) {
489
+ $content = preg_replace( '/<div class="shariff\b[^>]*>(.*?)<\/div>/i', '', $content );
490
+ $content = preg_replace( '/<div class="ShariffSC\b[^>]*>(.*?)<\/div>/i', '', $content );
491
+ return $content;
492
+ }
493
+ add_filter( 'the_content_feed', 'shariff3UU_removefromrss', 999 );
494
+
495
  // add mailform to bbpress_replies
496
  function bbp_add_mailform_to_bbpress_replies() {
497
  $content = '';
776
  $button_text_array = '';
777
 
778
  // build the actual button
779
+ $output .= '<a href="' . $button_url . '" title="' . $button_title . '" aria-label="' . $button_title . '" role="button" rel="';
780
+ if ( $mobile_only != '1' ) $output .= 'noopener noreferrer ';
781
+ $output .= 'nofollow" class="shariff-link" ';
782
  // same window?
783
  if ( ! isset( $same_window ) || isset( $same_window ) && $same_window != '1' ) $output .= 'target="_blank" ';
784
  $output .= 'style="background-color:' . $main_color . $border_radius;