Simple Share Buttons Adder - Version 8.1.0

Version Description

  • Remove: Registration.
  • Add: new privacy terms.
  • Add: vendor restrictions to GDPR
Download this release

Release Info

Developer DavidoffNeal
Plugin Icon 128x128 Simple Share Buttons Adder
Version 8.1.0
Comparing to
See all releases

Code changes from version 8.0.1 to 8.1.0

css/admin-theme.css CHANGED
@@ -541,7 +541,6 @@
541
  font-family: arial, sans-serif;
542
  }
543
 
544
-
545
  .ssba_sharecount:after, .ssba_sharecount:before {
546
  right: 100%;
547
  border: solid transparent;
541
  font-family: arial, sans-serif;
542
  }
543
 
 
544
  .ssba_sharecount:after, .ssba_sharecount:before {
545
  right: 100%;
546
  border: solid transparent;
css/admin.css CHANGED
@@ -228,9 +228,21 @@ a.st-rc-link {
228
  }
229
 
230
  .register-section button {
231
- background-color: #4583ee;
232
  color: #fff;
233
  padding: 10px 15px;
234
  border: none;
235
  border-radius: 5px;
236
  }
 
 
 
 
 
 
 
 
 
 
 
 
228
  }
229
 
230
  .register-section button {
231
+ background-color: #5BAC4D;
232
  color: #fff;
233
  padding: 10px 15px;
234
  border: none;
235
  border-radius: 5px;
236
  }
237
+
238
+ .gdpr-platform .vendor-table-body {
239
+ border: solid 1px #cdcdcd;
240
+ padding: 10px;
241
+ max-height: 600px;
242
+ overflow: scroll;
243
+ }
244
+
245
+ .gdpr-platform .vendor-table-cell {
246
+ padding: 20px 0;
247
+ border-bottom: solid 1px #cdcdcd;
248
+ }
images/gdpr-ex.png ADDED
Binary file
instance.php CHANGED
@@ -9,7 +9,7 @@ namespace SimpleShareButtonsAdder;
9
 
10
  define( 'SSBA_FILE', __FILE__ );
11
  define( 'SSBA_ROOT', dirname( __FILE__ ) );
12
- define( 'SSBA_VERSION', '8.0.1' );
13
 
14
  global $simple_share_buttons_adder_plugin;
15
 
9
 
10
  define( 'SSBA_FILE', __FILE__ );
11
  define( 'SSBA_ROOT', dirname( __FILE__ ) );
12
+ define( 'SSBA_VERSION', '8.1.0' );
13
 
14
  global $simple_share_buttons_adder_plugin;
15
 
js/admin.js CHANGED
@@ -49,6 +49,12 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
49
 
50
  // Set GDPR purposes.
51
  this.setPurposes($('.gdpr-config').is(':visible'));
 
 
 
 
 
 
52
  },
53
 
54
  /**
@@ -56,23 +62,17 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
56
  */
57
  listen: function() {
58
  var self = this;
 
59
 
60
- // Create ST Account.
61
- this.$gdprContainer.on('click', '.create-account', function() {
62
- var email = $('#st-email').val(),
63
- password = $('#st-password').val();
64
-
65
- self.createAccount(email, password);
66
- });
67
 
68
- // Click landing cta button.
69
- this.$gdprContainer.on('click', '#register-selection', function(e) {
70
- e.preventDefault();
71
- e.stopPropagation();
72
-
73
- $('.gdpr-landing').hide();
74
- $('.gdpr-register').show();
75
- });
76
 
77
  // New color select.
78
  this.$gdprContainer.on('click', "#sharethis-form-color .color", function() {
@@ -101,14 +101,14 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
101
  });
102
 
103
  // Uncheck radio if click on selected box.
104
- this.$gdprContainer.on( 'click', '.gdpr-platform .lever', (e) => {
105
  e.preventDefault();
106
  e.stopPropagation();
107
 
108
  const theInput = $( e.currentTarget ).siblings( 'input' );
109
 
110
  if ( theInput.is( ':checked' ) ) {
111
- $( `input[name="${theInput.attr( 'name' )}"]` ).prop( 'checked', false )
112
  } else {
113
  theInput.prop( 'checked', true )
114
  }
@@ -124,7 +124,7 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
124
  });
125
 
126
  // If selecting a tab.
127
- $( 'body' ).on( 'click', '.ssba-classic-tab, .ssba-modern-tab, .ssba-bar-tab, .ssba-gdpr', function() {
128
  var selection = 'classic';
129
 
130
  if ( $( this ).hasClass( 'ssba-modern-tab') ) {
@@ -140,6 +140,8 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
140
  }
141
 
142
  $( '#ssba_selected_tab' ).val( selection );
 
 
143
  } );
144
 
145
  // When changing image sets.
@@ -161,7 +163,7 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
161
  $( 'body' ).on( 'click', '#submit', function( event ) {
162
  event.preventDefault();
163
 
164
- self.adminForm( event, this );
165
  } );
166
 
167
  // Select preview.
@@ -523,6 +525,11 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
523
  $( 'body' ).on( 'click', '#ssba-copy-shortcode', function() {
524
  self.copyText( $( '.ssba-buttons-shortcode' ) );
525
  } );
 
 
 
 
 
526
  },
527
 
528
  /**
@@ -660,8 +667,9 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
660
  *
661
  * @param event
662
  * @param submit
 
663
  */
664
- adminForm: function ( event, submit ) {
665
  var ssbaData = $('#ssba-admin-form').serialize(),
666
  ssba_selected_tab = $('#ssba_selected_tab').val(),
667
  gdpr_config = this.getConfig();
@@ -688,7 +696,7 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
688
  async: false,
689
  contentType: 'application/json; charset=utf-8',
690
  data: JSON.stringify({
691
- 'token': this.data.token,
692
  'id': this.data.propertyid,
693
  'product': 'gdpr-compliance-tool-v2',
694
  'config': gdpr_config
@@ -712,7 +720,9 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
712
  ).always( function( response ) {
713
 
714
  // Refresh page.
715
- location.reload();
 
 
716
  } ); // End post.
717
  },
718
 
@@ -1001,145 +1011,59 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
1001
  document.execCommand('copy');
1002
  },
1003
 
1004
- /**
1005
- * Create ST account for product use.
1006
- *
1007
- * @param email
1008
- * @param password
1009
- */
1010
- createAccount: function ( email, password ) {
1011
- var self = this,
1012
- emailEnabled = $('#email-enabled').is(':checked'),
1013
- theData = {
1014
- email: email,
1015
- password: password,
1016
- custom: {
1017
- is_simpleshare: true,
1018
- onboarding_product: 'gdpr-compliance-tool-v2',
1019
- }
1020
- };
1021
-
1022
- if ( emailEnabled ) {
1023
- theData.custom['email_enabled'] = true;
1024
- }
1025
-
1026
- theData = JSON.stringify(theData);
1027
-
1028
- $.ajax({
1029
- url: 'https://sso.sharethis.com/register',
1030
- method: 'POST',
1031
- async: false,
1032
- contentType: 'application/json; charset=utf-8',
1033
- data: theData,
1034
- success: function ( results ) {
1035
- // Create property.
1036
- self.createProperty(results, email);
1037
- },
1038
- error: function ( xhr, status, error ) {
1039
-
1040
- var message = xhr.responseJSON.message,
1041
-
1042
- message = 'an account with this email already exists' === message ?
1043
- 'Hi, it looks like an account with this email already exists! We are using ShareThis ‘ GDPR Compliance Tool. We recommend trying another email address as we’re not able to connect to their database at this time.' :
1044
- message;
1045
-
1046
- $('small.error-message').remove();
1047
-
1048
- if ( 'Your password must be 6 characters or more' === message || 'missing \'password\'' === message ) {
1049
- $('#st-password').before(
1050
- '<small class="error-message" style="margin: 1rem 0;">' +
1051
- message +
1052
- '</small>'
1053
- );
1054
- } else {
1055
- $('#st-email, #st-no-account-email').before(
1056
- '<small class="error-message" style="margin: 1rem 0;">' +
1057
- message +
1058
- '</small>'
1059
- );
1060
- }
1061
- }
1062
- });
1063
- },
1064
  /**
1065
  * Create property for new account.
1066
  *
1067
- * @param accountInfo
1068
- * @param button
1069
- * @param signedUp
1070
- * @param flow
1071
- * @param mixpanelCookie
1072
- * @param language
1073
- * @param platform
1074
  */
1075
- createProperty: function (accountInfo) {
1076
- var result = null,
1077
- self = this,
1078
- token = '' !== accountInfo ? accountInfo.token : '',
1079
- theData,
1080
- config = this.getConfig();
1081
-
1082
- if ( 'string' === typeof accountInfo ) {
1083
- token = accountInfo;
1084
- }
1085
 
1086
- theData = JSON.stringify({
1087
- token: token,
1088
- product: 'gdpr-compliance-tool-v2',
 
1089
  });
1090
 
1091
- $.ajax({
1092
- url: 'https://platform-api.sharethis.com/v1.0/property',
1093
- method: 'POST',
1094
- async: false,
1095
- contentType: 'application/json; charset=utf-8',
1096
- data: theData,
1097
- success: function ( results ) {
1098
-
1099
- $('.gdpr-register').hide();
1100
- $('.gdpr-config').show();
1101
-
1102
- wp.ajax.post( 'ssba_ajax_add_creds', {
1103
- propertyId: results._id,
1104
- token: token,
1105
- nonce: self.data.nonce
1106
- } ).always( function( results ) {
1107
- $('.ssba-review-us').fadeOut();
1108
- });
1109
-
1110
- // Send new button status value.
1111
- $.ajax({
1112
- url: 'https://platform-api.sharethis.com/v1.0/property/product',
1113
- method: 'POST',
1114
- async: false,
1115
- contentType: 'application/json; charset=utf-8',
1116
- data: JSON.stringify({
1117
- 'token': token,
1118
- 'id': results._id,
1119
- 'product': 'gdpr-compliance-tool-v2',
1120
- 'config': config
1121
- })
1122
- });
1123
  }
1124
- });
1125
  },
1126
  /**
1127
  * Helper function to grab config of GDPR options.
 
 
1128
  */
1129
- getConfig: function () {
1130
  var config,
1131
- enabled = $('#sharethis-enabled').is(':checked'),
1132
- beforeConfig,
1133
- theFirst,
1134
- theData,
1135
- publisherPurpose = $('#publisher-purpose input:checked'),
1136
  publisherPurposes = [],
 
1137
  display = $( '#sharethis-user-type option:selected' ).val(),
1138
  name = $( '#sharethis-publisher-name' ).val(),
1139
  scope = $( '#sharethis-consent-type option:selected' ).val(),
1140
  color = $( '#sharethis-form-color .color.selected' ).attr('data-value'),
1141
  language = $( '#st-language' ).val();
1142
 
 
 
 
 
 
 
 
1143
  $('#publisher-purpose input:checked').each( function( index, value ) {
1144
  var theId = $(value).attr('data-id'),
1145
  legit = 'consent' !== $(value).val();
@@ -1152,6 +1076,7 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
1152
  display: display,
1153
  publisher_name: name,
1154
  publisher_purposes: publisherPurposes,
 
1155
  language: language,
1156
  color: color,
1157
  scope: scope,
@@ -1164,6 +1089,8 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
1164
  * @param configVisible
1165
  */
1166
  setPurposes: function (configVisible) {
 
 
1167
  if (!configVisible) {
1168
  return;
1169
  }
@@ -1184,6 +1111,61 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
1184
  }
1185
  } );
1186
  }
1187
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1188
  };
1189
  } )( window.jQuery, window.wp );
49
 
50
  // Set GDPR purposes.
51
  this.setPurposes($('.gdpr-config').is(':visible'));
52
+
53
+ // Check if terms accepted and create property if doesn't exist.
54
+ if ('true' === $('.ssba-admin-wrap').attr('data-accepted') &&
55
+ !this.data.propertyid) {
56
+ this.createProperty();
57
+ }
58
  },
59
 
60
  /**
62
  */
63
  listen: function() {
64
  var self = this;
65
+ var timer = '';
66
 
67
+ // Scroll to anchor in vendor list.
68
+ // Send user input to category search AFTER they stop typing.
69
+ $('body').on( 'keyup', '.vendor-search input', function( e ) {
70
+ clearTimeout( timer );
 
 
 
71
 
72
+ timer = setTimeout( function() {
73
+ self.scrollToAnchor($(this).val());
74
+ }.bind( this ), 500 );
75
+ } );
 
 
 
 
76
 
77
  // New color select.
78
  this.$gdprContainer.on('click', "#sharethis-form-color .color", function() {
101
  });
102
 
103
  // Uncheck radio if click on selected box.
104
+ $('body').on( 'click', '.gdpr-platform .lever', (e) => {
105
  e.preventDefault();
106
  e.stopPropagation();
107
 
108
  const theInput = $( e.currentTarget ).siblings( 'input' );
109
 
110
  if ( theInput.is( ':checked' ) ) {
111
+ theInput.prop( 'checked', false )
112
  } else {
113
  theInput.prop( 'checked', true )
114
  }
124
  });
125
 
126
  // If selecting a tab.
127
+ $( 'body' ).on( 'click', '.ssba-classic-tab, .ssba-modern-tab, .ssba-bar-tab, .ssba-gdpr', function(event) {
128
  var selection = 'classic';
129
 
130
  if ( $( this ).hasClass( 'ssba-modern-tab') ) {
140
  }
141
 
142
  $( '#ssba_selected_tab' ).val( selection );
143
+
144
+ self.adminForm( event, this, true );
145
  } );
146
 
147
  // When changing image sets.
163
  $( 'body' ).on( 'click', '#submit', function( event ) {
164
  event.preventDefault();
165
 
166
+ self.adminForm( event, this, false );
167
  } );
168
 
169
  // Select preview.
525
  $( 'body' ).on( 'click', '#ssba-copy-shortcode', function() {
526
  self.copyText( $( '.ssba-buttons-shortcode' ) );
527
  } );
528
+
529
+ // Enable GDPR.
530
+ $('body').on('click', '#enable-gdpr', function() {
531
+ self.enableGdpr( true );
532
+ });
533
  },
534
 
535
  /**
667
  *
668
  * @param event
669
  * @param submit
670
+ * @param tabSelect
671
  */
672
+ adminForm: function ( event, submit, tabSelect ) {
673
  var ssbaData = $('#ssba-admin-form').serialize(),
674
  ssba_selected_tab = $('#ssba_selected_tab').val(),
675
  gdpr_config = this.getConfig();
696
  async: false,
697
  contentType: 'application/json; charset=utf-8',
698
  data: JSON.stringify({
699
+ 'secret': this.data.token,
700
  'id': this.data.propertyid,
701
  'product': 'gdpr-compliance-tool-v2',
702
  'config': gdpr_config
720
  ).always( function( response ) {
721
 
722
  // Refresh page.
723
+ if (!tabSelect) {
724
+ location.reload();
725
+ }
726
  } ); // End post.
727
  },
728
 
1011
  document.execCommand('copy');
1012
  },
1013
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1014
  /**
1015
  * Create property for new account.
1016
  *
 
 
 
 
 
 
 
1017
  */
1018
+ createProperty: function ( fromGdpr ) {
1019
+ var self = this;
 
 
 
 
 
 
 
 
1020
 
1021
+ const theData = JSON.stringify({
1022
+ domain: this.data.homeUrl,
1023
+ is_simpleshare: true,
1024
+ product: 'simple-share',
1025
  });
1026
 
1027
+ $.ajax( {
1028
+ url: 'https://platform-api.sharethis.com/v1.0/property',
1029
+ method: 'POST',
1030
+ async: false,
1031
+ contentType: 'application/json; charset=utf-8',
1032
+ data: theData,
1033
+ success: function ( results ) {
1034
+ wp.ajax.post( 'ssba_ajax_add_creds', {
1035
+ propertyId: results._id,
1036
+ token: results.secret,
1037
+ nonce: self.data.nonce
1038
+ } ).always( function ( results ) {
1039
+ } );
1040
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1041
  }
1042
+ );
1043
  },
1044
  /**
1045
  * Helper function to grab config of GDPR options.
1046
+ *
1047
+ * @param {bool} first If first enable.
1048
  */
1049
+ getConfig: function ( first ) {
1050
  var config,
1051
+ enabled = first ? true : $('#sharethis-enabled').is(':checked'),
 
 
 
 
1052
  publisherPurposes = [],
1053
+ publisherRestrictions = {},
1054
  display = $( '#sharethis-user-type option:selected' ).val(),
1055
  name = $( '#sharethis-publisher-name' ).val(),
1056
  scope = $( '#sharethis-consent-type option:selected' ).val(),
1057
  color = $( '#sharethis-form-color .color.selected' ).attr('data-value'),
1058
  language = $( '#st-language' ).val();
1059
 
1060
+ $('.vendor-table-cell-wrapper label input:checked').each( function( index, value ) {
1061
+ var vendorId = $(value).attr('data-id');
1062
+ if (vendorId) {
1063
+ publisherRestrictions[vendorId] = true;
1064
+ }
1065
+ });
1066
+
1067
  $('#publisher-purpose input:checked').each( function( index, value ) {
1068
  var theId = $(value).attr('data-id'),
1069
  legit = 'consent' !== $(value).val();
1076
  display: display,
1077
  publisher_name: name,
1078
  publisher_purposes: publisherPurposes,
1079
+ publisher_restrictions: publisherRestrictions,
1080
  language: language,
1081
  color: color,
1082
  scope: scope,
1089
  * @param configVisible
1090
  */
1091
  setPurposes: function (configVisible) {
1092
+ const self = this;
1093
+
1094
  if (!configVisible) {
1095
  return;
1096
  }
1111
  }
1112
  } );
1113
  }
1114
+
1115
+ if ( undefined !== self.data['publisher_restrictions'] ) {
1116
+ $( ".vendor-table-body .vendor-table-cell-wrapper input" ).prop( 'checked', false );
1117
+ $( ".vendor-table-body .vendor-table-cell-wrapper input" ).bootstrapSwitch( 'state', false );
1118
+
1119
+ $.map( self.data['publisher_restrictions'], function ( id, venVal ) {
1120
+ if ( id ) {
1121
+ $( `.vendor-table-body .vendor-table-cell-wrapper input[type="checkbox"][data-id="${venVal}"]` ).prop( 'checked', true );
1122
+ $( `.vendor-table-body .vendor-table-cell-wrapper input[type="checkbox"][data-id="${venVal}"]` ).bootstrapSwitch( 'state', true );
1123
+ }
1124
+ } );
1125
+ }
1126
+ },
1127
+
1128
+ /**
1129
+ * Enable gdpr product.
1130
+ *
1131
+ * @param {bool} first Is it first enable.
1132
+ */
1133
+ enableGdpr: function( first ) {
1134
+ const self = this;
1135
+ const config = this.getConfig( first );
1136
+
1137
+ $.ajax({
1138
+ url: 'https://platform-api.sharethis.com/v1.0/property/product',
1139
+ method: 'POST',
1140
+ async: false,
1141
+ contentType: 'application/json; charset=utf-8',
1142
+ data: JSON.stringify({
1143
+ 'secret': self.data.token,
1144
+ 'id': self.data.propertyid,
1145
+ 'product': 'gdpr-compliance-tool-v2',
1146
+ 'config': config
1147
+ }),
1148
+ success: function ( results ) {
1149
+ wp.ajax.post( 'ssba_ajax_update_gdpr', {
1150
+ config: config,
1151
+ nonce: self.data.nonce
1152
+ } ).always( function ( results ) {
1153
+ } );
1154
+ }
1155
+ });
1156
+
1157
+ $('.gdpr-landing').hide();
1158
+ $('.gdpr-config').show();
1159
+ },
1160
+
1161
+ scrollToAnchor: function(aid) {
1162
+ var aTag = $("a[name='"+ aid.toLowerCase() +"']");
1163
+
1164
+ $('.vendor-table-body').animate({
1165
+ scrollTop: 0
1166
+ }, 0).animate({
1167
+ scrollTop: aTag.offset().top - 1100
1168
+ }, 0);
1169
+ },
1170
  };
1171
  } )( window.jQuery, window.wp );
php/class-admin-bits.php CHANGED
@@ -62,25 +62,26 @@ class Admin_Bits
62
  /**
63
  * ShareThis terms notice detector.
64
  *
65
- * @action admin_notices
66
  */
67
- public function sharethisTermsNotice()
68
  {
 
 
69
  // If the sharethis terms have not yet been accepted.
70
- if (isset($arr_settings['accepted_sharethis_terms'], $arr_settings['hide_share_this_terms']) && 'Y' !== $arr_settings['accepted_sharethis_terms'] && true !== $arr_settings['hide_sharethis_terms']) {
71
  ?>
72
  <div id="sharethis_terms_notice" class="update-nag notice is-dismissible">
73
  <p>
74
- <?php echo esc_html__('There are some', 'simple-share-buttons-adder'); ?>
75
- <strong><?php echo esc_html__('great new features',
76
- 'simple-share-buttons-adder'); ?></strong> <?php echo esc_html__('available with Simple Share Buttons Adder 6.3',
77
- 'simple-share-buttons-adder'); ?>,
78
- <?php echo esc_html__('such as an improved mobile Facebook sharing experience and Facebook analytics.
79
- We\'ve updated our'); ?> <a href="http://simplesharebuttons.com/privacy"
80
- target="_blank"><?php echo esc_html__('privacy policy and terms of use',
81
- 'simple-share-buttons-adder'); ?></a> <?php echo esc_html__('with important changes you should review. To take advantage of the new features, please review and accept the new',
82
- 'simple-share-buttons-adder'); ?> <a href="http://simplesharebuttons.com/privacy"
83
- target="_blank">terms and privacy policy</a>.
84
  <a href="options-general.php?page=simple-share-buttons-adder&accept-terms=Y">
85
  <span class="button button-primary">
86
  <?php echo esc_html__('I accept', 'simple-share-buttons-adder'); ?>
@@ -88,11 +89,6 @@ class Admin_Bits
88
  </a>
89
  </p>
90
  </div>
91
- <script type="text/javascript">
92
- jQuery( '#sharethis_terms_notice' ).on( 'click', '.notice-dismiss', function ( event ) {
93
- jQuery.post( ajaxurl, { action: 'ssba_hide_terms' } );
94
- } );
95
- </script>
96
  <?php
97
  }
98
  }
@@ -115,19 +111,6 @@ class Admin_Bits
115
  return $links;
116
  }
117
 
118
- /**
119
- * Hides the terms agreement at user's request.
120
- *
121
- * @action wp_ajax_ssba_hide_term
122
- */
123
- public function ssbaAdminHideCallback()
124
- {
125
- $this->class_ssba->ssba_update_options(array(
126
- 'hide_sharethis_terms' => true,
127
- ));
128
- wp_die();
129
- }
130
-
131
  /**
132
  * AJAX Call for adding hide option to review popup.
133
  *
@@ -196,8 +179,10 @@ class Admin_Bits
196
  __NAMESPACE__,
197
  wp_json_encode(array(
198
  'site' => $current_url,
 
199
  'nonce' => wp_create_nonce($this->plugin->meta_prefix),
200
  'publisher_purposes' => !empty($arr_settings['ssba_gdpr_config']['publisher_purposes']) ? $arr_settings['ssba_gdpr_config']['publisher_purposes'] : false,
 
201
  'token' => !empty($token) ? $token : false,
202
  'propertyid' => !empty($propertyid) ? $propertyid : false
203
  ))
@@ -215,10 +200,63 @@ class Admin_Bits
215
  wp_enqueue_style("{$this->plugin->assets_prefix}-switch");
216
  wp_enqueue_style("{$this->plugin->assets_prefix}-font-awesome");
217
  wp_enqueue_style("{$this->plugin->assets_prefix}-admin-theme");
 
218
  wp_enqueue_style("{$this->plugin->assets_prefix}-styles");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  }
220
  }
221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  /**
223
  * Save dismiss notice status.
224
  *
@@ -249,6 +287,30 @@ class Admin_Bits
249
  update_option('ssba_dismiss_notice', $new_notice);
250
  }
251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
 
253
  /**
254
  * Register the new simple share button adder menu dashboard link.
62
  /**
63
  * ShareThis terms notice detector.
64
  *
 
65
  */
66
+ public static function sharethisTermsNotice()
67
  {
68
+ $arr_settings = get_option('ssba_settings', true);
69
+
70
  // If the sharethis terms have not yet been accepted.
71
+ if (isset($arr_settings['accepted_sharethis_terms']) && 'Y' !== $arr_settings['accepted_sharethis_terms']) {
72
  ?>
73
  <div id="sharethis_terms_notice" class="update-nag notice is-dismissible">
74
  <p>
75
+ <?php esc_html_e('We\'ve updated our', 'simple-share-buttons-adder'); ?>
76
+ <a style="text-decoration: underline;" href="http://simplesharebuttons.com/privacy" target="_blank">
77
+ <?php echo esc_html__('privacy policy and terms of use ',
78
+ 'simple-share-buttons-adder'); ?>
79
+ </a>
80
+ <?php echo esc_html__('with important changes you should review. To take advantage of the new features, please review and accept the new ',
81
+ 'simple-share-buttons-adder'); ?>
82
+ <a style="text-decoration: underline;" href="http://simplesharebuttons.com/privacy" target="_blank">
83
+ <?php esc_html_e('terms and privacy policy', 'simple-share-button-adder'); ?>
84
+ </a>.
85
  <a href="options-general.php?page=simple-share-buttons-adder&accept-terms=Y">
86
  <span class="button button-primary">
87
  <?php echo esc_html__('I accept', 'simple-share-buttons-adder'); ?>
89
  </a>
90
  </p>
91
  </div>
 
 
 
 
 
92
  <?php
93
  }
94
  }
111
  return $links;
112
  }
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  /**
115
  * AJAX Call for adding hide option to review popup.
116
  *
179
  __NAMESPACE__,
180
  wp_json_encode(array(
181
  'site' => $current_url,
182
+ 'homeUrl' => str_replace(['https://', 'http://'], '', get_home_url()),
183
  'nonce' => wp_create_nonce($this->plugin->meta_prefix),
184
  'publisher_purposes' => !empty($arr_settings['ssba_gdpr_config']['publisher_purposes']) ? $arr_settings['ssba_gdpr_config']['publisher_purposes'] : false,
185
+ 'publisher_restrictions' => !empty($arr_settings['ssba_gdpr_config']['publisher_restrictions']) ? $arr_settings['ssba_gdpr_config']['publisher_restrictions'] : false,
186
  'token' => !empty($token) ? $token : false,
187
  'propertyid' => !empty($propertyid) ? $propertyid : false
188
  ))
200
  wp_enqueue_style("{$this->plugin->assets_prefix}-switch");
201
  wp_enqueue_style("{$this->plugin->assets_prefix}-font-awesome");
202
  wp_enqueue_style("{$this->plugin->assets_prefix}-admin-theme");
203
+ wp_enqueue_style("{$this->plugin->assets_prefix}-admin");
204
  wp_enqueue_style("{$this->plugin->assets_prefix}-styles");
205
+
206
+ $html_share_buttons_form = '';
207
+
208
+ // Get settings.
209
+ $arr_settings = $this->class_ssba->get_ssba_settings();
210
+
211
+ // If user is accepting terms.
212
+ if (isset($_GET['accept-terms']) && 'Y' === $_GET['accept-terms']) { // WPCS: CSRF ok.
213
+ // Save acceptance.
214
+ $this->class_ssba->ssba_update_options(array(
215
+ 'accepted_sharethis_terms' => 'Y',
216
+ ));
217
+
218
+ // Hide the notice for now, it will disappear upon reload.
219
+ $html_share_buttons_form .= '#sharethis_terms_notice { display: none }.ssbp-facebook_save { background-color: #365397 !important; }';
220
+ }
221
+
222
+ // Get the font family needed.
223
+ $html_share_buttons_form .= $this->get_font_family();
224
+
225
+ // If left to right.
226
+ if (is_rtl()) {
227
+ // Move save button.
228
+ $html_share_buttons_form .= '.ssba-btn-save{ left: 0!important;
229
+ right: auto !important;
230
+ border-radius: 0 5px 5px 0; }';
231
+ }
232
+
233
+ wp_add_inline_style("{$this->plugin->assets_prefix}-admin-theme", $html_share_buttons_form);
234
  }
235
  }
236
 
237
+ /**
238
+ * Get ssbp font family.
239
+ *
240
+ * @return string
241
+ */
242
+ private function get_font_family()
243
+ {
244
+ return "@font-face {
245
+ font-family: 'ssbp';
246
+ src:url('{$this->plugin->dir_url}fonts/ssbp.eot?xj3ol1');
247
+ src:url('{$this->plugin->dir_url}fonts/ssbp.eot?#iefixxj3ol1') format('embedded-opentype'),
248
+ url('{$this->plugin->dir_url}fonts/ssbp.woff?xj3ol1') format('woff'),
249
+ url('{$this->plugin->dir_url}fonts/ssbp.ttf?xj3ol1') format('truetype'),
250
+ url('{$this->plugin->dir_url}fonts/ssbp.svg?xj3ol1#ssbp') format('svg');
251
+ font-weight: normal;
252
+ font-style: normal;
253
+
254
+ /* Better Font Rendering =========== */
255
+ -webkit-font-smoothing: antialiased;
256
+ -moz-osx-font-smoothing: grayscale;
257
+ }";
258
+ }
259
+
260
  /**
261
  * Save dismiss notice status.
262
  *
287
  update_option('ssba_dismiss_notice', $new_notice);
288
  }
289
 
290
+ /**
291
+ * Save dismiss notice status.
292
+ *
293
+ * @action wp_ajax_ssba_ajax_update_gdpr
294
+ */
295
+ public function updateGdpr()
296
+ {
297
+ check_ajax_referer($this->plugin->meta_prefix, 'nonce');
298
+
299
+ if (! isset($_POST['config']) || '' === $_POST['config']) { // WPCS: input var okay.
300
+ wp_send_json_error('gdpr update fail');
301
+ }
302
+
303
+ $current_settings = get_option('ssba_settings') ?? '';
304
+
305
+ if ('' === $current_settings) {
306
+ wp_send_json_error('no settings');
307
+ }
308
+
309
+ $current_settings['ssba_gdpr_config'] = $_POST['config'];
310
+
311
+ update_option('ssba_settings', $current_settings);
312
+ }
313
+
314
 
315
  /**
316
  * Register the new simple share button adder menu dashboard link.
php/class-admin-panel.php CHANGED
@@ -1550,9 +1550,11 @@ class Admin_Panel
1550
 
1551
  // Notices.
1552
  $notice = get_option('ssba_dismiss_notice');
 
 
1553
 
1554
  // All buttons.
1555
- $arr_buttons = array_values(get_option('ssba_buttons', true));
1556
  $selected_buttons = explode(',', $arr_settings['ssba_selected_buttons']);
1557
  $selected_plus_buttons = explode(',', $arr_settings['ssba_selected_plus_buttons']);
1558
  $selected_bar_buttons = explode(',', $arr_settings['ssba_selected_bar_buttons']);
@@ -1635,9 +1637,24 @@ class Admin_Panel
1635
  $arr_bar_buttons = array_merge($selected_bar_button_array, $non_bar_selected_buttons);
1636
  }
1637
 
 
 
 
 
 
1638
  include_once "{$this->plugin->dir_path}/templates/admin-panel.php";
1639
  }
1640
 
 
 
 
 
 
 
 
 
 
 
1641
  /**
1642
  * Get an html formatted of currently selected and ordered buttons.
1643
  *
@@ -1666,9 +1683,10 @@ class Admin_Panel
1666
  // If share this terms haven't been accepted and it's the
1667
  // facebook save button then make the button look disabled.
1668
  $disabled = 'Y' !== $arr_settings['accepted_sharethis_terms'] && 'facebook_save' === $str_selected ? 'style="background-color:#eaeaea;"' : null;
 
1669
 
1670
  // Add a list item for each selected option.
1671
- $html_selected_list .= '<li class="ssbp-option-item" id="' . esc_attr($str_selected) . '"><a title="' . esc_attr($arr_buttons[$str_selected]['full_name']) . '" class="ssbp-btn ssbp-' . esc_attr($str_selected) . '" ' . esc_attr($disabled) . '></a></li>';
1672
  }
1673
  }
1674
  }
@@ -1718,6 +1736,7 @@ class Admin_Panel
1718
 
1719
  // Prepare array of buttons.
1720
  $arr_buttons = get_option('ssba_buttons', true);
 
1721
 
1722
  // Explode saved include list and add to a new array.
1723
  $arr_selected_ssba = explode(',', $str_selected_ssba);
@@ -1750,12 +1769,12 @@ class Admin_Panel
1750
  /**
1751
  * Show in classic button list or not.
1752
  */
1753
- private function showInClassic ($page, $buttonName) {
1754
  if ('classic' !== $page) {
1755
  return true;
1756
  }
1757
 
1758
- if (!in_array($buttonName, ['Line', 'Skype', 'Weibo'])) {
1759
  return true;
1760
  }
1761
 
@@ -1785,43 +1804,6 @@ class Admin_Panel
1785
  }";
1786
  }
1787
 
1788
- /**
1789
- * Add additional admin styles
1790
- *
1791
- * @action admin_enqueue_scripts
1792
- */
1793
- public function additional_styles()
1794
- {
1795
- $html_share_buttons_form = '';
1796
-
1797
- // Get settings.
1798
- $arr_settings = $this->class_ssba->get_ssba_settings();
1799
-
1800
- // If user is accepting terms.
1801
- if (isset($_GET['accept-terms']) && 'Y' === $_GET['accept-terms']) { // WPCS: CSRF ok.
1802
- // Save acceptance.
1803
- $this->class_ssba->ssba_update_options(array(
1804
- 'accepted_sharethis_terms' => 'Y',
1805
- ));
1806
-
1807
- // Hide the notice for now, it will disappear upon reload.
1808
- $html_share_buttons_form .= '#sharethis_terms_notice { display: none }.ssbp-facebook_save { background-color: #365397 !important; }';
1809
- }
1810
-
1811
- // Get the font family needed.
1812
- $html_share_buttons_form .= $this->get_font_family();
1813
-
1814
- // If left to right.
1815
- if (is_rtl()) {
1816
- // Move save button.
1817
- $html_share_buttons_form .= '.ssba-btn-save{ left: 0!important;
1818
- right: auto !important;
1819
- border-radius: 0 5px 5px 0; }';
1820
- }
1821
-
1822
- wp_add_inline_style("{$this->plugin->assets_prefix}-admin-theme", $html_share_buttons_form);
1823
- }
1824
-
1825
  /**
1826
  * Register button widget.
1827
  *
1550
 
1551
  // Notices.
1552
  $notice = get_option('ssba_dismiss_notice');
1553
+ $buttons = get_option('ssba_buttons');
1554
+ $buttons = !empty($buttons) ? $buttons : [];
1555
 
1556
  // All buttons.
1557
+ $arr_buttons = array_values($buttons);
1558
  $selected_buttons = explode(',', $arr_settings['ssba_selected_buttons']);
1559
  $selected_plus_buttons = explode(',', $arr_settings['ssba_selected_plus_buttons']);
1560
  $selected_bar_buttons = explode(',', $arr_settings['ssba_selected_bar_buttons']);
1637
  $arr_bar_buttons = array_merge($selected_bar_button_array, $non_bar_selected_buttons);
1638
  }
1639
 
1640
+ // GDPR vendors.
1641
+ $vendor_data = $this->getGdprVendors();
1642
+ $vendors = $vendor_data['vendors'];
1643
+ $purposes = array_column($vendor_data['purposes'], 'name', 'id');
1644
+
1645
  include_once "{$this->plugin->dir_path}/templates/admin-panel.php";
1646
  }
1647
 
1648
+ /**
1649
+ * Helper function to get gdpr vendors.
1650
+ */
1651
+ private function getGdprVendors()
1652
+ {
1653
+ $response = wp_remote_get('https://vendorlist.consensu.org/v2/vendor-list.json');
1654
+
1655
+ return json_decode(wp_remote_retrieve_body($response), true);
1656
+ }
1657
+
1658
  /**
1659
  * Get an html formatted of currently selected and ordered buttons.
1660
  *
1683
  // If share this terms haven't been accepted and it's the
1684
  // facebook save button then make the button look disabled.
1685
  $disabled = 'Y' !== $arr_settings['accepted_sharethis_terms'] && 'facebook_save' === $str_selected ? 'style="background-color:#eaeaea;"' : null;
1686
+ $button_full_name = isset($arr_buttons[$str_selected]['full_name']) ? $arr_buttons[$str_selected]['full_name'] : '';
1687
 
1688
  // Add a list item for each selected option.
1689
+ $html_selected_list .= '<li class="ssbp-option-item" id="' . esc_attr($str_selected) . '"><a title="' . esc_attr($button_full_name) . '" class="ssbp-btn ssbp-' . esc_attr($str_selected) . '" ' . esc_attr($disabled) . '></a></li>';
1690
  }
1691
  }
1692
  }
1736
 
1737
  // Prepare array of buttons.
1738
  $arr_buttons = get_option('ssba_buttons', true);
1739
+ $arr_buttons = !empty($arr_buttons) ? $arr_buttons : [];
1740
 
1741
  // Explode saved include list and add to a new array.
1742
  $arr_selected_ssba = explode(',', $str_selected_ssba);
1769
  /**
1770
  * Show in classic button list or not.
1771
  */
1772
+ private function showInClassic ($page, $button_name) {
1773
  if ('classic' !== $page) {
1774
  return true;
1775
  }
1776
 
1777
+ if (!in_array($button_name, ['Line', 'Skype', 'Weibo'])) {
1778
  return true;
1779
  }
1780
 
1804
  }";
1805
  }
1806
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1807
  /**
1808
  * Register button widget.
1809
  *
php/class-buttons.php CHANGED
@@ -63,17 +63,6 @@ class Buttons
63
  // Get settings.
64
  $arr_settings = $this->class_ssba->get_ssba_settings();
65
 
66
- // If user is accepting terms.
67
- if (isset($_GET['accept-terms']) && 'Y' === $_GET['accept-terms']) { // WPCS: CSRF ok.
68
- // Save acceptance.
69
- $this->class_ssba->ssba_update_options(array(
70
- 'accepted_sharethis_terms' => 'Y',
71
- ));
72
-
73
- // Hide the notice for now, it will disappear upon reload.
74
- $html_share_buttons_form .= '#sharethis_terms_notice { display: none }.ssbp-facebook_save { background-color: #365397 !important; }';
75
- }
76
-
77
  // Get the font family needed.
78
  $html_share_buttons_form .= $this->admin_panel->get_font_family();
79
 
63
  // Get settings.
64
  $arr_settings = $this->class_ssba->get_ssba_settings();
65
 
 
 
 
 
 
 
 
 
 
 
 
66
  // Get the font family needed.
67
  $html_share_buttons_form .= $this->admin_panel->get_font_family();
68
 
php/class-database.php CHANGED
@@ -218,7 +218,7 @@ class Database
218
  'plus_ignore_facebook_sdk' => '',
219
  'share_facebook_insights' => '',
220
  'share_facebook_app_id' => '',
221
- 'accepted_sharethis_terms' => 'Y',
222
  );
223
 
224
  if ($return_array) {
@@ -250,11 +250,8 @@ class Database
250
 
251
  $ssba_settings = $this->get_setting_array(true);
252
 
253
- // Json encode.
254
- $json_settings = $ssba_settings;
255
-
256
  // Insert default options for ssba.
257
- add_option('ssba_settings', $json_settings);
258
 
259
  // Button helper array.
260
  $this->ssba_button_helper_array();
@@ -438,11 +435,6 @@ class Database
438
  // Button helper array.
439
  $this->ssba_button_helper_array();
440
 
441
- // Show the ST terms notice after upgrades if the user hasn't agreed.
442
- $this->class_ssba->ssba_update_options(array(
443
- 'hide_sharethis_terms' => false,
444
- ));
445
-
446
  // Update version number.
447
  update_option('ssba_version', SSBA_VERSION);
448
  }
@@ -452,8 +444,7 @@ class Database
452
  */
453
  public function ssba_button_helper_array()
454
  {
455
- // Helper array for ssbp.
456
- update_option('ssba_buttons', array(
457
  'buffer' => array(
458
  'full_name' => esc_html__('Buffer', 'simple-share-buttons-adder'),
459
  ),
@@ -514,7 +505,10 @@ class Database
514
  'yummly' => array(
515
  'full_name' => esc_html__('Yummly', 'simple-share-buttons-adder'),
516
  ),
517
- ));
 
 
 
518
  }
519
 
520
  /**
218
  'plus_ignore_facebook_sdk' => '',
219
  'share_facebook_insights' => '',
220
  'share_facebook_app_id' => '',
221
+ 'accepted_sharethis_terms' => 'N',
222
  );
223
 
224
  if ($return_array) {
250
 
251
  $ssba_settings = $this->get_setting_array(true);
252
 
 
 
 
253
  // Insert default options for ssba.
254
+ update_option('ssba_settings', $ssba_settings);
255
 
256
  // Button helper array.
257
  $this->ssba_button_helper_array();
435
  // Button helper array.
436
  $this->ssba_button_helper_array();
437
 
 
 
 
 
 
438
  // Update version number.
439
  update_option('ssba_version', SSBA_VERSION);
440
  }
444
  */
445
  public function ssba_button_helper_array()
446
  {
447
+ $buttons = array(
 
448
  'buffer' => array(
449
  'full_name' => esc_html__('Buffer', 'simple-share-buttons-adder'),
450
  ),
505
  'yummly' => array(
506
  'full_name' => esc_html__('Yummly', 'simple-share-buttons-adder'),
507
  ),
508
+ );
509
+
510
+ // Helper array for ssbp.
511
+ update_option('ssba_buttons', $buttons);
512
  }
513
 
514
  /**
php/class-plugin.php CHANGED
@@ -89,7 +89,7 @@ class Plugin extends Plugin_Base
89
  wp_register_script("{$this->assets_prefix}-bootstrap-js", "{$this->dir_url}js/vendor/bootstrap.js");
90
  wp_register_script("{$this->assets_prefix}-colorpicker", "{$this->dir_url}js/vendor/colorpicker.js");
91
  wp_register_script("{$this->assets_prefix}-switch", "{$this->dir_url}js/vendor/switch.js");
92
- wp_enqueue_style("{$this->assets_prefix}-admin", "{$this->dir_url}css/admin.css", false, time());
93
  wp_register_style("{$this->assets_prefix}-readable", "{$this->dir_url}css/readable.css");
94
  wp_register_style("{$this->assets_prefix}-colorpicker", "{$this->dir_url}css/colorpicker.css");
95
  wp_register_style("{$this->assets_prefix}-switch", "{$this->dir_url}css/switch.css");
89
  wp_register_script("{$this->assets_prefix}-bootstrap-js", "{$this->dir_url}js/vendor/bootstrap.js");
90
  wp_register_script("{$this->assets_prefix}-colorpicker", "{$this->dir_url}js/vendor/colorpicker.js");
91
  wp_register_script("{$this->assets_prefix}-switch", "{$this->dir_url}js/vendor/switch.js");
92
+ wp_register_style("{$this->assets_prefix}-admin", "{$this->dir_url}css/admin.css", false, time());
93
  wp_register_style("{$this->assets_prefix}-readable", "{$this->dir_url}css/readable.css");
94
  wp_register_style("{$this->assets_prefix}-colorpicker", "{$this->dir_url}css/colorpicker.css");
95
  wp_register_style("{$this->assets_prefix}-switch", "{$this->dir_url}css/switch.css");
php/class-simple-share-buttons-adder.php CHANGED
@@ -40,7 +40,9 @@ class Simple_Share_Buttons_Adder
40
  */
41
  public function get_ssba_settings()
42
  {
43
- $this->convertSettings();
 
 
44
 
45
  $ssba_settings = get_option('ssba_settings', true);
46
 
40
  */
41
  public function get_ssba_settings()
42
  {
43
+ if (SSBA_VERSION < 8) {
44
+ $this->convertSettings();
45
+ }
46
 
47
  $ssba_settings = get_option('ssba_settings', true);
48
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: sharethis, scottstorebloom, surlyrightclick, DavidoffNeal
3
  Tags: share buttons, social buttons, facebook, twitter, google+, share, share links, stumble upon, linkedin, pinterest, yummly, vk, flattr
4
  Requires at least: 4.5
5
- Tested up to: 5.5.1
6
- Stable tag: 8.0.1
7
  License: GPLv2 or later
8
 
9
  A simple plugin that enables you to add share buttons to all of your posts and/or pages.
@@ -66,6 +66,11 @@ Please visit the <a href="https://wordpress.org/support/plugin/simple-share-butt
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
69
  = 8.0.1 =
70
  * Add: true tag to registeration.
71
  * test newest version on 5.5.1
2
  Contributors: sharethis, scottstorebloom, surlyrightclick, DavidoffNeal
3
  Tags: share buttons, social buttons, facebook, twitter, google+, share, share links, stumble upon, linkedin, pinterest, yummly, vk, flattr
4
  Requires at least: 4.5
5
+ Tested up to: 5.5.3
6
+ Stable tag: 8.1.0
7
  License: GPLv2 or later
8
 
9
  A simple plugin that enables you to add share buttons to all of your posts and/or pages.
66
 
67
  == Changelog ==
68
 
69
+ = 8.1.0 =
70
+ * Remove: Registration.
71
+ * Add: new privacy terms.
72
+ * Add: vendor restrictions to GDPR
73
+
74
  = 8.0.1 =
75
  * Add: true tag to registeration.
76
  * test newest version on 5.5.1
simple-share-buttons-adder.php CHANGED
@@ -3,12 +3,12 @@
3
  * Plugin Name: Simple Share Buttons Adder
4
  * Plugin URI: https://simplesharebuttons.com
5
  * Description: A simple plugin that enables you to add share buttons to all of your posts and/or pages.
6
- * Version: 8.0.1
7
  * Author: Simple Share Buttons
8
  * Author URI: https://simplesharebuttons.com
9
  * License: GPLv2
10
 
11
- Copyright 2015 Simple Share Buttons admin@simplesharebuttons.com
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
3
  * Plugin Name: Simple Share Buttons Adder
4
  * Plugin URI: https://simplesharebuttons.com
5
  * Description: A simple plugin that enables you to add share buttons to all of your posts and/or pages.
6
+ * Version: 8.1.0
7
  * Author: Simple Share Buttons
8
  * Author URI: https://simplesharebuttons.com
9
  * License: GPLv2
10
 
11
+ Copyright 2020 Simple Share Buttons admin@simplesharebuttons.com
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as