Shariff Wrapper - Version 4.6.3

Version Description

  • updated the WhatsApp share link (thanks to @hanshansenxxx and @korbball)
  • updated to Facebook Graph API v3.3
  • updated the Flattr button to reflect the new Flattr (thanks to Chris, @camthor)
  • fixed an update issue with WP CLI
  • removed the Facebook share counts request without APP ID and Secret
  • Facebook now always requires an APP ID and Secret for share counts
  • removed Flattr counts due to Flattr removing the API
Download this release

Release Info

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

Code changes from version 4.6.2 to 4.6.3

admin/admin-menu.php CHANGED
@@ -12,7 +12,7 @@ if ( ! class_exists( 'WP' ) ) {
12
  }
13
 
14
  // Set services that have a share count API / backend.
15
- $shariff3uu_services_backend = array( 'facebook', 'twitter', 'pinterest', 'xing', 'reddit', 'tumblr', 'vk', 'addthis', 'flattr', 'odnoklassniki', 'buffer' );
16
 
17
  // Adds the actions for the admin page.
18
  add_action( 'admin_menu', 'shariff3uu_add_admin_menu' );
@@ -311,15 +311,6 @@ function shariff3uu_options_init() {
311
  'shariff3uu_advanced_section'
312
  );
313
 
314
- // Flattr username.
315
- add_settings_field(
316
- 'shariff3uu_text_flattruser',
317
- __( 'Flattr username:', 'shariff' ),
318
- 'shariff3uu_text_flattruser_render',
319
- 'shariff3uu_advanced',
320
- 'shariff3uu_advanced_section'
321
- );
322
-
323
  // Patreon username.
324
  add_settings_field(
325
  'shariff3uu_text_patreonid',
@@ -1323,18 +1314,6 @@ function shariff3uu_text_twittervia_render() {
1323
  echo '<input type="text" name="shariff3uu_advanced[twitter_via]" value="' . esc_html( $twitter_via ) . '" size="50" placeholder="' . esc_html__( 'username', 'shariff' ) . '">';
1324
  }
1325
 
1326
- /**
1327
- * Flattr username.
1328
- */
1329
- function shariff3uu_text_flattruser_render() {
1330
- if ( isset( $GLOBALS['shariff3uu_advanced']['flattruser'] ) ) {
1331
- $flattruser = $GLOBALS['shariff3uu_advanced']['flattruser'];
1332
- } else {
1333
- $flattruser = '';
1334
- }
1335
- echo '<input type="text" name="shariff3uu_advanced[flattruser]" value="' . esc_html( $flattruser ) . '" size="50" placeholder="' . esc_html__( 'username', 'shariff' ) . '">';
1336
- }
1337
-
1338
  /**
1339
  * Patreon username.
1340
  */
@@ -1849,14 +1828,6 @@ function shariff3uu_help_section_callback() {
1849
  echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff twitter_via="your_twittername"]</div>';
1850
  echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the Twitter via tag.', 'shariff' ) . '</div>';
1851
  echo '</div>';
1852
- // Flattruser.
1853
- echo '<div style="display:table-row">';
1854
- echo '<div style="display:table-cell;border:1px solid;padding:10px">flattruser</div>';
1855
- echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
1856
- echo '<div style="display:table-cell;border:1px solid;padding:10px"></div>';
1857
- echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff flattruser="your_username"]</div>';
1858
- echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the Flattr username.', 'shariff' ) . '</div>';
1859
- echo '</div>';
1860
  // Patreonid.
1861
  echo '<div style="display:table-row">';
1862
  echo '<div style="display:table-cell;border:1px solid;padding:10px">patreonid</div>';
@@ -2022,6 +1993,8 @@ function shariff3uu_status_section_callback() {
2022
  echo '<div class="shariff_status-table">';
2023
  if ( isset( $shariff3uu['disable'][ $service ] ) && 1 === $shariff3uu['disable'][ $service ] ) {
2024
  echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold">' . esc_html__( 'Disabled', 'shariff' ) . '</div></div>';
 
 
2025
  } elseif ( ! array_key_exists( $service, $service_errors ) ) {
2026
  echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:green">' . esc_html__( 'OK', 'shariff' ) . '</div></div>';
2027
  echo '<div style="display:table-row"><div style="display:table-cell">' . esc_html__( 'Share Count:', 'shariff' ) . ' ' . absint( $share_counts[ $service ] ) . '</div></div>';
12
  }
13
 
14
  // Set services that have a share count API / backend.
15
+ $shariff3uu_services_backend = array( 'facebook', 'twitter', 'pinterest', 'xing', 'reddit', 'tumblr', 'vk', 'addthis', 'odnoklassniki', 'buffer' );
16
 
17
  // Adds the actions for the admin page.
18
  add_action( 'admin_menu', 'shariff3uu_add_admin_menu' );
311
  'shariff3uu_advanced_section'
312
  );
313
 
 
 
 
 
 
 
 
 
 
314
  // Patreon username.
315
  add_settings_field(
316
  'shariff3uu_text_patreonid',
1314
  echo '<input type="text" name="shariff3uu_advanced[twitter_via]" value="' . esc_html( $twitter_via ) . '" size="50" placeholder="' . esc_html__( 'username', 'shariff' ) . '">';
1315
  }
1316
 
 
 
 
 
 
 
 
 
 
 
 
 
1317
  /**
1318
  * Patreon username.
1319
  */
1828
  echo '<div style="display:table-cell;border:1px solid;padding:10px">[shariff twitter_via="your_twittername"]</div>';
1829
  echo '<div style="display:table-cell;border:1px solid;padding:10px">' . esc_html__( 'Sets the Twitter via tag.', 'shariff' ) . '</div>';
1830
  echo '</div>';
 
 
 
 
 
 
 
 
1831
  // Patreonid.
1832
  echo '<div style="display:table-row">';
1833
  echo '<div style="display:table-cell;border:1px solid;padding:10px">patreonid</div>';
1993
  echo '<div class="shariff_status-table">';
1994
  if ( isset( $shariff3uu['disable'][ $service ] ) && 1 === $shariff3uu['disable'][ $service ] ) {
1995
  echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold">' . esc_html__( 'Disabled', 'shariff' ) . '</div></div>';
1996
+ } elseif ( 'facebook' === $service && ( ! isset( $shariff3uu['fb_id'] ) || ! isset( $shariff3uu['fb_secret'] ) ) ) {
1997
+ echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:#ff0000">' . esc_html__( 'Facebook shut down the possibility to request share counts without an APP ID and Secret. Therefore, you need to create a Facebook APP ID and Secret and enter it in the settings on the Statistic tab. Google will provide you with many tutorials. Simple search for “facebook app id secret” and you will find one in your language.', 'shariff' ) . '</div></div>';
1998
  } elseif ( ! array_key_exists( $service, $service_errors ) ) {
1999
  echo '<div style="display:table-row"><div style="display:table-cell;font-weight:bold;color:green">' . esc_html__( 'OK', 'shariff' ) . '</div></div>';
2000
  echo '<div style="display:table-row"><div style="display:table-cell">' . esc_html__( 'Share Count:', 'shariff' ) . ' ' . absint( $share_counts[ $service ] ) . '</div></div>';
admin/admin-notices.php CHANGED
@@ -19,10 +19,6 @@ function shariff3uu_service_notice() {
19
  $services = array();
20
  // Check if any services are set and if user can manage options.
21
  if ( isset( $GLOBALS['shariff3uu']['services'] ) && current_user_can( 'manage_options' ) ) {
22
- // Flattr.
23
- if ( strpos( $GLOBALS['shariff3uu']['services'], 'flattr' ) !== false && empty( $GLOBALS['shariff3uu']['flattruser'] ) ) {
24
- $services[] = 'Flattr';
25
- }
26
  // Patreon.
27
  if ( strpos( $GLOBALS['shariff3uu']['services'], 'patreon' ) !== false && empty( $GLOBALS['shariff3uu']['patreonid'] ) ) {
28
  $services[] = 'Patreon';
19
  $services = array();
20
  // Check if any services are set and if user can manage options.
21
  if ( isset( $GLOBALS['shariff3uu']['services'] ) && current_user_can( 'manage_options' ) ) {
 
 
 
 
22
  // Patreon.
23
  if ( strpos( $GLOBALS['shariff3uu']['services'], 'patreon' ) !== false && empty( $GLOBALS['shariff3uu']['patreonid'] ) ) {
24
  $services[] = 'Patreon';
changelog.txt CHANGED
@@ -2,6 +2,15 @@
2
 
3
  == Changelog ==
4
 
 
 
 
 
 
 
 
 
 
5
  = 4.6.2 =
6
  - new service MeWe
7
  - new service Buffer
2
 
3
  == Changelog ==
4
 
5
+ = 4.6.3 =
6
+ - updated the WhatsApp share link to work with all devices again (thanks to @hanshansenxxx)
7
+ - updated to Facebook Graph API v3.3
8
+ - updated the Flattr button to reflect the new Flattr (thanks to Chris, @camthor)
9
+ - fixed an update issue with WP CLI
10
+ - removed the Facebook share counts request without APP ID and Secret
11
+ - Facebook now always requires an APP ID and Secret for share counts
12
+ - removed Flattr counts due to Flattr removing the API
13
+
14
  = 4.6.2 =
15
  - new service MeWe
16
  - new service Buffer
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.0
6
- Tested up to: 5.1
7
- Stable tag: 4.6.2
8
  License: MIT
9
  License URI: http://opensource.org/licenses/mit
10
 
@@ -152,6 +152,15 @@ These are bugs or unexpected glitches that we know of, but that do not have an i
152
 
153
  == Changelog ==
154
 
 
 
 
 
 
 
 
 
 
155
  = 4.6.2 =
156
  - new service MeWe
157
  - new service Buffer
3
  Tags: Shariff, GDPR, DSGVO, share buttons, sharing
4
  Requires at least: 4.9
5
  Requires PHP: 7.0
6
+ Tested up to: 5.2
7
+ Stable tag: 4.6.3
8
  License: MIT
9
  License URI: http://opensource.org/licenses/mit
10
 
152
 
153
  == Changelog ==
154
 
155
+ = 4.6.3 =
156
+ - updated the WhatsApp share link (thanks to @hanshansenxxx and @korbball)
157
+ - updated to Facebook Graph API v3.3
158
+ - updated the Flattr button to reflect the new Flattr (thanks to Chris, @camthor)
159
+ - fixed an update issue with WP CLI
160
+ - removed the Facebook share counts request without APP ID and Secret
161
+ - Facebook now always requires an APP ID and Secret for share counts
162
+ - removed Flattr counts due to Flattr removing the API
163
+
164
  = 4.6.2 =
165
  - new service MeWe
166
  - new service Buffer
services/shariff-buffer.php CHANGED
@@ -24,7 +24,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
24
  $wcag_color = '#0C5B97';
25
 
26
  // SVG icon.
27
- $svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><path fill="' . $main_color . '" d="M91-37.4V-52l1.8 1 24 11.2c1.7.8 3.3.7 4.9 0l24-11.2 1-.4c.9-.6 1-1.3 0-1.8l-3.5-1.7a6.2 6.2 0 0 0-6.2 0l-15.1 7.1c-1.7.8-3.4.9-5.1 0-4.7-2.3-9.5-4.3-14.2-6.7-2.7-1.4-5.3-1.7-8-.1-1.1.7-2.3 1.2-3.5 1.7v-14.3l25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.8c0 1.1.5 1.4 1.5 1.4h4.2c1.4-.1 1.7.5 1.7 1.8v15z"/><path fill="' . $main_color . '" d="M.3 14.1L29.3.5c1.7-.7 3.2-.6 4.9.1C43.3 5 52.5 9.1 61.5 13.5c.7.3 1.4.5 1.4 1.3 0 1-.9 1.1-1.5 1.4-8.7 4.2-17.5 8.2-26.2 12.3a7.8 7.8 0 0 1-7 0L.3 15.5v-1.4zM.3 48.8l5.1-2.6c2.2-1 4.2-.9 6.3.1l16.8 8c2.1 1 4.1 1 6.2 0l17.1-8c2.1-1 4.1-1 6.2 0l3.8 1.7c.6.3 1.4.6 1.3 1.3 0 .7-.7 1-1.3 1.3l-12.7 6-14.4 6.7c-1.8.9-3.7 1-5.6 0L2 50.9c-.6-.2-1-.7-1.6-1-.2-.2-.2-.6-.2-1z"/><path fill="' . $main_color . '" d="M.3 31.5l4-1.9c3-1.8 5.7-1.4 8.8.1 5.3 2.7 10.6 5 15.9 7.5 2 .9 3.7.9 5.6 0 5.6-2.7 11.3-5.2 16.9-8a7.2 7.2 0 0 1 6.9 0c1.2.8 2.6 1.3 3.9 2 1 .6 1 1.3 0 2l-1 .4-26.9 12.5c-1.8.9-3.6.9-5.3 0L2.2 33.6c-.7-.3-1.2-.8-1.9-1v-1z"/></svg>';
28
 
29
  // Backend available?
30
  $backend_available = 1;
24
  $wcag_color = '#0C5B97';
25
 
26
  // SVG icon.
27
+ $svg_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="' . $main_color . '" d="M91-37.4V-52l1.8 1 24 11.2c1.7.8 3.3.7 4.9 0l24-11.2 1-.4c.9-.6 1-1.3 0-1.8l-3.5-1.7a6.2 6.2 0 0 0-6.2 0l-15.1 7.1c-1.7.8-3.4.9-5.1 0-4.7-2.3-9.5-4.3-14.2-6.7-2.7-1.4-5.3-1.7-8-.1-1.1.7-2.3 1.2-3.5 1.7v-14.3l25 11.6c2.2 1.1 4.2 1 6.3 0l23.5-11c.6-.3 1.5-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.7 1.8v15zM.3 14.1L29.3.5a6 6 0 0 1 4.9.1C43.3 5 52.5 9.1 61.5 13.5c.7.3 1.4.5 1.4 1.3 0 1-.9 1.1-1.5 1.4-8.7 4.2-17.5 8.2-26.2 12.3a7.8 7.8 0 0 1-7 0L.3 15.5v-1.4zm0 34.7l5.1-2.6a7 7 0 0 1 6.3.1l16.8 8c2.1 1 4.1 1 6.2 0l17.1-8c2.1-1 4.1-1 6.2 0l3.8 1.7c.6.3 1.4.6 1.3 1.3 0 .7-.7 1-1.3 1.3l-12.7 6-14.4 6.7c-1.8.9-3.7 1-5.6 0L2 50.9c-.6-.2-1-.7-1.6-1-.2-.2-.2-.6-.2-1z"/><path fill="' . $main_color . '" d="M.3 31.5l4-1.9c3-1.8 5.7-1.4 8.8.1 5.3 2.7 10.6 5 15.9 7.5 2 .9 3.7.9 5.6 0 5.6-2.7 11.3-5.2 16.9-8a7.2 7.2 0 0 1 6.9 0c1.2.8 2.6 1.3 3.9 2 1 .6 1 1.3 0 2l-1 .4-26.9 12.5c-1.8.9-3.6.9-5.3 0L2.2 33.6c-.7-.3-1.2-.8-1.9-1v-1z"/></svg>';
28
 
29
  // Backend available?
30
  $backend_available = 1;
services/shariff-facebook.php CHANGED
@@ -58,7 +58,7 @@ if ( isset( $frontend ) && 1 === $frontend ) {
58
  'zh' => '在Facebook上分享',
59
  );
60
  } elseif ( isset( $backend ) && 1 === $backend ) {
61
- // Use the FB ID and Secret, if available, else use the normal way.
62
  if ( isset( $shariff3uu['fb_id'] ) && isset( $shariff3uu['fb_secret'] ) ) {
63
  // On 32-bit PHP installations the constant is 4 and we have to disable the check because the id is too long.
64
  if ( ( defined( PHP_INT_SIZE ) && PHP_INT_SIZE === '4' ) || ! defined( PHP_INT_SIZE ) ) {
@@ -70,17 +70,11 @@ 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/v3.2/?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.
77
  $nofbid = '0';
78
- } else {
79
- $facebook = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/?id=' . $post_url ) ) );
80
- // Decode the json response.
81
- $facebook_json = json_decode( $facebook, true );
82
- // Set nofbid in case the page has not yet been crawled by Facebook and no ID is provided.
83
- $nofbid = 1;
84
  }
85
 
86
  /**
58
  'zh' => '在Facebook上分享',
59
  );
60
  } elseif ( isset( $backend ) && 1 === $backend ) {
61
+ // Use the FB ID and Secret, if available.
62
  if ( isset( $shariff3uu['fb_id'] ) && isset( $shariff3uu['fb_secret'] ) ) {
63
  // On 32-bit PHP installations the constant is 4 and we have to disable the check because the id is too long.
64
  if ( ( defined( PHP_INT_SIZE ) && PHP_INT_SIZE === '4' ) || ! defined( PHP_INT_SIZE ) ) {
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/v3.3/?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.
77
  $nofbid = '0';
 
 
 
 
 
 
78
  }
79
 
80
  /**
services/shariff-flattr.php CHANGED
@@ -13,24 +13,13 @@ if ( ! class_exists( 'WP' ) ) {
13
  // Check if we need the frontend or the backend part.
14
  if ( isset( $frontend ) && 1 === $frontend ) {
15
  // Service URL.
16
- $service_url = esc_url( 'https://flattr.com/submit/auto' );
17
 
18
- // Lang tag.
19
- if ( isset( $atts['lang'] ) ) {
20
- $lang = $atts['lang'] . '_' . strtoupper( $atts['lang'] );
21
- } else {
22
- $lang = 'en_US';
23
- }
24
-
25
- // Flattr user.
26
- if ( array_key_exists( 'flattruser', $atts ) ) {
27
- $flattruser = esc_html( $atts['flattruser'] );
28
- } else {
29
- $flattruser = '';
30
- }
31
 
32
  // Build button URL.
33
- $button_url = $service_url . '?url=' . $share_url . '&title=' . $share_title . '&language=' . $lang . '&fid=' . $flattruser;
34
 
35
  // Colors.
36
  $main_color = '#7ea352';
@@ -56,17 +45,4 @@ if ( isset( $frontend ) && 1 === $frontend ) {
56
  'fr' => 'Flattré!',
57
  'es' => 'Flattr!',
58
  );
59
- } elseif ( isset( $backend ) && 1 === $backend ) {
60
- // Fetch counts.
61
- $flattr = sanitize_text_field( wp_remote_retrieve_body( wp_remote_get( 'https://api.flattr.com/rest/v2/things/lookup/?url=' . $post_url ) ) );
62
- $flattr_json = json_decode( $flattr, true );
63
-
64
- // Store results, if we have some. If no thing was found, set it to 0. Record errors, if enabled (e.g. request from the status tab).
65
- if ( isset( $flattr_json['flattrs'] ) ) {
66
- $share_counts['flattr'] = intval( $flattr_json['flattrs'] );
67
- } elseif ( isset( $flattr_json['description'] ) && 'No thing was found' === $flattr_json['description'] ) {
68
- $share_counts['flattr'] = 0;
69
- } elseif ( isset( $record_errors ) && 1 === $record_errors ) {
70
- $service_errors['flattr'] = $flattr;
71
- }
72
  }
13
  // Check if we need the frontend or the backend part.
14
  if ( isset( $frontend ) && 1 === $frontend ) {
15
  // Service URL.
16
+ $service_url = esc_url( 'https://flattr.com/domain/' );
17
 
18
+ // Get WP URL.
19
+ $wp_url = wp_parse_url( get_bloginfo( 'url' ) );
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  // Build button URL.
22
+ $button_url = $service_url . preg_replace('#^www\.(.+\.)#i', '$1', $wp_url['host'] );
23
 
24
  // Colors.
25
  $main_color = '#7ea352';
45
  'fr' => 'Flattré!',
46
  'es' => 'Flattr!',
47
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
services/shariff-mix.php CHANGED
@@ -53,4 +53,4 @@ if ( isset( $frontend ) && 1 === $frontend ) {
53
  'sr' => 'Podeli na Mix',
54
  'sv' => 'Dela på Mix',
55
  );
56
- }
53
  'sr' => 'Podeli na Mix',
54
  'sv' => 'Dela på Mix',
55
  );
56
+ }
services/shariff-whatsapp.php CHANGED
@@ -13,7 +13,7 @@ if ( ! class_exists( 'WP' ) ) {
13
  // Check if we need the frontend or the backend part.
14
  if ( isset( $frontend ) && 1 === $frontend ) {
15
  // Service URL.
16
- $service_url = 'https://wa.me/';
17
 
18
  // Build button URL.
19
  $button_url = $service_url . '?text=' . $share_title . '%20' . $share_url;
13
  // Check if we need the frontend or the backend part.
14
  if ( isset( $frontend ) && 1 === $frontend ) {
15
  // Service URL.
16
+ $service_url = 'https://api.whatsapp.com/send';
17
 
18
  // Build button URL.
19
  $button_url = $service_url . '?text=' . $share_title . '%20' . $share_url;
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.2
7
  * Author: Jan-Peter Lambeck & 3UU
8
  * Author URI: https://wordpress.org/plugins/shariff/
9
  * License: MIT
@@ -33,18 +33,25 @@ $shariff3uu = array_merge( $shariff3uu_basic, $shariff3uu_design, $shariff3uu_ad
33
  */
34
  function shariff3uu_update() {
35
  // Adjust code version.
36
- $code_version = '4.6.2';
37
 
38
- // Get options.
39
- $shariff3uu = $GLOBALS['shariff3uu'];
40
 
41
  // Check if the installed version is older than the code version and include updates.php if necessary.
42
- if ( empty( $shariff3uu['version'] ) || ( isset( $shariff3uu['version'] ) && version_compare( $shariff3uu['version'], $code_version ) === -1 ) ) {
 
 
 
 
 
43
  // Include updates.php.
44
  include dirname( __FILE__ ) . '/updates.php';
45
  }
46
  }
47
  add_action( 'admin_init', 'shariff3uu_update' );
 
 
48
 
49
  /**
50
  * Add privacy policy suggestions to WordPress privacy generator introduced in WordPress 4.9.6.
@@ -1193,9 +1200,7 @@ function shariff3uu_render( $atts ) {
1193
  // Loops through all desired services.
1194
  foreach ( $service_array as $service ) {
1195
  // Check if necessary usernames are set and display warning to admins, if needed.
1196
- if ( 'flattr' === $service && ! array_key_exists( 'flattruser', $atts ) ) {
1197
- $flattr_error = 1;
1198
- } elseif ( 'paypal' === $service && ! array_key_exists( 'paypalbuttonid', $atts ) ) {
1199
  $paypal_error = 1;
1200
  } elseif ( 'paypalme' === $service && ! array_key_exists( 'paypalmeid', $atts ) ) {
1201
  $paypalme_error = 1;
@@ -1518,10 +1523,6 @@ function shariff3uu_render( $atts ) {
1518
  update_option( 'shariff3uu_design', $shariff3uu_design );
1519
  }
1520
 
1521
- // Displays a warning to admins if flattr is set, but no flattr username was provided.
1522
- if ( 1 === $flattr_error && current_user_can( 'manage_options' ) ) {
1523
- $output .= '<div class="shariff-warning">' . __( 'Username for Flattr is missing!', 'shariff' ) . '</div>';
1524
- }
1525
  // Displays a warning to admins if patreon is set, but no patreon username was provided.
1526
  if ( 1 === $patreon_error && current_user_can( 'manage_options' ) ) {
1527
  $output .= '<div class="shariff-warning">' . __( 'Username for patreon is missing!', 'shariff' ) . '</div>';
@@ -1572,7 +1573,6 @@ function shariff3uu_meta( $atts ) {
1572
  * Clears transients and removes cron job upon deactivation.
1573
  */
1574
  function shariff3uu_deactivate() {
1575
- global $wpdb;
1576
  // Checks for multisite.
1577
  if ( is_multisite() && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
1578
  $sites = get_sites();
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.3
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.3';
37
 
38
+ // Get basic options.
39
+ $shariff3uu_basic = (array) get_option( 'shariff3uu_basic' );
40
 
41
  // Check if the installed version is older than the code version and include updates.php if necessary.
42
+ if ( empty( $shariff3uu_basic['version'] ) || ( isset( $shariff3uu_basic['version'] ) && version_compare( $shariff3uu_basic['version'], $code_version ) === -1 ) ) {
43
+ // Get the other options.
44
+ $shariff3uu_design = (array) get_option( 'shariff3uu_design' );
45
+ $shariff3uu_advanced = (array) get_option( 'shariff3uu_advanced' );
46
+ $shariff3uu_statistic = (array) get_option( 'shariff3uu_statistic' );
47
+ $shariff3uu = array_merge( $shariff3uu_basic, $shariff3uu_design, $shariff3uu_advanced, $shariff3uu_statistic );
48
  // Include updates.php.
49
  include dirname( __FILE__ ) . '/updates.php';
50
  }
51
  }
52
  add_action( 'admin_init', 'shariff3uu_update' );
53
+ // In case WP-CLI is used and the backend is never visited, we add it to cli_init as well.
54
+ add_action( 'cli_init', 'shariff3uu_update' );
55
 
56
  /**
57
  * Add privacy policy suggestions to WordPress privacy generator introduced in WordPress 4.9.6.
1200
  // Loops through all desired services.
1201
  foreach ( $service_array as $service ) {
1202
  // Check if necessary usernames are set and display warning to admins, if needed.
1203
+ if ( 'paypal' === $service && ! array_key_exists( 'paypalbuttonid', $atts ) ) {
 
 
1204
  $paypal_error = 1;
1205
  } elseif ( 'paypalme' === $service && ! array_key_exists( 'paypalmeid', $atts ) ) {
1206
  $paypalme_error = 1;
1523
  update_option( 'shariff3uu_design', $shariff3uu_design );
1524
  }
1525
 
 
 
 
 
1526
  // Displays a warning to admins if patreon is set, but no patreon username was provided.
1527
  if ( 1 === $patreon_error && current_user_can( 'manage_options' ) ) {
1528
  $output .= '<div class="shariff-warning">' . __( 'Username for patreon is missing!', 'shariff' ) . '</div>';
1573
  * Clears transients and removes cron job upon deactivation.
1574
  */
1575
  function shariff3uu_deactivate() {
 
1576
  // Checks for multisite.
1577
  if ( is_multisite() && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
1578
  $sites = get_sites();
updates.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /**
3
- * Will be included by shariff3UU_update() only if needed.
4
  * Put all update task here. Make sure that all "older" updates are checked first.
5
- * At least you must set $GLOBALS["shariff3UU"]["version"] = [YOUR VERSION]; to avoid includes later on.
6
  *
7
  * @package WordPress
8
  */
@@ -17,98 +17,98 @@ if ( ! class_exists( 'WP' ) ) {
17
  * Split options in database according to new setting tabs.
18
  * Delete old cache directory.
19
  */
20
- if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '2.2.5' ) ) {
21
 
22
  // Basic options.
23
- if ( isset( $GLOBALS['shariff3UU']['version'] ) ) {
24
- $GLOBALS['shariff3UU_basic']['version'] = $GLOBALS['shariff3UU']['version'];
25
  }
26
- if ( isset( $GLOBALS['shariff3UU']['services'] ) ) {
27
- $GLOBALS['shariff3UU_basic']['services'] = $GLOBALS['shariff3UU']['services'];
28
  }
29
- if ( isset( $GLOBALS['shariff3UU']['add_after_all_posts'] ) ) {
30
- $GLOBALS['shariff3UU_basic']['add_after']['posts'] = $GLOBALS['shariff3UU']['add_after_all_posts'];
31
  }
32
- if ( isset( $GLOBALS['shariff3UU']['add_after_all_overview'] ) ) {
33
- $GLOBALS['shariff3UU_basic']['add_after']['posts_blogpage'] = $GLOBALS['shariff3UU']['add_after_all_overview'];
34
  }
35
- if ( isset( $GLOBALS['shariff3UU']['add_after_all_pages'] ) ) {
36
- $GLOBALS['shariff3UU_basic']['add_after']['pages'] = $GLOBALS['shariff3UU']['add_after_all_pages'];
37
  }
38
- if ( isset( $GLOBALS['shariff3UU']['add_after_all_custom_type'] ) ) {
39
- $GLOBALS['shariff3UU_basic']['add_after']['custom_type'] = $GLOBALS['shariff3UU']['add_after_all_custom_type'];
40
  }
41
- if ( isset( $GLOBALS['shariff3UU']['add_before_all_posts'] ) ) {
42
- $GLOBALS['shariff3UU_basic']['add_before']['posts'] = $GLOBALS['shariff3UU']['add_before_all_posts'];
43
  }
44
- if ( isset( $GLOBALS['shariff3UU']['add_before_all_overview'] ) ) {
45
- $GLOBALS['shariff3UU_basic']['add_before']['posts_blogpage'] = $GLOBALS['shariff3UU']['add_before_all_overview'];
46
  }
47
- if ( isset( $GLOBALS['shariff3UU']['add_before_all_pages'] ) ) {
48
- $GLOBALS['shariff3UU_basic']['add_before']['pages'] = $GLOBALS['shariff3UU']['add_before_all_pages'];
49
  }
50
- if ( isset( $GLOBALS['shariff3UU']['disable_on_protected'] ) ) {
51
- $GLOBALS['shariff3UU_basic']['disable_on_protected'] = $GLOBALS['shariff3UU']['disable_on_protected'];
52
  }
53
- if ( isset( $GLOBALS['shariff3UU']['backend'] ) ) {
54
- $GLOBALS['shariff3UU_basic']['backend'] = $GLOBALS['shariff3UU']['backend'];
55
  }
56
 
57
  // Design options.
58
- if ( isset( $GLOBALS['shariff3UU']['language'] ) ) {
59
- $GLOBALS['shariff3UU_design']['language'] = $GLOBALS['shariff3UU']['language'];
60
  }
61
- if ( isset( $GLOBALS['shariff3UU']['theme'] ) ) {
62
- $GLOBALS['shariff3UU_design']['theme'] = $GLOBALS['shariff3UU']['theme'];
63
  }
64
- if ( isset( $GLOBALS['shariff3UU']['buttonsize'] ) ) {
65
- $GLOBALS['shariff3UU_design']['buttonsize'] = $GLOBALS['shariff3UU']['buttonsize'];
66
  }
67
- if ( isset( $GLOBALS['shariff3UU']['vertical'] ) ) {
68
- $GLOBALS['shariff3UU_design']['vertical'] = $GLOBALS['shariff3UU']['vertical'];
69
  }
70
- if ( isset( $GLOBALS['shariff3UU']['align'] ) ) {
71
- $GLOBALS['shariff3UU_design']['align'] = $GLOBALS['shariff3UU']['align'];
72
  }
73
- if ( isset( $GLOBALS['shariff3UU']['align_widget'] ) ) {
74
- $GLOBALS['shariff3UU_design']['align_widget'] = $GLOBALS['shariff3UU']['align_widget'];
75
  }
76
- if ( isset( $GLOBALS['shariff3UU']['style'] ) ) {
77
- $GLOBALS['shariff3UU_design']['style'] = $GLOBALS['shariff3UU']['style'];
78
  }
79
 
80
  // Advanced options.
81
- if ( isset( $GLOBALS['shariff3UU']['info_url'] ) ) {
82
- $GLOBALS['shariff3UU_advanced']['info_url'] = $GLOBALS['shariff3UU']['info_url'];
83
  }
84
- if ( isset( $GLOBALS['shariff3UU']['twitter_via'] ) ) {
85
- $GLOBALS['shariff3UU_advanced']['twitter_via'] = $GLOBALS['shariff3UU']['twitter_via'];
86
  }
87
- if ( isset( $GLOBALS['shariff3UU']['flattruser'] ) ) {
88
- $GLOBALS['shariff3UU_advanced']['flattruser'] = $GLOBALS['shariff3UU']['flattruser'];
89
  }
90
- if ( isset( $GLOBALS['shariff3UU']['default_pinterest'] ) ) {
91
- $GLOBALS['shariff3UU_advanced']['default_pinterest'] = $GLOBALS['shariff3UU']['default_pinterest'];
92
  }
93
 
94
  // Mailform options.
95
- if ( isset( $GLOBALS['shariff3UU']['mail_add_post_content'] ) ) {
96
- $GLOBALS['shariff3UU_mailform']['mail_add_post_content'] = $GLOBALS['shariff3UU']['mail_add_post_content'];
97
  }
98
- if ( isset( $GLOBALS['shariff3UU']['mail_sender_name'] ) ) {
99
- $GLOBALS['shariff3UU_mailform']['mail_sender_name'] = $GLOBALS['shariff3UU']['mail_sender_name'];
100
  }
101
- if ( isset( $GLOBALS['shariff3UU']['mail_sender_from'] ) ) {
102
- $GLOBALS['shariff3UU_mailform']['mail_sender_from'] = $GLOBALS['shariff3UU']['mail_sender_from'];
103
  }
104
  // Default options should be as save as possible, same reason the statistics are disabled by default.
105
  $GLOBALS['shariff3UU_mailform']['require_sender'] = 1;
106
 
107
  // Update global.
108
- $GLOBALS['shariff3UU'] = array_merge( $GLOBALS['shariff3UU_basic'], $GLOBALS['shariff3UU_design'], $GLOBALS['shariff3UU_advanced'], $GLOBALS['shariff3UU_mailform'] );
109
 
110
  // Update version.
111
- $GLOBALS['shariff3UU']['version'] = '2.3.0';
112
  }
113
 
114
  /**
@@ -116,23 +116,23 @@ if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOB
116
  * Update options that were moved.
117
  * Delete old cache directory and db entry.
118
  */
119
- if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '3.3.0' ) ) {
120
 
121
  // Update options that were moved.
122
- if ( isset( $GLOBALS['shariff3UU']['backend'] ) ) {
123
- $GLOBALS['shariff3UU_statistic']['backend'] = $GLOBALS['shariff3UU']['backend'];
124
  }
125
- if ( isset( $GLOBALS['shariff3UU']['fb_id'] ) ) {
126
- $GLOBALS['shariff3UU_statistic']['fb_id'] = $GLOBALS['shariff3UU']['fb_id'];
127
  }
128
- if ( isset( $GLOBALS['shariff3UU']['fb_secret'] ) ) {
129
- $GLOBALS['shariff3UU_statistic']['fb_secret'] = $GLOBALS['shariff3UU']['fb_secret'];
130
  }
131
- if ( isset( $GLOBALS['shariff3UU']['ttl'] ) ) {
132
- $GLOBALS['shariff3UU_statistic']['ttl'] = $GLOBALS['shariff3UU']['ttl'];
133
  }
134
- if ( isset( $GLOBALS['shariff3UU']['disable'] ) ) {
135
- $GLOBALS['shariff3UU_statistic']['disable'] = $GLOBALS['shariff3UU']['disable'];
136
  }
137
 
138
  // Delete old cache directory and db entry.
@@ -160,10 +160,10 @@ if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOB
160
  }
161
 
162
  // Disable Twitter backend due to new service OpenShareCount.com.
163
- $GLOBALS['shariff3UU_statistic']['disable']['twitter'] = 1;
164
 
165
  // Update version.
166
- $GLOBALS['shariff3UU']['version'] = '3.3.0';
167
  }
168
 
169
  /**
@@ -198,31 +198,31 @@ function shariff_removeoldfiles( $directory ) {
198
  /**
199
  * Migration < 4.0
200
  */
201
- if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.0.0' ) ) {
202
 
203
  // Set new option share counts, if statistic is enabled.
204
- if ( isset( $GLOBALS['shariff3UU_statistic']['backend'] ) ) {
205
- $GLOBALS['shariff3UU_statistic']['sharecounts'] = 1;
206
  }
207
 
208
  // Disable share counts if WP version < 4.4.
209
  if ( version_compare( get_bloginfo( 'version' ), '4.4.0' ) < 1 ) {
210
- unset( $GLOBALS['shariff3UU_statistic']['backend'] );
211
  }
212
 
213
  // Change button language to WordPress language, if it is set to auto and http_negotiate_language is not available (auto will not work without it).
214
- if ( ! isset( $GLOBALS['shariff3UU_design']['lang'] ) && ! function_exists( 'http_negotiate_language' ) ) {
215
- $GLOBALS['shariff3UU_design']['lang'] = substr( get_bloginfo( 'language' ), 0, 2 );
216
  }
217
 
218
  // Update version.
219
- $GLOBALS['shariff3UU']['version'] = '4.0.0';
220
  }
221
 
222
  /**
223
  * Migration < 4.2
224
  */
225
- if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.2.0' ) ) {
226
  // Make sure we have the $wpdb class ready.
227
  global $wpdb;
228
 
@@ -259,14 +259,14 @@ if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOB
259
  /**
260
  * Migration < 4.5
261
  */
262
- if ( isset( $GLOBALS['shariff3UU']['version'] ) && -1 === version_compare( $GLOBALS['shariff3UU']['version'], '4.5.0' ) ) {
263
  // Update language settings.
264
- if ( ! isset( $GLOBALS['shariff3UU_design']['lang'] ) ) {
265
- $GLOBALS['shariff3UU_design']['autolang'] = 1;
266
- $GLOBALS['shariff3UU_design']['lang'] = substr( get_locale(), 0, 2 );
267
  }
268
  // Update version.
269
- $GLOBALS['shariff3UU']['version'] = '4.5.0';
270
  }
271
 
272
  /**
@@ -311,27 +311,27 @@ function shariff3uu_purge_transients() {
311
  }
312
 
313
  // Set new version.
314
- $GLOBALS['shariff3uu']['version'] = $code_version;
315
- $GLOBALS['shariff3uu_basic']['version'] = $code_version;
316
 
317
  /**
318
- * Remove empty elements and save to options table.
319
  */
320
  // Basic.
321
  delete_option( 'shariff3uu_basic' );
322
- $shariff3uu_basic = array_filter( $GLOBALS['shariff3uu_basic'] );
323
  update_option( 'shariff3uu_basic', $shariff3uu_basic );
324
  // Design.
325
  delete_option( 'shariff3uu_design' );
326
- $shariff3uu_design = array_filter( $GLOBALS['shariff3uu_design'] );
327
  update_option( 'shariff3uu_design', $shariff3uu_design );
328
  // Advanced.
329
  delete_option( 'shariff3uu_advanced' );
330
- $shariff3uu_advanced = array_filter( $GLOBALS['shariff3uu_advanced'] );
331
  update_option( 'shariff3uu_advanced', $shariff3uu_advanced );
332
  // Statistic.
333
  delete_option( 'shariff3uu_statistic' );
334
- $shariff3uu_statistic = array_filter( $GLOBALS['shariff3uu_statistic'] );
335
  update_option( 'shariff3uu_statistic', $shariff3uu_statistic );
336
 
337
  // Remove old settings.
1
  <?php
2
  /**
3
+ * Will be included by shariff3uu_update() only if needed.
4
  * Put all update task here. Make sure that all "older" updates are checked first.
5
+ * At least you must set $shariff3uu['version'] = [YOUR VERSION]; to avoid includes later on.
6
  *
7
  * @package WordPress
8
  */
17
  * Split options in database according to new setting tabs.
18
  * Delete old cache directory.
19
  */
20
+ if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '2.2.5' ) ) {
21
 
22
  // Basic options.
23
+ if ( isset( $shariff3uu['version'] ) ) {
24
+ $shariff3uu_basic['version'] = $shariff3uu['version'];
25
  }
26
+ if ( isset( $shariff3uu['services'] ) ) {
27
+ $shariff3uu_basic['services'] = $shariff3uu['services'];
28
  }
29
+ if ( isset( $shariff3uu['add_after_all_posts'] ) ) {
30
+ $shariff3uu_basic['add_after']['posts'] = $shariff3uu['add_after_all_posts'];
31
  }
32
+ if ( isset( $shariff3uu['add_after_all_overview'] ) ) {
33
+ $shariff3uu_basic['add_after']['posts_blogpage'] = $shariff3uu['add_after_all_overview'];
34
  }
35
+ if ( isset( $shariff3uu['add_after_all_pages'] ) ) {
36
+ $shariff3uu_basic['add_after']['pages'] = $shariff3uu['add_after_all_pages'];
37
  }
38
+ if ( isset( $shariff3uu['add_after_all_custom_type'] ) ) {
39
+ $shariff3uu_basic['add_after']['custom_type'] = $shariff3uu['add_after_all_custom_type'];
40
  }
41
+ if ( isset( $shariff3uu['add_before_all_posts'] ) ) {
42
+ $shariff3uu_basic['add_before']['posts'] = $shariff3uu['add_before_all_posts'];
43
  }
44
+ if ( isset( $shariff3uu['add_before_all_overview'] ) ) {
45
+ $shariff3uu_basic['add_before']['posts_blogpage'] = $shariff3uu['add_before_all_overview'];
46
  }
47
+ if ( isset( $shariff3uu['add_before_all_pages'] ) ) {
48
+ $shariff3uu_basic['add_before']['pages'] = $shariff3uu['add_before_all_pages'];
49
  }
50
+ if ( isset( $shariff3uu['disable_on_protected'] ) ) {
51
+ $shariff3uu_basic['disable_on_protected'] = $shariff3uu['disable_on_protected'];
52
  }
53
+ if ( isset( $shariff3uu['backend'] ) ) {
54
+ $shariff3uu_basic['backend'] = $shariff3uu['backend'];
55
  }
56
 
57
  // Design options.
58
+ if ( isset( $shariff3uu['language'] ) ) {
59
+ $shariff3uu_design['language'] = $shariff3uu['language'];
60
  }
61
+ if ( isset( $shariff3uu['theme'] ) ) {
62
+ $shariff3uu_design['theme'] = $shariff3uu['theme'];
63
  }
64
+ if ( isset( $shariff3uu['buttonsize'] ) ) {
65
+ $shariff3uu_design['buttonsize'] = $shariff3uu['buttonsize'];
66
  }
67
+ if ( isset( $shariff3uu['vertical'] ) ) {
68
+ $shariff3uu_design['vertical'] = $shariff3uu['vertical'];
69
  }
70
+ if ( isset( $shariff3uu['align'] ) ) {
71
+ $shariff3uu_design['align'] = $shariff3uu['align'];
72
  }
73
+ if ( isset( $shariff3uu['align_widget'] ) ) {
74
+ $shariff3uu_design['align_widget'] = $shariff3uu['align_widget'];
75
  }
76
+ if ( isset( $shariff3uu['style'] ) ) {
77
+ $shariff3uu_design['style'] = $shariff3uu['style'];
78
  }
79
 
80
  // Advanced options.
81
+ if ( isset( $shariff3uu['info_url'] ) ) {
82
+ $shariff3uu_advanced['info_url'] = $shariff3uu['info_url'];
83
  }
84
+ if ( isset( $shariff3uu['twitter_via'] ) ) {
85
+ $shariff3uu_advanced['twitter_via'] = $shariff3uu['twitter_via'];
86
  }
87
+ if ( isset( $shariff3uu['flattruser'] ) ) {
88
+ $shariff3uu_advanced['flattruser'] = $shariff3uu['flattruser'];
89
  }
90
+ if ( isset( $shariff3uu['default_pinterest'] ) ) {
91
+ $shariff3uu_advanced['default_pinterest'] = $shariff3uu['default_pinterest'];
92
  }
93
 
94
  // Mailform options.
95
+ if ( isset( $shariff3uu['mail_add_post_content'] ) ) {
96
+ $GLOBALS['shariff3UU_mailform']['mail_add_post_content'] = $shariff3uu['mail_add_post_content'];
97
  }
98
+ if ( isset( $shariff3uu['mail_sender_name'] ) ) {
99
+ $GLOBALS['shariff3UU_mailform']['mail_sender_name'] = $shariff3uu['mail_sender_name'];
100
  }
101
+ if ( isset( $shariff3uu['mail_sender_from'] ) ) {
102
+ $GLOBALS['shariff3UU_mailform']['mail_sender_from'] = $shariff3uu['mail_sender_from'];
103
  }
104
  // Default options should be as save as possible, same reason the statistics are disabled by default.
105
  $GLOBALS['shariff3UU_mailform']['require_sender'] = 1;
106
 
107
  // Update global.
108
+ $shariff3uu = array_merge( $shariff3uu_basic, $shariff3uu_design, $shariff3uu_advanced, $GLOBALS['shariff3UU_mailform'] );
109
 
110
  // Update version.
111
+ $shariff3uu['version'] = '2.3.0';
112
  }
113
 
114
  /**
116
  * Update options that were moved.
117
  * Delete old cache directory and db entry.
118
  */
119
+ if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '3.3.0' ) ) {
120
 
121
  // Update options that were moved.
122
+ if ( isset( $shariff3uu['backend'] ) ) {
123
+ $shariff3uu_statistic['backend'] = $shariff3uu['backend'];
124
  }
125
+ if ( isset( $shariff3uu['fb_id'] ) ) {
126
+ $shariff3uu_statistic['fb_id'] = $shariff3uu['fb_id'];
127
  }
128
+ if ( isset( $shariff3uu['fb_secret'] ) ) {
129
+ $shariff3uu_statistic['fb_secret'] = $shariff3uu['fb_secret'];
130
  }
131
+ if ( isset( $shariff3uu['ttl'] ) ) {
132
+ $shariff3uu_statistic['ttl'] = $shariff3uu['ttl'];
133
  }
134
+ if ( isset( $shariff3uu['disable'] ) ) {
135
+ $shariff3uu_statistic['disable'] = $shariff3uu['disable'];
136
  }
137
 
138
  // Delete old cache directory and db entry.
160
  }
161
 
162
  // Disable Twitter backend due to new service OpenShareCount.com.
163
+ $shariff3uu_statistic['disable']['twitter'] = 1;
164
 
165
  // Update version.
166
+ $shariff3uu['version'] = '3.3.0';
167
  }
168
 
169
  /**
198
  /**
199
  * Migration < 4.0
200
  */
201
+ if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.0.0' ) ) {
202
 
203
  // Set new option share counts, if statistic is enabled.
204
+ if ( isset( $shariff3uu_statistic['backend'] ) ) {
205
+ $shariff3uu_statistic['sharecounts'] = 1;
206
  }
207
 
208
  // Disable share counts if WP version < 4.4.
209
  if ( version_compare( get_bloginfo( 'version' ), '4.4.0' ) < 1 ) {
210
+ unset( $shariff3uu_statistic['backend'] );
211
  }
212
 
213
  // Change button language to WordPress language, if it is set to auto and http_negotiate_language is not available (auto will not work without it).
214
+ if ( ! isset( $shariff3uu_design['lang'] ) && ! function_exists( 'http_negotiate_language' ) ) {
215
+ $shariff3uu_design['lang'] = substr( get_bloginfo( 'language' ), 0, 2 );
216
  }
217
 
218
  // Update version.
219
+ $shariff3uu['version'] = '4.0.0';
220
  }
221
 
222
  /**
223
  * Migration < 4.2
224
  */
225
+ if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.2.0' ) ) {
226
  // Make sure we have the $wpdb class ready.
227
  global $wpdb;
228
 
259
  /**
260
  * Migration < 4.5
261
  */
262
+ if ( isset( $shariff3uu['version'] ) && -1 === version_compare( $shariff3uu['version'], '4.5.0' ) ) {
263
  // Update language settings.
264
+ if ( ! isset( $shariff3uu_design['lang'] ) ) {
265
+ $shariff3uu_design['autolang'] = 1;
266
+ $shariff3uu_design['lang'] = substr( get_locale(), 0, 2 );
267
  }
268
  // Update version.
269
+ $shariff3uu['version'] = '4.5.0';
270
  }
271
 
272
  /**
311
  }
312
 
313
  // Set new version.
314
+ $shariff3uu['version'] = $code_version;
315
+ $shariff3uu_basic['version'] = $code_version;
316
 
317
  /**
318
+ * Remove empty elements and save to options table. We had a mix up with shariff3uu and shariff3UU in the past and update_option is not case senitive. Therefore we actually need to delete and recreate it.
319
  */
320
  // Basic.
321
  delete_option( 'shariff3uu_basic' );
322
+ $shariff3uu_basic = array_filter( $shariff3uu_basic );
323
  update_option( 'shariff3uu_basic', $shariff3uu_basic );
324
  // Design.
325
  delete_option( 'shariff3uu_design' );
326
+ $shariff3uu_design = array_filter( $shariff3uu_design );
327
  update_option( 'shariff3uu_design', $shariff3uu_design );
328
  // Advanced.
329
  delete_option( 'shariff3uu_advanced' );
330
+ $shariff3uu_advanced = array_filter( $shariff3uu_advanced );
331
  update_option( 'shariff3uu_advanced', $shariff3uu_advanced );
332
  // Statistic.
333
  delete_option( 'shariff3uu_statistic' );
334
+ $shariff3uu_statistic = array_filter( $shariff3uu_statistic );
335
  update_option( 'shariff3uu_statistic', $shariff3uu_statistic );
336
 
337
  // Remove old settings.