Shariff Wrapper - Version 4.6.7

Version Description

  • updated to Facebook Graph API v11.0
  • changed FB request to og_object (thanks to richard67)
Download this release

Release Info

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

Code changes from version 4.6.6 to 4.6.7

Files changed (4) hide show
  1. changelog.txt +8 -0
  2. readme.txt +6 -2
  3. services/shariff-facebook.php +3 -9
  4. shariff.php +2 -2
changelog.txt CHANGED
@@ -2,6 +2,14 @@
2
 
3
  == Changelog ==
4
 
 
 
 
 
 
 
 
 
5
  = 4.6.4 =
6
  - fixed the settings link on the plugin overview page for certain environments (thanks to @midgard)
7
  - updated to Facebook Graph API v5.0
2
 
3
  == Changelog ==
4
 
5
+ = 4.6.7 =
6
+ - updated to Facebook Graph API v11.0
7
+ - changed FB request to og_object (thanks to richard67)
8
+
9
+ = 4.6.6 =
10
+ - Fix sanitize_callback parameter to avoid warnings with api requests
11
+ - tested for 5.7
12
+
13
  = 4.6.4 =
14
  - fixed the settings link on the plugin overview page for certain environments (thanks to @midgard)
15
  - updated to Facebook Graph API v5.0
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: starguide, 3UU
3
  Tags: Shariff, GDPR, DSGVO, share buttons, sharing
4
  Requires at least: 4.9
5
  Requires PHP: 7.2
6
- Tested up to: 5.7.3
7
- Stable tag: 4.6.6
8
  License: MIT
9
  License URI: http://opensource.org/licenses/mit
10
 
@@ -145,6 +145,10 @@ These are bugs or unexpected glitches that we know of, but that do not have an i
145
 
146
  == Changelog ==
147
 
 
 
 
 
148
  = 4.6.6 =
149
  - Fix sanitize_callback parameter to avoid warnings with api requests
150
  - tested for 5.7
3
  Tags: Shariff, GDPR, DSGVO, share buttons, sharing
4
  Requires at least: 4.9
5
  Requires PHP: 7.2
6
+ Tested up to: 6.1.0
7
+ Stable tag: 4.6.7
8
  License: MIT
9
  License URI: http://opensource.org/licenses/mit
10
 
145
 
146
  == Changelog ==
147
 
148
+ = 4.6.7 =
149
+ - updated to Facebook Graph API v11.0
150
+ - changed FB request to og_object (thanks to richard67)
151
+
152
  = 4.6.6 =
153
  - Fix sanitize_callback parameter to avoid warnings with api requests
154
  - tested for 5.7
services/shariff-facebook.php CHANGED
@@ -70,7 +70,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
70
  // Create the FB access token.
71
  $fb_token = $fb_app_id . '|' . $fb_app_secret;
72
  // Use the token to get the share counts.
73
- $facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/v6.0/?access_token=' . $fb_token . '&fields=engagement&id=' . $post_url ) ) );
74
  // Decode the json response.
75
  $facebook_json = json_decode( $facebook, true );
76
  // Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided.
@@ -81,14 +81,8 @@ if ( isset( $frontend ) && 1 === $frontend ) {
81
  * Stores results - uses engagement (Graph API > 2.12) if it exists, otherwise uses share_count - ordered based on proximity of occurrence.
82
  * Records errors, if enabled (e.g. request from the status tab).
83
  */
84
- if ( isset( $facebook_json['engagement'] ) && isset( $facebook_json['engagement']['share_count'] ) ) {
85
- $share_counts['facebook'] = intval( $facebook_json['engagement']['reaction_count'] ) + intval( $facebook_json['engagement']['comment_count'] ) + intval( $facebook_json['engagement']['share_count'] ) + intval( $facebook_json['engagement']['comment_plugin_count'] );
86
- } elseif ( isset( $facebook_json['share'] ) && isset( $facebook_json['share']['share_count'] ) ) {
87
- $share_counts['facebook'] = intval( $facebook_json['share']['share_count'] );
88
- } elseif ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['total_count'] ) ) {
89
- $share_counts['facebook'] = intval( $facebook_json['data'][0]['total_count'] );
90
- } elseif ( isset( $facebook_json['data'] ) && isset( $facebook_json['data'][0] ) && isset( $facebook_json['data'][0]['share_count'] ) ) {
91
- $share_counts['facebook'] = intval( $facebook_json['data'][0]['share_count'] );
92
  } elseif ( isset( $facebook_json['id'] ) && ! isset( $facebook_json['error'] ) && 1 === $nofbid ) {
93
  $share_counts['facebook'] = '0';
94
  } elseif ( isset( $record_errors ) && 1 === $record_errors ) {
70
  // Create the FB access token.
71
  $fb_token = $fb_app_id . '|' . $fb_app_secret;
72
  // Use the token to get the share counts.
73
+ $facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/v11.0/?access_token=' . $fb_token . '&fields=og_object%7Bengagement%7D&id=' . $post_url ) ) );
74
  // Decode the json response.
75
  $facebook_json = json_decode( $facebook, true );
76
  // Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided.
81
  * Stores results - uses engagement (Graph API > 2.12) if it exists, otherwise uses share_count - ordered based on proximity of occurrence.
82
  * Records errors, if enabled (e.g. request from the status tab).
83
  */
84
+ if ( isset( $facebook_json['og_object'] ) && isset( $facebook_json['og_object']['engagement'] ) && isset( $facebook_json['og_object']['engagement']['count'] ) ) {
85
+ $share_counts['facebook'] = intval( $facebook_json['og_object']['engagement']['count'] );
 
 
 
 
 
 
86
  } elseif ( isset( $facebook_json['id'] ) && ! isset( $facebook_json['error'] ) && 1 === $nofbid ) {
87
  $share_counts['facebook'] = '0';
88
  } elseif ( isset( $record_errors ) && 1 === $record_errors ) {
shariff.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Shariff Wrapper
4
  * Plugin URI: https://wordpress.org/plugins-wp/shariff/
5
  * Description: Shariff provides share buttons that respect the privacy of your visitors and follow the General Data Protection Regulation (GDPR).
6
- * Version: 4.6.6
7
  * Author: Jan-Peter Lambeck & 3UU
8
  * Author URI: https://wordpress.org/plugins/shariff/
9
  * License: MIT
@@ -33,7 +33,7 @@ $shariff3uu = array_merge( $shariff3uu_basic, $shariff3uu_design, $shariff3uu_ad
33
  */
34
  function shariff3uu_update() {
35
  // Adjust code version.
36
- $code_version = '4.6.6';
37
 
38
  // Get basic options.
39
  $shariff3uu_basic = (array) get_option( 'shariff3uu_basic' );
3
  * Plugin Name: Shariff Wrapper
4
  * Plugin URI: https://wordpress.org/plugins-wp/shariff/
5
  * Description: Shariff provides share buttons that respect the privacy of your visitors and follow the General Data Protection Regulation (GDPR).
6
+ * Version: 4.6.7
7
  * Author: Jan-Peter Lambeck & 3UU
8
  * Author URI: https://wordpress.org/plugins/shariff/
9
  * License: MIT
33
  */
34
  function shariff3uu_update() {
35
  // Adjust code version.
36
+ $code_version = '4.6.7';
37
 
38
  // Get basic options.
39
  $shariff3uu_basic = (array) get_option( 'shariff3uu_basic' );