Simple Share Buttons Adder - Version 8.0.0

Version Description

  • Add: Integrate ShareThis GDPR Compliance Tool.
Download this release

Release Info

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

Code changes from version 7.7.1 to 8.0.0

css/admin.css CHANGED
@@ -25,7 +25,7 @@
25
  right: 10px;
26
  bottom: 40px;
27
  background: #fff;
28
- border: solid 1px #00b300;
29
  border-radius: 10px;
30
  padding: 15px;
31
  width: 295px;
@@ -41,5 +41,196 @@
41
  }
42
 
43
  .ssba-review-us h3 a {
44
- color: #00b300;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
25
  right: 10px;
26
  bottom: 40px;
27
  background: #fff;
28
+ border: solid 1px #4583ee;
29
  border-radius: 10px;
30
  padding: 15px;
31
  width: 295px;
41
  }
42
 
43
  .ssba-review-us h3 a {
44
+ color: #4583ee;
45
+ }
46
+
47
+ #sharethis-form-color {
48
+ display: flex;
49
+ flex-wrap: wrap;
50
+ margin: auto;
51
+ width: 50%;
52
+ }
53
+
54
+ #sharethis-form-color .color {
55
+ box-shadow: 1px 1px 4px 1px #cdcdcd;
56
+ cursor: pointer;
57
+ margin: 5px;
58
+ }
59
+
60
+ #sharethis-form-color .color.selected{
61
+ box-shadow: 0px 0px 3px 5px #4583ee;
62
+ }
63
+
64
+ #publisher-purpose .purpose-item {
65
+ margin-bottom: 25px;
66
+ }
67
+
68
+ #publisher-purpose .purpose-item div.title {
69
+ display: block;
70
+ text-align: left;
71
+ font-weight: bold;
72
+ width: 100%;
73
+ }
74
+
75
+ #publisher-purpose .purpose-item label {
76
+ display: inline-block;
77
+ width: 21%;
78
+ }
79
+
80
+ .gdpr-platform #publisher-purpose .purpose-item label:first-of-type {
81
+ width: 14%;
82
+ }
83
+
84
+ .gdpr-platform .switch label input[type=radio]:checked+.lever {
85
+ background: #4583ee;
86
+ border: 2px solid #4583ee;
87
+ box-shadow: none;
88
+ }
89
+
90
+ .gdpr-platform input[type="text"] {
91
+ line-height: 40px;
92
+ margin-bottom: 10px;
93
+ width: 300px;
94
+ }
95
+
96
+ .gdpr-platform select {
97
+ margin-bottom: 10px;
98
+ line-height: 40px;
99
+ width: 300px;
100
+ }
101
+
102
+ .gdpr-platform .switch label input[type=radio]:checked+.lever:before {
103
+ content:"✓";
104
+ position: absolute;
105
+ top:0;
106
+ left:3px;
107
+ color: #fff;
108
+ }
109
+
110
+ .gdpr-platform .switch label {
111
+ font-size: 12px;
112
+ display: block;
113
+ margin-top: 10px;
114
+ }
115
+
116
+ .gdpr-platform .switch label .lever {
117
+ content: "";
118
+ display: inline-block;
119
+ position: relative;
120
+ width: 20px;
121
+ height: 18px;
122
+ background-color: #fff;
123
+ border: 1px solid #cdcdcd;
124
+ border-radius: 0;
125
+ margin-right: 10px;
126
+ transition: background .3s ease;
127
+ vertical-align: middle;
128
+ margin: 0 16px;
129
+ }
130
+
131
+ .gdpr-platform .switch label .lever:after {
132
+ border-radius: 0;
133
+ content: unset;
134
+ position: unset;
135
+ }
136
+
137
+
138
+ .gdpr-platform [type=radio].filled-in+label:before {
139
+ content: "";
140
+ left: 0;
141
+ position: absolute;
142
+ transition: border .25s,background-color .25s,width .2s .1s,height .2s .1s,top .2s .1s,left .2s .1s;
143
+ z-index: 1;
144
+ }
145
+
146
+ p.form-color {
147
+ float: left;
148
+ width: 100%;
149
+ padding-top: 15px;
150
+ }
151
+
152
+ #sharethis-form-color {
153
+ display: flex;
154
+ flex-wrap: wrap;
155
+ margin: auto;
156
+ width: 50%;
157
+ }
158
+
159
+ #sharethis-form-color .color {
160
+ box-shadow: 1px 1px 4px 1px #cdcdcd;
161
+ cursor: pointer;
162
+ margin: 5px;
163
+ }
164
+
165
+ #sharethis-form-color .color.selected{
166
+ box-shadow: 0px 0px 3px 5px #4583ee;
167
+ }
168
+
169
+ .empty-choices {
170
+ display: flex;
171
+ justify-content: center;
172
+ opacity: 1;
173
+ transition: opacity .6s;
174
+ }
175
+
176
+ a.st-rc-link {
177
+ margin: 20px 0 0 10px;
178
+ }
179
+
180
+ .gdpr-platform a.st-rc-link {
181
+ background: #4583ee;
182
+ border-radius: 3px;
183
+ border: none;
184
+ color: #fff;
185
+ cursor: pointer;
186
+ margin: .8em auto .5em;
187
+ display: inline-block;
188
+ padding: 15px 60px;
189
+ letter-spacing: 0.1em;
190
+ text-align: center;
191
+ text-decoration: none;
192
+ transition: opacity 0.2s ease-out
193
+ }
194
+
195
+ .empty-choices a {
196
+ padding: 10px;
197
+ min-width: 250px;
198
+ }
199
+
200
+ .empty-choices a.st-rc-link {
201
+ margin: 20px 0 20px 10px;
202
+ }
203
+
204
+ .gdpr-platform .purpose-item input[type="checkbox"],
205
+ .gdpr-platform .purpose-item input[type="radio"]
206
+ {
207
+ display: none;
208
+ }
209
+
210
+ .gdpr-platform h2 {
211
+ text-align: center;
212
+ }
213
+
214
+ .gdpr-platform .error-message {
215
+ display: block;
216
+ text-align: left;
217
+ }
218
+
219
+ .gdpr-platform .gdpr-landing img {
220
+ margin: auto;
221
+ width: 600px;
222
+ display: block;
223
+ }
224
+
225
+ .register-section {
226
+ text-align: center;
227
+ padding: 30px 20px;
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
  }
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', '7.7.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.0.0' );
13
 
14
  global $simple_share_buttons_adder_plugin;
15
 
js/admin.js CHANGED
@@ -6,52 +6,113 @@
6
 
7
  /* exported SimpleShareButtonsAdder */
8
  var SimpleShareButtonsAdder = ( function( $, wp ) {
9
- 'use strict';
10
-
11
- return {
12
- /**
13
- * Holds data.
14
- */
15
- data: {},
16
-
17
- /**
18
- * Boot plugin.
19
- *
20
- * @param data
21
- */
22
- boot: function( data ) {
23
- this.data = data;
24
-
25
- $( document ).ready( function() {
26
- this.init();
27
- }.bind( this ) );
28
- },
29
-
30
- /**
31
- * Initialize plugin.
32
- */
33
- init: function() {
34
- this.$plusContainer = $( '#plus-share-buttons' );
35
- this.$shareContainer = $( '#share-bar' );
36
- this.switchCheckboxes();
37
- this.colorPicker();
38
- $( '[data-toggle="tooltip"]' ).tooltip();
39
- this.dragSort();
40
- this.extractIncludeList();
41
- this.listen();
42
-
43
- // Create admin style to fill.
44
- $( 'body.wp-admin' ).siblings( 'head' ).append( '<style type="text/css" id="simple-share-buttons-adder-styles-inline-css"></style>' );
45
-
46
- // Fill it.
47
- this.updateInlineStyle();
48
- },
49
-
50
- /**
51
- * Listener events.
52
- */
53
- listen: function() {
54
- var self = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  // Close review us.
57
  $('body').on('click', '#close-review-us', function() {
@@ -62,856 +123,1066 @@ var SimpleShareButtonsAdder = ( function( $, wp ) {
62
  });
63
  });
64
 
65
- // If selecting a tab.
66
- $( 'body' ).on( 'click', '.ssba-classic-tab, .ssba-modern-tab, .ssba-bar-tab', function() {
67
- var selection = 'classic';
 
 
 
 
 
 
 
 
68
 
69
- if ( $( this ).hasClass( 'ssba-modern-tab') ) {
70
- selection = 'modern';
71
- }
72
 
73
- if ( $( this ).hasClass( 'ssba-bar-tab') ) {
74
- selection = 'bar';
75
- }
76
 
77
- $( '#ssba_selected_tab' ).val( selection );
78
- } );
 
79
 
80
- // When changing image sets.
81
- $( 'body' ).on( 'change', '#ssba_image_set', function() {
82
- var imageSet = $( this ).val();
83
 
84
- self.changeImageSets( imageSet );
85
- } );
 
86
 
87
- // Image uploads.
88
- $( 'body' ).on( 'click', '.ssbpUpload', function( event ) {
89
- var field = $( this ).attr( 'data-ssbp-input' );
90
 
91
- event.preventDefault();
92
- self.imageUploads( field );
93
- } );
94
 
95
- // SSBA admin form.
96
- $( 'body' ).on( 'click', '#submit', function( event ) {
97
- event.preventDefault();
98
 
99
- self.adminForm( event, this );
100
- } );
 
 
 
101
 
102
- // Select preview.
103
- $( 'body' ).on( 'change', '#ssba_plus_button_style, #ssba_bar_style', function() {
104
- var selectId = '#' + $( this ).attr( 'id' ),
105
- selection = $( selectId + ' option:selected' ).val(),
106
- target = '#ssba-preview-2';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
- if ( '#ssba_plus_button_style' === selectId ) {
109
- target = '#ssba-preview';
110
- }
111
-
112
- self.preview( selection, target );
113
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
- // Share bar preview position.
116
- $( 'body' ).on( 'change', '#ssba_bar_position', function() {
117
- var position = $( '#ssba_bar_position option:selected' ).val();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
- self.barPosition( position );
120
- } );
121
-
122
- // Classic button preview.
123
- $( 'body' ).on( 'change', '#ssba_image_set', function() {
124
- var selection = $( '#ssba_image_set option:selected' ).val();
125
-
126
- self.classicPreview( selection, '', '-1', 'img' );
127
- } );
128
-
129
- this.$plusContainer.on( 'change', '#ssba_plus_height, #ssba_plus_width, #ssba_plus_icon_size, #ssba_plus_margin', function() {
130
- var id = $( this ).attr( 'id' ),
131
- selection = $( this ).val(),
132
- type;
133
-
134
- if ( 'ssba_plus_height' === id ) {
135
- type = 'height';
136
- find = 'a';
137
-
138
- self.updateInlineStyle();
139
- }
140
-
141
- if ( 'ssba_plus_width' === id ) {
142
- type = 'width';
143
- find = 'a';
144
- }
145
-
146
- if ( 'ssba_plus_icon_size' === id ) {
147
- type = 'font-size';
148
- find = 'a:before';
149
- selection = selection + 'px';
150
-
151
- self.updateInlineStyle();
152
- }
153
-
154
- if ( 'ssba_plus_margin' === id ) {
155
- type = 'margin';
156
- find = '';
157
- selection = selection + 'px';
158
- }
159
-
160
- self.classicPreview( selection, type, '', find );
161
- } );
162
-
163
- this.$shareContainer.on( 'change', '#ssba_bar_height, #ssba_bar_width, #ssba_bar_icon_size, #ssba_bar_margin', function() {
164
- var id = $( this ).attr( 'id' ),
165
- selection = $( this ).val(),
166
- type;
167
-
168
- if ( 'ssba_bar_height' === id ) {
169
- type = 'height';
170
- find = 'a';
171
-
172
- self.updateInlineStyle();
173
- }
174
-
175
- if ( 'ssba_bar_width' === id ) {
176
- type = 'width';
177
- find = 'a';
178
- }
179
-
180
- if ( 'ssba_bar_icon_size' === id ) {
181
- type = 'font-size';
182
- find = 'a:before';
183
- selection = selection + 'px';
184
-
185
- self.updateInlineStyle();
186
- }
187
-
188
- if ( 'ssba_bar_margin' === id ) {
189
- type = 'margin';
190
- find = '';
191
- selection = selection + 'px';
192
- }
193
-
194
- self.classicPreview( selection, type, '-2', find );
195
- } );
196
-
197
- // Classic button css preview.
198
- $( 'body' ).on( 'change', '#ssba_size, #ssba_padding, #ssba_align', function() {
199
- var value = $( this ).val(),
200
- id = $( this ).attr( 'id' ),
201
- type = 'padding',
202
- target = 'li';
203
-
204
- if ( 'ssba_size' === id ) {
205
- type = 'height';
206
- }
207
-
208
- if ( 'ssba_align' === id ) {
209
- target = 'ul';
210
- type = 'text-align';
211
- }
212
-
213
- self.classicCss( type, value, target, '-1' );
214
- } );
215
-
216
- $( 'body' ).on( 'keydown keyup', '#ssba_padding', function( e ){
217
- if ( $( this ).val() > 50
218
- && e.keyCode !== 46 // delete
219
- && e.keyCode !== 8 // backspace
220
- ) {
221
- e.preventDefault();
222
- $( this ).val(50);
223
- }
224
- });
225
-
226
- // Plus button css preview.
227
- this.$plusContainer.on( 'change', '#ssba_plus_align', function() {
228
- var value = $( this ).val(),
229
- id = $( this ).attr( 'id' ),
230
- type,
231
- target = '';
232
-
233
- if ( 'ssba_plus_align' === id ) {
234
- target = 'ul';
235
- type = 'text-align';
236
- }
237
-
238
- self.classicCss( type, value, target, '' );
239
- } );
240
-
241
- // Update icon and other non DOM style preview.
242
- this.$plusContainer.on( 'change', '#ssba_plus_icon_size', function() {
243
- self.updateInlineStyle();
244
- } );
245
-
246
- // Class button bar text css preview.
247
- $( 'body' ).on( 'change', '.share-text-prev input, .share-text-prev select', function() {
248
- var value = $( this ).val(),
249
- id = $( this ).attr( 'id' ),
250
- type,
251
- sel_value = $( '#' + id + ' option:selected' ).val(),
252
- tab = $( this ).closest( '.tab-pane' ).attr( 'id' );
253
-
254
- if ( 'ssba_share_text' === id || 'ssba_plus_share_text' === id ) {
255
- type = 'html';
256
- }
257
-
258
- if ( 'ssba_font_color' === id || 'ssba_plus_font_color' === id ) {
259
- type = 'color';
260
- }
261
-
262
- if ( 'ssba_font_family' === id || 'ssba_plus_font_family' === id ) {
263
- type = 'font-family';
264
- value = sel_value;
265
- }
266
-
267
- if ( 'ssba_font_size' === id || 'ssba_plus_font_size' === id ) {
268
- type = 'font-size';
269
- value = value + 'px';
270
- }
271
-
272
- if ( 'ssba_font_weight' === id || 'ssba_plus_font_weight' === id ) {
273
- type = 'font-weight';
274
- value = sel_value;
275
- }
276
-
277
- if ( ( 'ssba_text_placement' === id || 'ssba_plus_text_placement' === id ) && 'above' !== value && 'below' !== value ) {
278
- type = 'float';
279
- value = sel_value;
280
- }
281
-
282
- if ( ( 'ssba_text_placement' === id || 'ssba_plus_text_placement' === id ) && ( 'above' === value || 'below' === value ) ) {
283
- type = 'placement';
284
- }
285
-
286
- self.classicTextCss( type, value, '#' + tab + ' .ssba-share-text-prev' );
287
- } );
288
-
289
- // Class button share text css preview.
290
- $( 'body' ).on( 'change', '.share-cont-prev input', function() {
291
- var value = $( this ).val(),
292
- id = $( this ).attr( 'id' ),
293
- type,
294
- bWidth = $( '#ssba_border_width' ).val() + 'px',
295
- bColor = $( '#ssba_div_border' ).val(),
296
- target = '.ssba-preview-content';
297
-
298
- if ( 'ssba_div_padding' === id ) {
299
- type = 'padding';
300
-
301
- if ( 50 <= parseInt( value ) ) {
302
- value = value + 'px';
303
- } else {
304
- value = '50px';
305
- }
306
-
307
- target = '#ssba-preview-1';
308
- }
309
-
310
- if ( 'ssba_div_background' === id ) {
311
- type = 'background';
312
- }
313
-
314
- if ( 'ssba_div_border' === id ) {
315
- type = 'border';
316
- value = bWidth + ' solid ' + value;
317
- target = '#ssba-preview-1';
318
- }
319
-
320
- if ( 'ssba_border_width' === id ) {
321
- type = 'border';
322
- value = value + 'px solid ' + bColor;
323
- target = '#ssba-preview-1';
324
- }
325
-
326
- self.classicTextCss( type, value, target );
327
- } );
328
-
329
- // Container radius switch.
330
- $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_div_rounded_corners', function( event, state ) {
331
- var type = 'border-radius',
332
- value = '0';
333
-
334
- if ( state ) {
335
- value = '10px';
336
- }
337
-
338
- self.classicTextCss( type, value, '#ssba-preview-1' );
339
- } )
340
-
341
- // Share count switch.
342
- $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_show_share_count', function( event, state ) {
343
- var type = $( '#ssba_share_count_style option:selected' ).val();
344
-
345
- if ( state ) {
346
- $( '#ssba-preview-1 .ssbp-list li' ).each( function() {
347
- $( this ).find( 'span' ).addClass( 'ssba_sharecount' ).addClass( 'ssba_' + type );
348
- } );
349
- } else {
350
- $( '#ssba-preview-1 .ssbp-list li' ).each( function() {
351
- $( this ).find( 'span' ).removeClass( 'ssba_sharecount' ).removeClass( 'ssba_' + type );
352
- } );
353
- }
354
- } );
355
-
356
- // Share plus count switch.
357
- $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_plus_show_share_count', function( event, state ) {
358
- if ( state ) {
359
- $( '#ssba-preview .ssbp-list li' ).each( function() {
360
- $( this ).find( 'span' ).css( 'display', 'block' );
361
- } );
362
- } else {
363
- $( '#ssba-preview .ssbp-list li' ).each( function() {
364
- $( this ).find( 'span' ).hide();
365
- } );
366
- }
367
- } );
368
-
369
- // Share share bar count switch.
370
- $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_bar_show_share_count', function( event, state ) {
371
- if ( state ) {
372
- $( '#ssba-preview-2 .ssbp-list li' ).each( function() {
373
- $( this ).find( 'span' ).css( 'display', 'block' );
374
- } );
375
- } else {
376
- $( '#ssba-preview-2 .ssbp-list li' ).each( function() {
377
- $( this ).find( 'span' ).hide();
378
- } );
379
- }
380
- } );
381
-
382
- // Share count style.
383
- $( 'body' ).on( 'change', '#ssba_bar_count_style', function() {
384
- var type = $( '#ssba_bar_count_style option:selected' ).val();
385
-
386
- $( '#ssba-preview-1 .ssbp-list li' ).each( function() {
387
- $( this ).find( 'span' ).removeClass( 'ssba_default' ).removeClass( 'ssba_white' ).removeClass( 'ssba_blue' ).addClass( 'ssba_' + type );
388
- } );
389
- } );
390
-
391
- // Swap classic and plus buttons.
392
- $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_new_buttons', function( event, state ) {
393
- self.swapButtons( state );
394
- } );
395
-
396
- // Toggle button menus when arrows are clicked.
397
- $( 'body' ).on( 'click', '.accor-wrap .accor-tab', function() {
398
- var type = $( this ).find( 'span.accor-arrow' );
399
-
400
- self.updateAccors( type.html(), type );
401
- } );
402
-
403
- // Add class to preview when scrolled to.
404
- $( window ).on( 'scroll', function(){
405
- var stickyTop = $( '#ssba-preview-title' ).offset().top,
406
- stickyPlusTop = $( '#ssba-preview-title-2' ).offset().top;
407
-
408
- if ( $( window ).scrollTop() >= stickyTop ) {
409
- $( '.master-ssba-prev-wrap, #ssba-preview-1' ).addClass( 'ssba-sticky' );
410
- } else {
411
- $( '.master-ssba-prev-wrap, #ssba-preview-1' ).removeClass( 'ssba-sticky' );
412
- }
413
-
414
- if ( $( window ).scrollTop() >= stickyPlusTop ) {
415
- $( '.master-ssba-prev-wrap2, #ssba-preview' ).addClass( 'ssba-sticky' );
416
- } else {
417
- $( '.master-ssba-prev-wrap2, #ssba-preview' ).removeClass( 'ssba-sticky' );
418
- }
419
- } );
420
-
421
- // Network selection change.
422
- $( 'body' ).on( 'mouseout', '#ssbasort2, #ssbasort1', function() {
423
- var list = $( '#ssba_selected_buttons' ).val().split( ',' );
424
-
425
- self.updateNetworkPreview( list, '-1', 'img' );
426
- } );
427
-
428
- // Network share selection change.
429
- $( 'body' ).on( 'mouseout', '#ssbasort4, #ssbasort3', function() {
430
- var list = $( '#ssba_selected_bar_buttons' ).val().split( ',' );
431
-
432
- self.updateNetworkPreview( list, '-2', 'div.ssbp-text' );
433
- } );
434
-
435
- // Network plus selection change.
436
- $( 'body' ).on( 'mouseout', '#ssbasort6, #ssbasort5', function() {
437
- var list = $( '#ssba_selected_plus_buttons' ).val().split( ',' );
438
-
439
- self.updateNetworkPreview( list, '', 'div.ssbp-text' );
440
- } );
441
-
442
- // Add id to color picker submit.
443
- $( 'body' ).on( 'focus', '.ssba-colorpicker', function() {
444
- var id = $( this ).attr( 'id' );
445
-
446
- $( '.colpick_submit' ).attr( 'id', id );
447
- } );
448
-
449
- // Dismiss notice.
450
- $( 'body' ).on( 'click', '.ssba-tab-container blockquote .notice-dismiss', function() {
451
- var type = $( this ).attr( 'id' );
452
-
453
- // Save dismiss status to database.
454
- self.dismissNotice( type );
455
- } );
456
-
457
- // Copy text from read only input fields.
458
- $( 'body' ).on( 'click', '#ssba-copy-shortcode', function() {
459
- self.copyText( $( '.ssba-buttons-shortcode' ) );
460
- } );
461
- },
462
-
463
- /**
464
- * Switch for checkboxes.
465
- */
466
- switchCheckboxes: function() {
467
- $( '.ssba-admin-wrap input:checkbox' ).bootstrapSwitch( {
468
- onColor: 'primary',
469
- size: 'normal'
470
- } );
471
- },
472
-
473
- /**
474
- * Color picker.
475
- */
476
- colorPicker: function() {
477
- $( '.ssba-colorpicker' ).colpick( {
478
- layout: 'hex',
479
- submit: 1,
480
- onSubmit: function( hsb, hex, rgb, el, colid ) {
481
- $( el ).val( '#' + hex );
482
- $( el ).css( 'border-color', '#' + hex );
483
- $( el ).colpickHide();
484
- }
485
- } );
486
- },
487
-
488
- /**
489
- * Add drag and sort functions to include table.
490
- */
491
- dragSort: function() {
492
- $( '#ssbasort1, #ssbasort2, #ssbasort3, #ssbasort4, #ssbasort5, #ssbasort6' ).sortable( {
493
- connectWith: '.ssbaSortable'
494
- } ).disableSelection();
495
- },
496
-
497
- /**
498
- * Extract and add include list to hidden field.
499
- */
500
- extractIncludeList: function() {
501
- $( '#ssba_selected_buttons' ).val( $( '#ssbasort2 li' ).map( function() {
502
-
503
- // For each <li> in the list, return its inner text and let .map() build an array of those values.
504
- return $( this ).attr( 'id' );
505
- } ).get() );
506
-
507
- // After a change, extract and add include list to hidden field.
508
- $( '.ssbp-wrap' ).mouseout( function() {
509
- $( '#ssba-preview-1 .ssbp-list' ).html();
510
- $( '#ssba_selected_buttons' ).val( $( '#ssbasort2 li' ).map( function() {
511
-
512
- // For each <li> in the list, return its inner text and let .map()
513
- // build an array of those values.
514
- return $( this ).attr( 'id' );
515
- } ).get() );
516
- } );
517
-
518
- $( '#ssba_selected_bar_buttons' ).val( $( '#ssbasort4 li' ).map( function() {
519
-
520
- // For each <li> in the list, return its inner text and let .map() build an array of those values.
521
- return $( this ).attr( 'id' );
522
- } ).get() );
523
-
524
- // After a change, extract and add include list to hidden field.
525
- $( '.ssbp-wrap' ).mouseout( function() {
526
- $( '#ssba_selected_bar_buttons' ).val( $( '#ssbasort4 li' ).map( function() {
527
-
528
- // For each <li> in the list, return its inner text and let .map()
529
- // build an array of those values.
530
- return $( this ).attr( 'id' );
531
- } ).get() );
532
- } );
533
-
534
- $( '#ssba_selected_plus_buttons' ).val( $( '#ssbasort6 li' ).map( function() {
535
-
536
- // For each <li> in the list, return its inner text and let .map() build an array of those values.
537
- return $( this ).attr( 'id' );
538
- } ).get() );
539
-
540
- // After a change, extract and add include list to hidden field.
541
- $( '.ssbp-wrap' ).mouseout( function() {
542
- $( '#ssba_selected_plus_buttons' ).val( $( '#ssbasort6 li' ).map( function() {
543
-
544
- // For each <li> in the list, return its inner text and let .map()
545
- // build an array of those values.
546
- return $( this ).attr( 'id' );
547
- } ).get() );
548
- } );
549
- },
550
-
551
- /**
552
- * When changing image sets.
553
- *
554
- * @param imageSet
555
- */
556
- changeImageSets: function( imageSet ) {
557
- if ( 'custom' === imageSet ) {
558
- $( '#ssba-custom-images' ).fadeIn( 100 );
559
- } else {
560
- $( '#ssba-custom-images' ).fadeOut( 100 );
561
- }
562
- },
563
-
564
- /**
565
- * Image Uploads
566
- *
567
- * @param field
568
- */
569
- imageUploads: function( field ) {
570
- var custom_uploader = wp.media.frames.file_frame = wp.media({
571
- title: 'Add Image',
572
- button: {
573
- text: 'Add Image'
574
- },
575
- multiple: false
576
- } ),
577
- button,
578
- buttonClass;
579
-
580
- custom_uploader.on( 'select', function() {
581
- var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
582
- $( '#' + field ).val( attachment.url );
583
-
584
- // Update button preview.
585
- button = field.replace( 'ssba_custom_', '' );
586
- buttonClass = '.ssbp-li--' + button;
587
-
588
- $( buttonClass + ' img' ).attr( 'src', attachment.url );
589
- } );
590
- custom_uploader.open();
591
- },
592
-
593
- /**
594
- * SSBA admin form.
595
- *
596
- * @param event
597
- */
598
- adminForm: function( event, submit ) {
599
- var ssbaData = $( '#ssba-admin-form' ).serialize(),
600
- ssba_selected_tab = $( '#ssba_selected_tab' ).val();
601
-
602
- // Show spinner to show save in progress.
603
- $( 'button.ssba-btn-save' ).html( '<i class="fa fa-spinner fa-spin"></i>' );
604
-
605
- // Disable all inputs.
606
- $( ':input' ).prop( 'disabled', true );
607
- $( '.ssba-admin-wrap input:checkbox' ).bootstrapSwitch( 'disabled', true );
608
-
609
- $.post(
610
- $( submit ).prop( 'action' ),
611
- {
612
- ssbaData: ssbaData,
613
- ssba_selected_tab: ssba_selected_tab,
614
- },
615
- function() {
616
-
617
- // Show success.
618
- $( 'button.ssba-btn-save-success' ).fadeIn( 100 ).delay( 2500 ).fadeOut( 200 );
619
-
620
- // Re-enable inputs and reset save button.
621
- $( ':input' ).prop( 'disabled', false );
622
- $( '.ssba-admin-wrap input:checkbox' ).bootstrapSwitch( 'disabled', false );
623
- $( 'button.ssba-btn-save' ).html( '<i class="fa fa-floppy-o"></i>' );
624
- }
625
- ).always( function( response ) {
626
-
627
- // Refresh page.
628
- location.reload();
629
- } ); // End post.
630
- },
631
-
632
- /**
633
- * Update the preview buttons with selected theme.
634
- *
635
- * @param selection
636
- * @param target
637
- */
638
- preview: function( selection, target ) {
639
- var position = $( '#ssba_bar_position option:selected' ).val(),
640
- newClass;
641
-
642
- if ( '#ssba-preview' === target ) {
643
- position = $( '#ssba_plus_align option:selected' ).val();
644
- }
645
-
646
- newClass = 'ssbp-wrap ssbp--theme-' + selection + ' ' + position;
647
-
648
- $( target ).attr( 'class', newClass );
649
- },
650
-
651
- /**
652
- * Update class on share bar preview to switch position.
653
- *
654
- * @param position
655
- */
656
- barPosition: function( position ) {
657
- if ( 'right' === position ) {
658
- $( '#ssba-preview-2' ).removeClass( 'left' );
659
- } else {
660
- $( '#ssba-preview-2' ).removeClass( 'right' );
661
- }
662
-
663
- $( '#ssba-preview-2' ).addClass( position );
664
- },
665
-
666
- /**
667
- * Add message to classic tab when plus buttons are enabled.
668
- *
669
- * @param value
670
- */
671
- swapButtons: function( value ) {
672
- if ( value ) {
673
- $( '#classic-share-buttons blockquote.yellow:first-of-type' ).show();
674
- } else {
675
- $( '#classic-share-buttons blockquote.yellow:first-of-type' ).hide();
676
- }
677
- },
678
-
679
- /**
680
- * Toggle the accordions.
681
- *
682
- * @param type
683
- * @param arrow
684
- */
685
- updateAccors: function( type, arrow ) {
686
- var closestButton = $( arrow ).parent( '.accor-tab' ).parent( '.accor-wrap' );
687
-
688
- if ( '►' === type ) {
689
-
690
- // Show the button configs.
691
- closestButton.find( '.accor-content' ).slideDown();
692
-
693
- // Change the icon next to title.
694
- closestButton.find( '.accor-arrow' ).html( '&#9660;' );
695
- } else {
696
-
697
- // Show the button configs.
698
- closestButton.find( '.accor-content' ).slideUp();
699
-
700
- // Change the icon next to title.
701
- closestButton.find( '.accor-arrow' ).html( '&#9658;' );
702
- }
703
- },
704
-
705
- /**
706
- * Change classic preview css.
707
- *
708
- * @param style
709
- * @param value
710
- * @param target
711
- * @param button
712
- */
713
- classicCss: function( style, value, target, button ) {
714
- var lineHeight,
715
- width;
716
-
717
- if ( 'li' === target ) {
718
- $( '#ssba-preview' + button + ' .ssbp-list li' ).each( function () {
719
- $( this ).find( 'img' ).css( style, value );
720
-
721
- if ( 'height' === style ) {
722
- lineHeight = parseInt( $( '#ssba_padding' ).val() ) + parseInt( value ) + 3 + 'px';
723
-
724
- $( '#ssba-preview' + button + ' .ssba-share-text-prev' ).css( 'line-height', lineHeight );
725
- $( '#ssba-preview' + button + ' ul li img' ).css( 'line-height', lineHeight );
726
- }
727
-
728
- if ( 'padding' === style ) {
729
- width = parseInt( $( '#ssba_size' ).val() ) + parseInt( value ) + 3 + 'px';
730
-
731
- $( '#ssba-preview' + button + ' .ssba-share-text-prev' ).css( 'line-height', lineHeight );
732
- $( '#ssba-preview' + button + ' ul li img' ).css( 'line-height', lineHeight );
733
- }
734
- } );
735
- }
736
-
737
- if ( 'ul' === target ) {
738
- $( '#ssba-preview' + button ).css( style, value );
739
- }
740
- },
741
-
742
- /**
743
- * Change images used in classic preview.
744
- *
745
- * @param selection
746
- * @param target
747
- * @param button
748
- * @param find
749
- */
750
- classicPreview: function( selection, target, button, find, type ) {
751
- var title,
752
- imgSrc,
753
- height = $( '#ssba_' + type + '_height' ).val(),
754
- margin = $( '#ssba_plus_margin' ).val(),
755
- placement = $( '#ssba_plus_text_placement option:selected' ).val(),
756
- lineHeight,
757
- self = this;
758
-
759
- if ( '' === height ) {
760
- height = 48;
761
- }
762
-
763
- if ( '' === margin ) {
764
- margin = 0;
765
- }
766
-
767
- lineHeight = parseInt( height ) + parseInt( margin ) * 2;
768
-
769
- if ( ( 'height' === target || 'margin' === target ) && ( '' === button || '-1' === button ) && ( 'above' !== placement && 'below' !== placement ) ) {
770
- $( '#ssba-preview' + button + ' .ssba-share-text-prev' ).css( 'line-height', lineHeight + 'px' );
771
- $( '#ssba-preview' + button + ' ul li img' ).css( 'line-height', lineHeight + 'px' );
772
- }
773
-
774
- if ( 'height' === target && 'share' === type ) {
775
- self.updateInlineStyle();
776
- }
777
-
778
- $( '#ssba-preview' + button + ' .ssbp-list li' ).each( function() {
779
- if ( '' === target ) {
780
- title = $( this ).find( find ).attr( 'title' ).toLowerCase();
781
- imgSrc = self.data.site + selection + '/' + title.replace( /[^a-zA-Z 0-9]+/g, '' ).replace( ' ', '_' ) + '.png';
782
-
783
- if ( 'custom' !== selection ) {
784
- $( this ).find( find ).attr( 'src', imgSrc );
785
- } else {
786
- $( this ).find( find ).attr( 'src', '' );
787
- }
788
- }
789
-
790
- if ( '' !== find ) {
791
- $( this ).find( find ).css( target, selection );
792
- } else {
793
- $( this ).css( target, selection );
794
- }
795
- } );
796
- },
797
-
798
- /**
799
- * Update the share text styling.
800
- *
801
- * @param type
802
- * @param value
803
- * @param target
804
- */
805
- classicTextCss: function( type, value, target ) {
806
- var height = $( '#ssba_plus_height' ).val(),
807
- margin = $( '#ssba_plus_margin' ).val(),
808
- cheight = $( '#ssba_size' ).val(),
809
- cmargin = $( '#ssba_padding' ).val() * 2,
810
- lineHeight,
811
- clineHeight;
812
-
813
- if ( '' === height || '' === cheight ) {
814
- height = 48;
815
- cheight = 48;
816
- }
817
-
818
- if ( '' === margin || '' === cmargin ) {
819
- margin = 0;
820
- cmargin = 0;
821
- }
822
-
823
- lineHeight = parseInt( height ) + parseInt( margin ) * 2;
824
- clineHeight = parseInt( cheight ) + parseInt( cmargin );
825
-
826
- if ( 'float' === type ) {
827
- $( '#ssba-preview-1 .ssba-share-text-prev' ).css( 'line-height', clineHeight + 'px' );
828
- $( '#ssba-preview-1 ul li img' ).css( 'line-height', clineHeight + 'px' );
829
- }
830
-
831
- if ( 'html' !== type && 'placement' !== type ) {
832
- $( target ).css( type, value );
833
- }
834
-
835
- if ( 'html' === type ) {
836
- $( target ).html( value );
837
- }
838
-
839
- if ( 'placement' === type && 'above' === value ) {
840
- $( target ).css( { 'float' : 'none', 'display' : 'inline' } );
841
- $( '.ssba-share-text-prev' ).css( 'line-height', 'inherit' );
842
- }
843
-
844
- if ( 'placement' === type && 'below' === value ) {
845
- $( target ).css( { 'display' : 'table-footer-group', 'float' : 'none' } );
846
- $( '.ssba-share-text-prev' ).css( 'line-height', 'inherit' );
847
- }
848
- },
849
-
850
- /**
851
- * Update the networks in the preview with new list.
852
- *
853
- * @param list
854
- * @param number
855
- * @param type
856
- */
857
- updateNetworkPreview: function( list, number, type ) {
858
- $( '#ssba-preview' + number + ' .ssbp-list li' ).addClass( 'ssba-hide-button' );
859
- $.each( list, function( index, id ) {
860
- $( '#ssba-preview' + number + ' .ssbp-list li' ).each( function() {
861
- var newid = $( this ).find( type ).attr( 'title' ).toLowerCase().replace( '+', '' ).replace( ' ', '_' );
862
-
863
- if ( id === newid ) {
864
- $( this ).removeClass( 'ssba-hide-button' );
865
- }
866
- } );
867
- } );
868
- },
869
-
870
- /**
871
- * Update style for non DOM styles.
872
- */
873
- updateInlineStyle: function() {
874
- var iconSize = $( '#ssba_plus_icon_size' ).val(),
875
- iconLineHeight = $( '#ssba_plus_height' ).val(),
876
- iconColor = $( '#ssba_plus_icon_color' ).val(),
877
- iconColorHover = $( '#ssba_plus_icon_hover_color' ).val(),
878
- buttonColorHover = $( '#ssba_plus_button_hover_color' ).val(),
879
- iconSizeBar = $( '#ssba_bar_icon_size' ).val(),
880
- iconLineHeightBar = $( '#ssba_bar_height' ).val(),
881
- iconColorBar = $( '#ssba_bar_icon_color' ).val(),
882
- iconColorHoverBar = $( '#ssba_bar_icon_hover_color' ).val(),
883
- buttonColorHoverBar = $( '#ssba_bar_button_hover_color' ).val(),
884
- newStyle = '#ssba-preview .ssbp-li--facebook_save { line-height: ' + iconLineHeight + 'px; } #ssba-preview .ssbp-btn:before{ font-size: ' + iconSize + 'px; line-height: ' + iconLineHeight + 'px; color: ' + iconColor + '; } #ssba-preview .ssbp-btn:hover::before { color: ' + iconColorHover + '; } #ssba-preview .ssbp-btn:hover { background: ' + buttonColorHover + '!important; } #ssba-preview-2 .ssbp-btn:before{ font-size: ' + iconSizeBar + 'px; line-height: ' + iconLineHeightBar + 'px; color: ' + iconColorBar + '; } #ssba-preview-2 .ssbp-btn:hover::before { color: ' + iconColorHoverBar + '; } #ssba-preview-2 .ssbp-btn:hover { background: ' + buttonColorHoverBar + '!important; }';
885
-
886
- $( '#simple-share-buttons-adder-styles-inline-css' ).html( newStyle );
887
- },
888
-
889
- /**
890
- * Add dismiss status to blockquote notices.
891
- *
892
- * @param type
893
- */
894
- dismissNotice: function( type ){
895
-
896
- // Send newsletter id to the test function.
897
- wp.ajax.post( 'dismiss_notice', {
898
- type: type,
899
- nonce: this.data.nonce
900
- } ).always( function(response) {
901
-
902
- // Hide notice.
903
- $( '#' + type ).closest( 'blockquote' ).hide();
904
- } );
905
- },
906
-
907
- /**
908
- * Copy text to clipboard
909
- *
910
- * @param copiedText
911
- */
912
- copyText: function( copiedText ) {
913
- copiedText.select();
914
- document.execCommand( 'copy' );
915
- }
916
- };
917
  } )( window.jQuery, window.wp );
6
 
7
  /* exported SimpleShareButtonsAdder */
8
  var SimpleShareButtonsAdder = ( function( $, wp ) {
9
+ 'use strict';
10
+
11
+ return {
12
+ /**
13
+ * Holds data.
14
+ */
15
+ data: {},
16
+
17
+ /**
18
+ * Boot plugin.
19
+ *
20
+ * @param data
21
+ */
22
+ boot: function( data ) {
23
+ this.data = data;
24
+
25
+ $( document ).ready( function() {
26
+ this.init();
27
+ }.bind( this ) );
28
+ },
29
+
30
+ /**
31
+ * Initialize plugin.
32
+ */
33
+ init: function() {
34
+ this.$plusContainer = $( '#plus-share-buttons' );
35
+ this.$shareContainer = $( '#share-bar' );
36
+ this.$gdprContainer = $('.gdpr-platform');
37
+ this.switchCheckboxes();
38
+ this.colorPicker();
39
+ $('[data-toggle="tooltip"]').tooltip();
40
+ this.dragSort();
41
+ this.extractIncludeList();
42
+ this.listen();
43
+
44
+ // Create admin style to fill.
45
+ $( 'body.wp-admin' ).siblings( 'head' ).append( '<style type="text/css" id="simple-share-buttons-adder-styles-inline-css"></style>' );
46
+
47
+ // Fill it.
48
+ this.updateInlineStyle();
49
+
50
+ // Set GDPR purposes.
51
+ this.setPurposes($('.gdpr-config').is(':visible'));
52
+ },
53
+
54
+ /**
55
+ * Listener events.
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() {
79
+ $('#sharethis-form-color .color').removeClass('selected');
80
+ $(this).addClass('selected');
81
+ });
82
+
83
+ // clear or show choices.
84
+ this.$gdprContainer.on('click', '#clear-choices', function(e) {
85
+ e.preventDefault();
86
+ e.stopPropagation();
87
+
88
+ $( '.purpose-item input' ).prop( 'checked', false );
89
+ });
90
+
91
+ // clear or show choices.
92
+ this.$gdprContainer.on('click', '#see-st-choices', function(e) {
93
+ e.preventDefault();
94
+ e.stopPropagation();
95
+ $('.purpose-item input[name="purposes[1]"]').prop('checked', true);
96
+ $('.purpose-item input[name="purposes[3]"][value="consent"]').prop('checked', true);
97
+ $('.purpose-item input[name="purposes[5]"][value="consent"]').prop('checked', true);
98
+ $('.purpose-item input[name="purposes[6]"][value="consent"]').prop('checked', true);
99
+ $('.purpose-item input[name="purposes[9]"][value="legitimate"]').prop('checked', true);
100
+ $('.purpose-item input[name="purposes[10]"][value="legitimate"]').prop('checked', true);
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
+ }
115
+ } );
116
 
117
  // Close review us.
118
  $('body').on('click', '#close-review-us', function() {
123
  });
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') ) {
131
+ selection = 'modern';
132
+ }
133
+
134
+ if ( $( this ).hasClass( 'ssba-bar-tab') ) {
135
+ selection = 'bar';
136
+ }
137
 
138
+ if ( $( this ).hasClass( 'ssba-gdpr') ) {
139
+ selection = 'gdpr';
140
+ }
141
 
142
+ $( '#ssba_selected_tab' ).val( selection );
143
+ } );
 
144
 
145
+ // When changing image sets.
146
+ $( 'body' ).on( 'change', '#ssba_image_set', function() {
147
+ var imageSet = $( this ).val();
148
 
149
+ self.changeImageSets( imageSet );
150
+ } );
 
151
 
152
+ // Image uploads.
153
+ $( 'body' ).on( 'click', '.ssbpUpload', function( event ) {
154
+ var field = $( this ).attr( 'data-ssbp-input' );
155
 
156
+ event.preventDefault();
157
+ self.imageUploads( field );
158
+ } );
159
 
160
+ // SSBA admin form.
161
+ $( 'body' ).on( 'click', '#submit', function( event ) {
162
+ event.preventDefault();
163
 
164
+ self.adminForm( event, this );
165
+ } );
 
166
 
167
+ // Select preview.
168
+ $( 'body' ).on( 'change', '#ssba_plus_button_style, #ssba_bar_style', function() {
169
+ var selectId = '#' + $( this ).attr( 'id' ),
170
+ selection = $( selectId + ' option:selected' ).val(),
171
+ target = '#ssba-preview-2';
172
 
173
+ if ( '#ssba_plus_button_style' === selectId ) {
174
+ target = '#ssba-preview';
175
+ }
176
+
177
+ self.preview( selection, target );
178
+ } );
179
+
180
+ // Share bar preview position.
181
+ $( 'body' ).on( 'change', '#ssba_bar_position', function() {
182
+ var position = $( '#ssba_bar_position option:selected' ).val();
183
+
184
+ self.barPosition( position );
185
+ } );
186
+
187
+ // Classic button preview.
188
+ $( 'body' ).on( 'change', '#ssba_image_set', function() {
189
+ var selection = $( '#ssba_image_set option:selected' ).val();
190
+
191
+ self.classicPreview( selection, '', '-1', 'img' );
192
+ } );
193
+
194
+ this.$plusContainer.on( 'change', '#ssba_plus_height, #ssba_plus_width, #ssba_plus_icon_size, #ssba_plus_margin', function() {
195
+ var id = $( this ).attr( 'id' ),
196
+ selection = $( this ).val(),
197
+ type;
198
+
199
+ if ( 'ssba_plus_height' === id ) {
200
+ type = 'height';
201
+ find = 'a';
202
+
203
+ self.updateInlineStyle();
204
+ }
205
+
206
+ if ( 'ssba_plus_width' === id ) {
207
+ type = 'width';
208
+ find = 'a';
209
+ }
210
+
211
+ if ( 'ssba_plus_icon_size' === id ) {
212
+ type = 'font-size';
213
+ find = 'a:before';
214
+ selection = selection + 'px';
215
+
216
+ self.updateInlineStyle();
217
+ }
218
+
219
+ if ( 'ssba_plus_margin' === id ) {
220
+ type = 'margin';
221
+ find = '';
222
+ selection = selection + 'px';
223
+ }
224
+
225
+ self.classicPreview( selection, type, '', find );
226
+ } );
227
+
228
+ this.$shareContainer.on( 'change', '#ssba_bar_height, #ssba_bar_width, #ssba_bar_icon_size, #ssba_bar_margin', function() {
229
+ var id = $( this ).attr( 'id' ),
230
+ selection = $( this ).val(),
231
+ type;
232
+
233
+ if ( 'ssba_bar_height' === id ) {
234
+ type = 'height';
235
+ find = 'a';
236
+
237
+ self.updateInlineStyle();
238
+ }
239
+
240
+ if ( 'ssba_bar_width' === id ) {
241
+ type = 'width';
242
+ find = 'a';
243
+ }
244
+
245
+ if ( 'ssba_bar_icon_size' === id ) {
246
+ type = 'font-size';
247
+ find = 'a:before';
248
+ selection = selection + 'px';
249
+
250
+ self.updateInlineStyle();
251
+ }
252
+
253
+ if ( 'ssba_bar_margin' === id ) {
254
+ type = 'margin';
255
+ find = '';
256
+ selection = selection + 'px';
257
+ }
258
+
259
+ self.classicPreview( selection, type, '-2', find );
260
+ } );
261
+
262
+ // Classic button css preview.
263
+ $( 'body' ).on( 'change', '#ssba_size, #ssba_padding, #ssba_align', function() {
264
+ var value = $( this ).val(),
265
+ id = $( this ).attr( 'id' ),
266
+ type = 'padding',
267
+ target = 'li';
268
+
269
+ if ( 'ssba_size' === id ) {
270
+ type = 'height';
271
+ }
272
+
273
+ if ( 'ssba_align' === id ) {
274
+ target = 'ul';
275
+ type = 'text-align';
276
+ }
277
+
278
+ self.classicCss( type, value, target, '-1' );
279
+ } );
280
+
281
+ $( 'body' ).on( 'keydown keyup', '#ssba_padding', function( e ){
282
+ if ( $( this ).val() > 50
283
+ && e.keyCode !== 46 // delete
284
+ && e.keyCode !== 8 // backspace
285
+ ) {
286
+ e.preventDefault();
287
+ $( this ).val(50);
288
+ }
289
+ });
290
 
291
+ // Plus button css preview.
292
+ this.$plusContainer.on( 'change', '#ssba_plus_align', function() {
293
+ var value = $( this ).val(),
294
+ id = $( this ).attr( 'id' ),
295
+ type,
296
+ target = '';
297
+
298
+ if ( 'ssba_plus_align' === id ) {
299
+ target = 'ul';
300
+ type = 'text-align';
301
+ }
302
+
303
+ self.classicCss( type, value, target, '' );
304
+ } );
305
+
306
+ // Update icon and other non DOM style preview.
307
+ this.$plusContainer.on( 'change', '#ssba_plus_icon_size', function() {
308
+ self.updateInlineStyle();
309
+ } );
310
+
311
+ // Class button bar text css preview.
312
+ $( 'body' ).on( 'change', '.share-text-prev input, .share-text-prev select', function() {
313
+ var value = $( this ).val(),
314
+ id = $( this ).attr( 'id' ),
315
+ type,
316
+ sel_value = $( '#' + id + ' option:selected' ).val(),
317
+ tab = $( this ).closest( '.tab-pane' ).attr( 'id' );
318
+
319
+ if ( 'ssba_share_text' === id || 'ssba_plus_share_text' === id ) {
320
+ type = 'html';
321
+ }
322
+
323
+ if ( 'ssba_font_color' === id || 'ssba_plus_font_color' === id ) {
324
+ type = 'color';
325
+ }
326
+
327
+ if ( 'ssba_font_family' === id || 'ssba_plus_font_family' === id ) {
328
+ type = 'font-family';
329
+ value = sel_value;
330
+ }
331
+
332
+ if ( 'ssba_font_size' === id || 'ssba_plus_font_size' === id ) {
333
+ type = 'font-size';
334
+ value = value + 'px';
335
+ }
336
+
337
+ if ( 'ssba_font_weight' === id || 'ssba_plus_font_weight' === id ) {
338
+ type = 'font-weight';
339
+ value = sel_value;
340
+ }
341
+
342
+ if ( ( 'ssba_text_placement' === id || 'ssba_plus_text_placement' === id ) && 'above' !== value && 'below' !== value ) {
343
+ type = 'float';
344
+ value = sel_value;
345
+ }
346
+
347
+ if ( ( 'ssba_text_placement' === id || 'ssba_plus_text_placement' === id ) && ( 'above' === value || 'below' === value ) ) {
348
+ type = 'placement';
349
+ }
350
+
351
+ self.classicTextCss( type, value, '#' + tab + ' .ssba-share-text-prev' );
352
+ } );
353
+
354
+ // Class button share text css preview.
355
+ $( 'body' ).on( 'change', '.share-cont-prev input', function() {
356
+ var value = $( this ).val(),
357
+ id = $( this ).attr( 'id' ),
358
+ type,
359
+ bWidth = $( '#ssba_border_width' ).val() + 'px',
360
+ bColor = $( '#ssba_div_border' ).val(),
361
+ target = '.ssba-preview-content';
362
+
363
+ if ( 'ssba_div_padding' === id ) {
364
+ type = 'padding';
365
+
366
+ if ( 50 <= parseInt( value ) ) {
367
+ value = value + 'px';
368
+ } else {
369
+ value = '50px';
370
+ }
371
+
372
+ target = '#ssba-preview-1';
373
+ }
374
+
375
+ if ( 'ssba_div_background' === id ) {
376
+ type = 'background';
377
+ }
378
+
379
+ if ( 'ssba_div_border' === id ) {
380
+ type = 'border';
381
+ value = bWidth + ' solid ' + value;
382
+ target = '#ssba-preview-1';
383
+ }
384
+
385
+ if ( 'ssba_border_width' === id ) {
386
+ type = 'border';
387
+ value = value + 'px solid ' + bColor;
388
+ target = '#ssba-preview-1';
389
+ }
390
+
391
+ self.classicTextCss( type, value, target );
392
+ } );
393
+
394
+ // Container radius switch.
395
+ $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_div_rounded_corners', function( event, state ) {
396
+ var type = 'border-radius',
397
+ value = '0';
398
+
399
+ if ( state ) {
400
+ value = '10px';
401
+ }
402
+
403
+ self.classicTextCss( type, value, '#ssba-preview-1' );
404
+ } )
405
+
406
+ // Share count switch.
407
+ $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_show_share_count', function( event, state ) {
408
+ var type = $( '#ssba_share_count_style option:selected' ).val();
409
+
410
+ if ( state ) {
411
+ $( '#ssba-preview-1 .ssbp-list li' ).each( function() {
412
+ $( this ).find( 'span' ).addClass( 'ssba_sharecount' ).addClass( 'ssba_' + type );
413
+ } );
414
+ } else {
415
+ $( '#ssba-preview-1 .ssbp-list li' ).each( function() {
416
+ $( this ).find( 'span' ).removeClass( 'ssba_sharecount' ).removeClass( 'ssba_' + type );
417
+ } );
418
+ }
419
+ } );
420
+
421
+ // Share plus count switch.
422
+ $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_plus_show_share_count', function( event, state ) {
423
+ if ( state ) {
424
+ $( '#ssba-preview .ssbp-list li' ).each( function() {
425
+ $( this ).find( 'span' ).css( 'display', 'block' );
426
+ } );
427
+ } else {
428
+ $( '#ssba-preview .ssbp-list li' ).each( function() {
429
+ $( this ).find( 'span' ).hide();
430
+ } );
431
+ }
432
+ } );
433
+
434
+ // Share share bar count switch.
435
+ $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_bar_show_share_count', function( event, state ) {
436
+ if ( state ) {
437
+ $( '#ssba-preview-2 .ssbp-list li' ).each( function() {
438
+ $( this ).find( 'span' ).css( 'display', 'block' );
439
+ } );
440
+ } else {
441
+ $( '#ssba-preview-2 .ssbp-list li' ).each( function() {
442
+ $( this ).find( 'span' ).hide();
443
+ } );
444
+ }
445
+ } );
446
+
447
+ // Share count style.
448
+ $( 'body' ).on( 'change', '#ssba_bar_count_style', function() {
449
+ var type = $( '#ssba_bar_count_style option:selected' ).val();
450
+
451
+ $( '#ssba-preview-1 .ssbp-list li' ).each( function() {
452
+ $( this ).find( 'span' ).removeClass( 'ssba_default' ).removeClass( 'ssba_white' ).removeClass( 'ssba_blue' ).addClass( 'ssba_' + type );
453
+ } );
454
+ } );
455
+
456
+ // Swap classic and plus buttons.
457
+ $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_new_buttons', function( event, state ) {
458
+ self.swapButtons( state );
459
+ } );
460
+
461
+ // Toggle button menus when arrows are clicked.
462
+ $( 'body' ).on( 'click', '.accor-wrap .accor-tab', function() {
463
+ var type = $( this ).find( 'span.accor-arrow' );
464
+
465
+ self.updateAccors( type.html(), type );
466
+ } );
467
+
468
+ // Add class to preview when scrolled to.
469
+ $( window ).on( 'scroll', function(){
470
+ var stickyTop = $( '#ssba-preview-title' ).offset().top,
471
+ stickyPlusTop = $( '#ssba-preview-title-2' ).offset().top;
472
+
473
+ if ( $( window ).scrollTop() >= stickyTop ) {
474
+ $( '.master-ssba-prev-wrap, #ssba-preview-1' ).addClass( 'ssba-sticky' );
475
+ } else {
476
+ $( '.master-ssba-prev-wrap, #ssba-preview-1' ).removeClass( 'ssba-sticky' );
477
+ }
478
+
479
+ if ( $( window ).scrollTop() >= stickyPlusTop ) {
480
+ $( '.master-ssba-prev-wrap2, #ssba-preview' ).addClass( 'ssba-sticky' );
481
+ } else {
482
+ $( '.master-ssba-prev-wrap2, #ssba-preview' ).removeClass( 'ssba-sticky' );
483
+ }
484
+ } );
485
+
486
+ // Network selection change.
487
+ $( 'body' ).on( 'mouseout', '#ssbasort2, #ssbasort1', function() {
488
+ var list = $( '#ssba_selected_buttons' ).val().split( ',' );
489
+
490
+ self.updateNetworkPreview( list, '-1', 'img' );
491
+ } );
492
+
493
+ // Network share selection change.
494
+ $( 'body' ).on( 'mouseout', '#ssbasort4, #ssbasort3', function() {
495
+ var list = $( '#ssba_selected_bar_buttons' ).val().split( ',' );
496
+
497
+ self.updateNetworkPreview( list, '-2', 'div.ssbp-text' );
498
+ } );
499
+
500
+ // Network plus selection change.
501
+ $( 'body' ).on( 'mouseout', '#ssbasort6, #ssbasort5', function() {
502
+ var list = $( '#ssba_selected_plus_buttons' ).val().split( ',' );
503
+
504
+ self.updateNetworkPreview( list, '', 'div.ssbp-text' );
505
+ } );
506
+
507
+ // Add id to color picker submit.
508
+ $( 'body' ).on( 'focus', '.ssba-colorpicker', function() {
509
+ var id = $( this ).attr( 'id' );
510
+
511
+ $( '.colpick_submit' ).attr( 'id', id );
512
+ } );
513
+
514
+ // Dismiss notice.
515
+ $( 'body' ).on( 'click', '.ssba-tab-container blockquote .notice-dismiss', function() {
516
+ var type = $( this ).attr( 'id' );
517
+
518
+ // Save dismiss status to database.
519
+ self.dismissNotice( type );
520
+ } );
521
+
522
+ // Copy text from read only input fields.
523
+ $( 'body' ).on( 'click', '#ssba-copy-shortcode', function() {
524
+ self.copyText( $( '.ssba-buttons-shortcode' ) );
525
+ } );
526
+ },
527
+
528
+ /**
529
+ * Switch for checkboxes.
530
+ */
531
+ switchCheckboxes: function() {
532
+ $('.ssba-admin-wrap input:checkbox').bootstrapSwitch( {
533
+ onColor: 'primary',
534
+ size: 'normal'
535
+ } );
536
+ },
537
+
538
+ /**
539
+ * Color picker.
540
+ */
541
+ colorPicker: function() {
542
+ $( '.ssba-colorpicker' ).colpick( {
543
+ layout: 'hex',
544
+ submit: 1,
545
+ onSubmit: function( hsb, hex, rgb, el, colid ) {
546
+ $( el ).val( '#' + hex );
547
+ $( el ).css( 'border-color', '#' + hex );
548
+ $( el ).colpickHide();
549
+ }
550
+ } );
551
+ },
552
+
553
+ /**
554
+ * Add drag and sort functions to include table.
555
+ */
556
+ dragSort: function() {
557
+ $( '#ssbasort1, #ssbasort2, #ssbasort3, #ssbasort4, #ssbasort5, #ssbasort6' ).sortable( {
558
+ connectWith: '.ssbaSortable'
559
+ } ).disableSelection();
560
+ },
561
+
562
+ /**
563
+ * Extract and add include list to hidden field.
564
+ */
565
+ extractIncludeList: function() {
566
+ $( '#ssba_selected_buttons' ).val( $( '#ssbasort2 li' ).map( function() {
567
+
568
+ // For each <li> in the list, return its inner text and let .map() build an array of those values.
569
+ return $( this ).attr( 'id' );
570
+ } ).get() );
571
+
572
+ // After a change, extract and add include list to hidden field.
573
+ $( '.ssbp-wrap' ).mouseout( function() {
574
+ $( '#ssba-preview-1 .ssbp-list' ).html();
575
+ $( '#ssba_selected_buttons' ).val( $( '#ssbasort2 li' ).map( function() {
576
+
577
+ // For each <li> in the list, return its inner text and let .map()
578
+ // build an array of those values.
579
+ return $( this ).attr( 'id' );
580
+ } ).get() );
581
+ } );
582
+
583
+ $( '#ssba_selected_bar_buttons' ).val( $( '#ssbasort4 li' ).map( function() {
584
+
585
+ // For each <li> in the list, return its inner text and let .map() build an array of those values.
586
+ return $( this ).attr( 'id' );
587
+ } ).get() );
588
+
589
+ // After a change, extract and add include list to hidden field.
590
+ $( '.ssbp-wrap' ).mouseout( function() {
591
+ $( '#ssba_selected_bar_buttons' ).val( $( '#ssbasort4 li' ).map( function() {
592
+
593
+ // For each <li> in the list, return its inner text and let .map()
594
+ // build an array of those values.
595
+ return $( this ).attr( 'id' );
596
+ } ).get() );
597
+ } );
598
+
599
+ $( '#ssba_selected_plus_buttons' ).val( $( '#ssbasort6 li' ).map( function() {
600
+
601
+ // For each <li> in the list, return its inner text and let .map() build an array of those values.
602
+ return $( this ).attr( 'id' );
603
+ } ).get() );
604
+
605
+ // After a change, extract and add include list to hidden field.
606
+ $( '.ssbp-wrap' ).mouseout( function() {
607
+ $( '#ssba_selected_plus_buttons' ).val( $( '#ssbasort6 li' ).map( function() {
608
+
609
+ // For each <li> in the list, return its inner text and let .map()
610
+ // build an array of those values.
611
+ return $( this ).attr( 'id' );
612
+ } ).get() );
613
+ } );
614
+ },
615
+
616
+ /**
617
+ * When changing image sets.
618
+ *
619
+ * @param imageSet
620
+ */
621
+ changeImageSets: function( imageSet ) {
622
+ if ( 'custom' === imageSet ) {
623
+ $( '#ssba-custom-images' ).fadeIn( 100 );
624
+ } else {
625
+ $( '#ssba-custom-images' ).fadeOut( 100 );
626
+ }
627
+ },
628
+
629
+ /**
630
+ * Image Uploads
631
+ *
632
+ * @param field
633
+ */
634
+ imageUploads: function( field ) {
635
+ var custom_uploader = wp.media.frames.file_frame = wp.media({
636
+ title: 'Add Image',
637
+ button: {
638
+ text: 'Add Image'
639
+ },
640
+ multiple: false
641
+ } ),
642
+ button,
643
+ buttonClass;
644
+
645
+ custom_uploader.on( 'select', function() {
646
+ var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
647
+ $( '#' + field ).val( attachment.url );
648
+
649
+ // Update button preview.
650
+ button = field.replace( 'ssba_custom_', '' );
651
+ buttonClass = '.ssbp-li--' + button;
652
+
653
+ $( buttonClass + ' img' ).attr( 'src', attachment.url );
654
+ } );
655
+ custom_uploader.open();
656
+ },
657
+
658
+ /**
659
+ * SSBA admin form.
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();
668
+
669
+ // Show spinner to show save in progress.
670
+ $('button.ssba-btn-save').html('<i class="fa fa-spinner fa-spin"></i>');
671
+
672
+ // Disable all inputs.
673
+ $( ':input' ).prop( 'disabled', true );
674
+ $( '.ssba-admin-wrap input:checkbox' ).bootstrapSwitch( 'disabled', true );
675
+
676
+ var theData = {
677
+ ssbaData: ssbaData,
678
+ ssba_selected_tab: ssba_selected_tab,
679
+ gdpr_config: gdpr_config
680
+ };
681
+
682
+ if (undefined !== this.data.token && '' !== this.data.token) {
683
+
684
+ // Update st config.
685
+ $.ajax({
686
+ url: 'https://platform-api.sharethis.com/v1.0/property/product',
687
+ method: 'POST',
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
695
+ })
696
+ });
697
+ }
698
+
699
+ $.post(
700
+ $( submit ).prop( 'action' ),
701
+ theData,
702
+ function() {
703
+
704
+ // Show success.
705
+ $( 'button.ssba-btn-save-success' ).fadeIn( 100 ).delay( 2500 ).fadeOut( 200 );
706
+
707
+ // Re-enable inputs and reset save button.
708
+ $( ':input' ).prop( 'disabled', false );
709
+ $( '.ssba-admin-wrap input:checkbox' ).bootstrapSwitch( 'disabled', false );
710
+ $( 'button.ssba-btn-save' ).html( '<i class="fa fa-floppy-o"></i>' );
711
+ }
712
+ ).always( function( response ) {
713
+
714
+ // Refresh page.
715
+ location.reload();
716
+ } ); // End post.
717
+ },
718
+
719
+ /**
720
+ * Update the preview buttons with selected theme.
721
+ *
722
+ * @param selection
723
+ * @param target
724
+ */
725
+ preview: function( selection, target ) {
726
+ var position = $( '#ssba_bar_position option:selected' ).val(),
727
+ newClass;
728
+
729
+ if ( '#ssba-preview' === target ) {
730
+ position = $( '#ssba_plus_align option:selected' ).val();
731
+ }
732
+
733
+ newClass = 'ssbp-wrap ssbp--theme-' + selection + ' ' + position;
734
+
735
+ $( target ).attr( 'class', newClass );
736
+ },
737
+
738
+ /**
739
+ * Update class on share bar preview to switch position.
740
+ *
741
+ * @param position
742
+ */
743
+ barPosition: function( position ) {
744
+ if ( 'right' === position ) {
745
+ $( '#ssba-preview-2' ).removeClass( 'left' );
746
+ } else {
747
+ $( '#ssba-preview-2' ).removeClass( 'right' );
748
+ }
749
+
750
+ $( '#ssba-preview-2' ).addClass( position );
751
+ },
752
+
753
+ /**
754
+ * Add message to classic tab when plus buttons are enabled.
755
+ *
756
+ * @param value
757
+ */
758
+ swapButtons: function( value ) {
759
+ if ( value ) {
760
+ $( '#classic-share-buttons blockquote.yellow:first-of-type' ).show();
761
+ } else {
762
+ $( '#classic-share-buttons blockquote.yellow:first-of-type' ).hide();
763
+ }
764
+ },
765
+
766
+ /**
767
+ * Toggle the accordions.
768
+ *
769
+ * @param type
770
+ * @param arrow
771
+ */
772
+ updateAccors: function( type, arrow ) {
773
+ var closestButton = $( arrow ).parent( '.accor-tab' ).parent( '.accor-wrap' );
774
+
775
+ if ( '►' === type ) {
776
+
777
+ // Show the button configs.
778
+ closestButton.find( '.accor-content' ).slideDown();
779
+
780
+ // Change the icon next to title.
781
+ closestButton.find( '.accor-arrow' ).html( '&#9660;' );
782
+ } else {
783
+
784
+ // Show the button configs.
785
+ closestButton.find( '.accor-content' ).slideUp();
786
+
787
+ // Change the icon next to title.
788
+ closestButton.find( '.accor-arrow' ).html( '&#9658;' );
789
+ }
790
+ },
791
+
792
+ /**
793
+ * Change classic preview css.
794
+ *
795
+ * @param style
796
+ * @param value
797
+ * @param target
798
+ * @param button
799
+ */
800
+ classicCss: function( style, value, target, button ) {
801
+ var lineHeight,
802
+ width;
803
+
804
+ if ( 'li' === target ) {
805
+ $( '#ssba-preview' + button + ' .ssbp-list li' ).each( function () {
806
+ $( this ).find( 'img' ).css( style, value );
807
+
808
+ if ( 'height' === style ) {
809
+ lineHeight = parseInt( $( '#ssba_padding' ).val() ) + parseInt( value ) + 3 + 'px';
810
+
811
+ $( '#ssba-preview' + button + ' .ssba-share-text-prev' ).css( 'line-height', lineHeight );
812
+ $( '#ssba-preview' + button + ' ul li img' ).css( 'line-height', lineHeight );
813
+ }
814
+
815
+ if ( 'padding' === style ) {
816
+ width = parseInt( $( '#ssba_size' ).val() ) + parseInt( value ) + 3 + 'px';
817
+
818
+ $( '#ssba-preview' + button + ' .ssba-share-text-prev' ).css( 'line-height', lineHeight );
819
+ $( '#ssba-preview' + button + ' ul li img' ).css( 'line-height', lineHeight );
820
+ }
821
+ } );
822
+ }
823
+
824
+ if ( 'ul' === target ) {
825
+ $( '#ssba-preview' + button ).css( style, value );
826
+ }
827
+ },
828
+
829
+ /**
830
+ * Change images used in classic preview.
831
+ *
832
+ * @param selection
833
+ * @param target
834
+ * @param button
835
+ * @param find
836
+ */
837
+ classicPreview: function( selection, target, button, find, type ) {
838
+ var title,
839
+ imgSrc,
840
+ height = $( '#ssba_' + type + '_height' ).val(),
841
+ margin = $( '#ssba_plus_margin' ).val(),
842
+ placement = $( '#ssba_plus_text_placement option:selected' ).val(),
843
+ lineHeight,
844
+ self = this;
845
+
846
+ if ( '' === height ) {
847
+ height = 48;
848
+ }
849
+
850
+ if ( '' === margin ) {
851
+ margin = 0;
852
+ }
853
+
854
+ lineHeight = parseInt( height ) + parseInt( margin ) * 2;
855
+
856
+ if ( ( 'height' === target || 'margin' === target ) && ( '' === button || '-1' === button ) && ( 'above' !== placement && 'below' !== placement ) ) {
857
+ $( '#ssba-preview' + button + ' .ssba-share-text-prev' ).css( 'line-height', lineHeight + 'px' );
858
+ $( '#ssba-preview' + button + ' ul li img' ).css( 'line-height', lineHeight + 'px' );
859
+ }
860
+
861
+ if ( 'height' === target && 'share' === type ) {
862
+ self.updateInlineStyle();
863
+ }
864
+
865
+ $( '#ssba-preview' + button + ' .ssbp-list li' ).each( function() {
866
+ if ( '' === target ) {
867
+ title = $( this ).find( find ).attr( 'title' ).toLowerCase();
868
+ imgSrc = self.data.site + selection + '/' + title.replace( /[^a-zA-Z 0-9]+/g, '' ).replace( ' ', '_' ) + '.png';
869
+
870
+ if ( 'custom' !== selection ) {
871
+ $( this ).find( find ).attr( 'src', imgSrc );
872
+ } else {
873
+ $( this ).find( find ).attr( 'src', '' );
874
+ }
875
+ }
876
+
877
+ if ( '' !== find ) {
878
+ $( this ).find( find ).css( target, selection );
879
+ } else {
880
+ $( this ).css( target, selection );
881
+ }
882
+ } );
883
+ },
884
+
885
+ /**
886
+ * Update the share text styling.
887
+ *
888
+ * @param type
889
+ * @param value
890
+ * @param target
891
+ */
892
+ classicTextCss: function( type, value, target ) {
893
+ var height = $( '#ssba_plus_height' ).val(),
894
+ margin = $( '#ssba_plus_margin' ).val(),
895
+ cheight = $( '#ssba_size' ).val(),
896
+ cmargin = $( '#ssba_padding' ).val() * 2,
897
+ lineHeight,
898
+ clineHeight;
899
+
900
+ if ( '' === height || '' === cheight ) {
901
+ height = 48;
902
+ cheight = 48;
903
+ }
904
+
905
+ if ( '' === margin || '' === cmargin ) {
906
+ margin = 0;
907
+ cmargin = 0;
908
+ }
909
+
910
+ lineHeight = parseInt( height ) + parseInt( margin ) * 2;
911
+ clineHeight = parseInt( cheight ) + parseInt( cmargin );
912
+
913
+ if ( 'float' === type ) {
914
+ $( '#ssba-preview-1 .ssba-share-text-prev' ).css( 'line-height', clineHeight + 'px' );
915
+ $( '#ssba-preview-1 ul li img' ).css( 'line-height', clineHeight + 'px' );
916
+ }
917
+
918
+ if ( 'html' !== type && 'placement' !== type ) {
919
+ $( target ).css( type, value );
920
+ }
921
+
922
+ if ( 'html' === type ) {
923
+ $( target ).html( value );
924
+ }
925
+
926
+ if ( 'placement' === type && 'above' === value ) {
927
+ $( target ).css( { 'float' : 'none', 'display' : 'inline' } );
928
+ $( '.ssba-share-text-prev' ).css( 'line-height', 'inherit' );
929
+ }
930
+
931
+ if ( 'placement' === type && 'below' === value ) {
932
+ $( target ).css( { 'display' : 'table-footer-group', 'float' : 'none' } );
933
+ $( '.ssba-share-text-prev' ).css( 'line-height', 'inherit' );
934
+ }
935
+ },
936
+
937
+ /**
938
+ * Update the networks in the preview with new list.
939
+ *
940
+ * @param list
941
+ * @param number
942
+ * @param type
943
+ */
944
+ updateNetworkPreview: function( list, number, type ) {
945
+ $( '#ssba-preview' + number + ' .ssbp-list li' ).addClass( 'ssba-hide-button' );
946
+ $.each( list, function( index, id ) {
947
+ $( '#ssba-preview' + number + ' .ssbp-list li' ).each( function() {
948
+ var newid = $( this ).find( type ).attr( 'title' ).toLowerCase().replace( '+', '' ).replace( ' ', '_' );
949
+
950
+ if ( id === newid ) {
951
+ $( this ).removeClass( 'ssba-hide-button' );
952
+ }
953
+ } );
954
+ } );
955
+ },
956
+
957
+ /**
958
+ * Update style for non DOM styles.
959
+ */
960
+ updateInlineStyle: function() {
961
+ var iconSize = $( '#ssba_plus_icon_size' ).val(),
962
+ iconLineHeight = $( '#ssba_plus_height' ).val(),
963
+ iconColor = $( '#ssba_plus_icon_color' ).val(),
964
+ iconColorHover = $( '#ssba_plus_icon_hover_color' ).val(),
965
+ buttonColorHover = $( '#ssba_plus_button_hover_color' ).val(),
966
+ iconSizeBar = $( '#ssba_bar_icon_size' ).val(),
967
+ iconLineHeightBar = $( '#ssba_bar_height' ).val(),
968
+ iconColorBar = $( '#ssba_bar_icon_color' ).val(),
969
+ iconColorHoverBar = $( '#ssba_bar_icon_hover_color' ).val(),
970
+ buttonColorHoverBar = $( '#ssba_bar_button_hover_color' ).val(),
971
+ newStyle = '#ssba-preview .ssbp-li--facebook_save { line-height: ' + iconLineHeight + 'px; } #ssba-preview .ssbp-btn:before{ font-size: ' + iconSize + 'px; line-height: ' + iconLineHeight + 'px; color: ' + iconColor + '; } #ssba-preview .ssbp-btn:hover::before { color: ' + iconColorHover + '; } #ssba-preview .ssbp-btn:hover { background: ' + buttonColorHover + '!important; } #ssba-preview-2 .ssbp-btn:before{ font-size: ' + iconSizeBar + 'px; line-height: ' + iconLineHeightBar + 'px; color: ' + iconColorBar + '; } #ssba-preview-2 .ssbp-btn:hover::before { color: ' + iconColorHoverBar + '; } #ssba-preview-2 .ssbp-btn:hover { background: ' + buttonColorHoverBar + '!important; }';
972
+
973
+ $( '#simple-share-buttons-adder-styles-inline-css' ).html( newStyle );
974
+ },
975
+
976
+ /**
977
+ * Add dismiss status to blockquote notices.
978
+ *
979
+ * @param type
980
+ */
981
+ dismissNotice: function (type) {
982
+
983
+ // Send newsletter id to the test function.
984
+ wp.ajax.post('dismiss_notice', {
985
+ type: type,
986
+ nonce: this.data.nonce
987
+ }).always(function (response) {
988
+
989
+ // Hide notice.
990
+ $('#' + type).closest('blockquote').hide();
991
+ });
992
+ },
993
+
994
+ /**
995
+ * Copy text to clipboard
996
+ *
997
+ * @param copiedText
998
+ */
999
+ copyText: function ( copiedText ) {
1000
+ copiedText.select();
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
+ onboarding_product: 'gdpr-compliance-tool-v2',
1018
+ }
1019
+ };
1020
+
1021
+ if ( emailEnabled ) {
1022
+ theData.custom['email_enabled'] = true;
1023
+ }
1024
+
1025
+ theData = JSON.stringify(theData);
1026
+
1027
+ $.ajax({
1028
+ url: 'https://sso.sharethis.com/register',
1029
+ method: 'POST',
1030
+ async: false,
1031
+ contentType: 'application/json; charset=utf-8',
1032
+ data: theData,
1033
+ success: function ( results ) {
1034
+ // Create property.
1035
+ self.createProperty(results, email);
1036
+ },
1037
+ error: function ( xhr, status, error ) {
1038
+
1039
+ var message = xhr.responseJSON.message,
1040
+
1041
+ message = 'an account with this email already exists' === message ?
1042
+ '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.' :
1043
+ message;
1044
+
1045
+ $('small.error-message').remove();
1046
+
1047
+ if ( 'Your password must be 6 characters or more' === message || 'missing \'password\'' === message ) {
1048
+ $('#st-password').before(
1049
+ '<small class="error-message" style="margin: 1rem 0;">' +
1050
+ message +
1051
+ '</small>'
1052
+ );
1053
+ } else {
1054
+ $('#st-email, #st-no-account-email').before(
1055
+ '<small class="error-message" style="margin: 1rem 0;">' +
1056
+ message +
1057
+ '</small>'
1058
+ );
1059
+ }
1060
+ }
1061
+ });
1062
+ },
1063
+ /**
1064
+ * Create property for new account.
1065
+ *
1066
+ * @param accountInfo
1067
+ * @param button
1068
+ * @param signedUp
1069
+ * @param flow
1070
+ * @param mixpanelCookie
1071
+ * @param language
1072
+ * @param platform
1073
+ */
1074
+ createProperty: function (accountInfo) {
1075
+ var result = null,
1076
+ self = this,
1077
+ token = '' !== accountInfo ? accountInfo.token : '',
1078
+ theData,
1079
+ config = this.getConfig();
1080
+
1081
+ if ( 'string' === typeof accountInfo ) {
1082
+ token = accountInfo;
1083
+ }
1084
+
1085
+ theData = JSON.stringify({
1086
+ token: token,
1087
+ product: 'gdpr-compliance-tool-v2',
1088
+ });
1089
 
1090
+ $.ajax({
1091
+ url: 'https://platform-api.sharethis.com/v1.0/property',
1092
+ method: 'POST',
1093
+ async: false,
1094
+ contentType: 'application/json; charset=utf-8',
1095
+ data: theData,
1096
+ success: function ( results ) {
1097
+
1098
+ $('.gdpr-register').hide();
1099
+ $('.gdpr-config').show();
1100
+
1101
+ wp.ajax.post( 'ssba_ajax_add_creds', {
1102
+ propertyId: results._id,
1103
+ token: token,
1104
+ nonce: self.data.nonce
1105
+ } ).always( function( results ) {
1106
+ $('.ssba-review-us').fadeOut();
1107
+ });
1108
+
1109
+ // Send new button status value.
1110
+ $.ajax({
1111
+ url: 'https://platform-api.sharethis.com/v1.0/property/product',
1112
+ method: 'POST',
1113
+ async: false,
1114
+ contentType: 'application/json; charset=utf-8',
1115
+ data: JSON.stringify({
1116
+ 'token': token,
1117
+ 'id': results._id,
1118
+ 'product': 'gdpr-compliance-tool-v2',
1119
+ 'config': config
1120
+ })
1121
+ });
1122
+ }
1123
+ });
1124
+ },
1125
+ /**
1126
+ * Helper function to grab config of GDPR options.
1127
+ */
1128
+ getConfig: function () {
1129
+ var config,
1130
+ enabled = $('#sharethis-enabled').is(':checked'),
1131
+ beforeConfig,
1132
+ theFirst,
1133
+ theData,
1134
+ publisherPurpose = $('#publisher-purpose input:checked'),
1135
+ publisherPurposes = [],
1136
+ display = $( '#sharethis-user-type option:selected' ).val(),
1137
+ name = $( '#sharethis-publisher-name' ).val(),
1138
+ scope = $( '#sharethis-consent-type option:selected' ).val(),
1139
+ color = $( '#sharethis-form-color .color.selected' ).attr('data-value'),
1140
+ language = $( '#st-language' ).val();
1141
+
1142
+ $('#publisher-purpose input:checked').each( function( index, value ) {
1143
+ var theId = $(value).attr('data-id'),
1144
+ legit = 'consent' !== $(value).val();
1145
+
1146
+ publisherPurposes.push({ 'id': theId, 'legitimate_interest' : legit });
1147
+ });
1148
 
1149
+ config = {
1150
+ enabled: enabled,
1151
+ display: display,
1152
+ publisher_name: name,
1153
+ publisher_purposes: publisherPurposes,
1154
+ language: language,
1155
+ color: color,
1156
+ scope: scope,
1157
+ };
1158
+
1159
+ return config;
1160
+ },
1161
+ /**
1162
+ * Helper function to set gdpr purpose radio fields.
1163
+ * @param configVisible
1164
+ */
1165
+ setPurposes: function (configVisible) {
1166
+ if (!configVisible) {
1167
+ return;
1168
+ }
1169
+
1170
+ $("#publisher-purpose .purpose-item input").prop('checked', false);
1171
+ $("#publisher-purpose .purpose-item input[name='purposes[1]']").bootstrapSwitch( 'state', false );
1172
+
1173
+ if (this.data['publisher_purposes']) {
1174
+ this.data['publisher_purposes'].map((purpVal) => {
1175
+ var legit = 'true' === purpVal['legitimate_interest'] || true === purpVal['legitimate_interest'],
1176
+ consent = 'false' === purpVal['legitimate_interest'] || false === purpVal['legitimate_interest'];
1177
+
1178
+ $( `#publisher-purpose .purpose-item input[name="purposes[${purpVal.id}]"][value="legitimate"]` ).prop( 'checked', legit );
1179
+ $( `#publisher-purpose .purpose-item input[name="purposes[${purpVal.id}]"][value="consent"]` ).prop( 'checked', consent );
1180
+
1181
+ if ('1' === purpVal.id) {
1182
+ $("#publisher-purpose .purpose-item input[name='purposes[1]']").bootstrapSwitch( 'state', consent );
1183
+ }
1184
+ } );
1185
+ }
1186
+ }
1187
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1188
  } )( window.jQuery, window.wp );
php/class-admin-bits.php CHANGED
@@ -142,6 +142,29 @@ class Admin_Bits
142
  wp_send_json_success('hidden');
143
  }
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  /**
146
  * Includes js/css files and upload script.
147
  *
@@ -163,17 +186,23 @@ class Admin_Bits
163
  wp_enqueue_script("{$this->plugin->assets_prefix}-colorpicker");
164
  wp_enqueue_script("{$this->plugin->assets_prefix}-switch");
165
  wp_enqueue_script("{$this->plugin->assets_prefix}-admin");
 
 
 
 
 
 
166
  wp_add_inline_script("{$this->plugin->assets_prefix}-admin", sprintf('%s.boot( %s );',
167
  __NAMESPACE__,
168
  wp_json_encode(array(
169
  'site' => $current_url,
170
  'nonce' => wp_create_nonce($this->plugin->meta_prefix),
 
 
 
171
  ))
172
  ));
173
 
174
- // Get sbba settings.
175
- $arr_settings = $this->class_ssba->get_ssba_settings();
176
-
177
  $custom_css = ! empty($arr_settings['ssba_additional_css']) ? $arr_settings['ssba_additional_css'] : '';
178
  $custom_css .= ! empty($arr_settings['ssba_plus_additional_css']) ? $arr_settings['ssba_plus_additional_css'] : '';
179
  $custom_css .= ! empty($arr_settings['ssba_bar_additional_css']) ? $arr_settings['ssba_bar_additional_css'] : '';
@@ -292,7 +321,7 @@ class Admin_Bits
292
  // Get posted data.
293
  $ssba_post = $_POST['ssbaData']; // WPCS: CSRF ok.
294
  $selected_tab = isset($_POST['ssba_selected_tab']) ? sanitize_text_field(wp_unslash($_POST['ssba_selected_tab'])) : ''; // WPCS: CSRF ok.
295
-
296
  parse_str($ssba_post, $ssba_post);
297
 
298
  // If the nonce doesn't check out.
@@ -462,6 +491,7 @@ class Admin_Bits
462
  'plus_ignore_facebook_sdk' => $ssba_post['plus_ignore_facebook_sdk'],
463
  'bar_facebook_insights' => $ssba_post['bar_facebook_insights'],
464
  'bar_facebook_app_id' => $ssba_post['bar_facebook_app_id'],
 
465
  );
466
 
467
  // Save the settings.
142
  wp_send_json_success('hidden');
143
  }
144
 
145
+ /**
146
+ * AJAX Call for saving property id and token.
147
+ *
148
+ * @action wp_ajax_ssba_ajax_add_creds
149
+ *
150
+ * @param $post
151
+ */
152
+ public function ssbaAjaxAddCreds()
153
+ {
154
+ check_ajax_referer($this->plugin->meta_prefix, 'nonce');
155
+
156
+ if (!isset($_POST['propertyId'], $_POST['token']) ||
157
+ in_array('', [$_POST['propertyId'], $_POST['token']], true)) {
158
+ wp_send_json_error('Property Creation Failed.');
159
+ }
160
+
161
+ $property_id = sanitize_text_field(wp_unslash($_POST['propertyId']));
162
+ $token = sanitize_text_field(wp_unslash($_POST['token']));
163
+
164
+ update_option('ssba_property_id', $property_id);
165
+ update_option('ssba_token', $token);
166
+ }
167
+
168
  /**
169
  * Includes js/css files and upload script.
170
  *
186
  wp_enqueue_script("{$this->plugin->assets_prefix}-colorpicker");
187
  wp_enqueue_script("{$this->plugin->assets_prefix}-switch");
188
  wp_enqueue_script("{$this->plugin->assets_prefix}-admin");
189
+
190
+ // Get sbba settings.
191
+ $arr_settings = $this->class_ssba->get_ssba_settings();
192
+ $token = get_option('ssba_token');
193
+ $propertyid = get_option('ssba_property_id');
194
+
195
  wp_add_inline_script("{$this->plugin->assets_prefix}-admin", sprintf('%s.boot( %s );',
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
  ))
204
  ));
205
 
 
 
 
206
  $custom_css = ! empty($arr_settings['ssba_additional_css']) ? $arr_settings['ssba_additional_css'] : '';
207
  $custom_css .= ! empty($arr_settings['ssba_plus_additional_css']) ? $arr_settings['ssba_plus_additional_css'] : '';
208
  $custom_css .= ! empty($arr_settings['ssba_bar_additional_css']) ? $arr_settings['ssba_bar_additional_css'] : '';
321
  // Get posted data.
322
  $ssba_post = $_POST['ssbaData']; // WPCS: CSRF ok.
323
  $selected_tab = isset($_POST['ssba_selected_tab']) ? sanitize_text_field(wp_unslash($_POST['ssba_selected_tab'])) : ''; // WPCS: CSRF ok.
324
+ $gdpr_config = !empty($_POST['gdpr_config']) ? $_POST['gdpr_config'] : '';
325
  parse_str($ssba_post, $ssba_post);
326
 
327
  // If the nonce doesn't check out.
491
  'plus_ignore_facebook_sdk' => $ssba_post['plus_ignore_facebook_sdk'],
492
  'bar_facebook_insights' => $ssba_post['bar_facebook_insights'],
493
  'bar_facebook_app_id' => $ssba_post['bar_facebook_app_id'],
494
+ 'ssba_gdpr_config' => $gdpr_config
495
  );
496
 
497
  // Save the settings.
php/class-admin-panel.php CHANGED
@@ -1487,7 +1487,6 @@ class Admin_Panel
1487
  $share_bar = array(
1488
  'form_group' => false,
1489
  'type' => 'checkbox',
1490
- 'type' => 'checkbox',
1491
  'name' => 'ssba_bar_enabled',
1492
  'label' => 'Share Bar',
1493
  'tooltip' => 'If "On" share bar will appear on your site.',
1487
  $share_bar = array(
1488
  'form_group' => false,
1489
  'type' => 'checkbox',
 
1490
  'name' => 'ssba_bar_enabled',
1491
  'label' => 'Share Bar',
1492
  'tooltip' => 'If "On" share bar will appear on your site.',
php/class-database.php CHANGED
@@ -271,6 +271,9 @@ class Database
271
  // Delete options.
272
  delete_option('ssba_settings');
273
  delete_option('ssba_version');
 
 
 
274
  }
275
 
276
  /**
271
  // Delete options.
272
  delete_option('ssba_settings');
273
  delete_option('ssba_version');
274
+ delete_option('ssba_property_id');
275
+ delete_option('ssba_token');
276
+ delete_option('ssba_buttons');
277
  }
278
 
279
  /**
php/class-plugin.php CHANGED
@@ -59,11 +59,23 @@ class Plugin extends Plugin_Base
59
  */
60
  public function register_assets()
61
  {
 
 
62
  wp_register_script("{$this->assets_prefix}-ssba", "{$this->dir_url}js/ssba.js", array('jquery'), false, true);
63
  wp_register_style("{$this->assets_prefix}-indie", '//fonts.googleapis.com/css?family=Indie+Flower');
64
  wp_register_style("{$this->assets_prefix}-reenie", '//fonts.googleapis.com/css?family=Reenie+Beanie');
65
  wp_register_style("{$this->assets_prefix}-ssba", "{$this->dir_url}css/ssba.css", false);
66
  wp_register_style("{$this->assets_prefix}-font-awesome", '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', false);
 
 
 
 
 
 
 
 
 
 
67
  }
68
 
69
  /**
@@ -73,11 +85,11 @@ class Plugin extends Plugin_Base
73
  */
74
  public function register_admin_assets()
75
  {
76
- wp_register_script("{$this->assets_prefix}-admin", "{$this->dir_url}js/admin.js", array('jquery', 'wp-util'));
77
  wp_register_script("{$this->assets_prefix}-bootstrap-js", "{$this->dir_url}js/vendor/bootstrap.js");
78
  wp_register_script("{$this->assets_prefix}-colorpicker", "{$this->dir_url}js/vendor/colorpicker.js");
79
  wp_register_script("{$this->assets_prefix}-switch", "{$this->dir_url}js/vendor/switch.js");
80
- wp_enqueue_style("{$this->assets_prefix}-admin", "{$this->dir_url}css/admin.css", false);
81
  wp_register_style("{$this->assets_prefix}-readable", "{$this->dir_url}css/readable.css");
82
  wp_register_style("{$this->assets_prefix}-colorpicker", "{$this->dir_url}css/colorpicker.css");
83
  wp_register_style("{$this->assets_prefix}-switch", "{$this->dir_url}css/switch.css");
59
  */
60
  public function register_assets()
61
  {
62
+ $propertyid = get_option('ssba_property_id');
63
+
64
  wp_register_script("{$this->assets_prefix}-ssba", "{$this->dir_url}js/ssba.js", array('jquery'), false, true);
65
  wp_register_style("{$this->assets_prefix}-indie", '//fonts.googleapis.com/css?family=Indie+Flower');
66
  wp_register_style("{$this->assets_prefix}-reenie", '//fonts.googleapis.com/css?family=Reenie+Beanie');
67
  wp_register_style("{$this->assets_prefix}-ssba", "{$this->dir_url}css/ssba.css", false);
68
  wp_register_style("{$this->assets_prefix}-font-awesome", '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', false);
69
+
70
+ if (!empty($propertyid)) {
71
+ wp_register_script(
72
+ "{$this->assets_prefix}-mu",
73
+ "//platform-api.sharethis.com/js/sharethis.js#property={$propertyid}&product=gdpr-compliance-tool-v2",
74
+ null,
75
+ null,
76
+ false
77
+ );
78
+ }
79
  }
80
 
81
  /**
85
  */
86
  public function register_admin_assets()
87
  {
88
+ wp_register_script("{$this->assets_prefix}-admin", "{$this->dir_url}js/admin.js", array('jquery', 'wp-util'), time());
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");
php/class-styles.php CHANGED
@@ -67,6 +67,12 @@ class Styles
67
  add_filter('script_loader_tag', array($this, 'ssba_script_tags'), 10, 2);
68
  }
69
 
 
 
 
 
 
 
70
  // Enqueue main script.
71
  wp_enqueue_script("{$this->plugin->assets_prefix}-ssba");
72
  wp_add_inline_script("{$this->plugin->assets_prefix}-ssba", sprintf('Main.boot( %s );',
67
  add_filter('script_loader_tag', array($this, 'ssba_script_tags'), 10, 2);
68
  }
69
 
70
+ // Enqueue ST script for ST products.
71
+ if (!empty(get_option('ssba_property_id'))) {
72
+ wp_dequeue_script('ssba-sharethis');
73
+ wp_enqueue_script("{$this->plugin->assets_prefix}-mu");
74
+ }
75
+
76
  // Enqueue main script.
77
  wp_enqueue_script("{$this->plugin->assets_prefix}-ssba");
78
  wp_add_inline_script("{$this->plugin->assets_prefix}-ssba", sprintf('Main.boot( %s );',
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.4.1
6
- Stable tag: 7.7.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,9 @@ Please visit the <a href="https://wordpress.org/support/plugin/simple-share-butt
66
 
67
  == Changelog ==
68
 
 
 
 
69
  = 7.7.1 =
70
  * Add: Add new button images.
71
 
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
6
+ Stable tag: 8.0.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.0.0 =
70
+ * Add: Integrate ShareThis GDPR Compliance Tool.
71
+
72
  = 7.7.1 =
73
  * Add: Add new button images.
74
 
simple-share-buttons-adder.php CHANGED
@@ -3,7 +3,7 @@
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: 7.7.1
7
  * Author: Simple Share Buttons
8
  * Author URI: https://simplesharebuttons.com
9
  * License: GPLv2
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.0
7
  * Author: Simple Share Buttons
8
  * Author URI: https://simplesharebuttons.com
9
  * License: GPLv2
templates/admin-footer.php CHANGED
@@ -8,32 +8,6 @@
8
  */
9
 
10
  ?>
11
- <footer class="row">
12
- <div class="col-sm-12">
13
- <a href="https://simplesharebuttons.com" target="_blank"><?php echo esc_html__( 'Simple Share Buttons Adder', 'simple-share-buttons-adder' ); ?></a>
14
- <span class="badge"><?php echo esc_html( SSBA_VERSION ); ?></span>
15
- <button type="button" class="ssba-btn-thank-you pull-right btn btn-primary" data-toggle="modal" data-target="#ssbaFooterModal">
16
- <i class="fa fa-info"></i>
17
- </button>
18
- <div class="modal fade" id="ssbaFooterModal" tabindex="-1" role="dialog" aria-labelledby="ssbaFooterModalLabel" aria-hidden="true">
19
- <div class="modal-dialog">
20
- <div class="modal-content">
21
- <div class="modal-header">
22
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
23
- <h4 class="modal-title"><?php echo esc_html__( 'Simple Share Buttons', 'simple-share-buttons-adder' ); ?></h4>
24
- </div>
25
- <div class="modal-body">
26
- <p><?php echo esc_html__( 'Many thanks for choosing', 'simple-share-buttons-adder' ); ?> <a href="https://simplesharebuttons.com" target="_blank"><?php echo esc_html__( 'Simple Share Buttons', 'simple-share-buttons-adder' ); ?></a> <?php echo esc_html__( 'for your share buttons plugin, we\'re confident you won\'t be disappointed in your decision. If you require any support, please visit the', 'simple-share-buttons-adder' ); ?> <a href="https://wordpress.org/support/plugin/simple-share-buttons-adder" target="_blank"><?php echo esc_html__( 'support forum', 'simple-share-buttons-adder' ); ?></a>.</p>
27
- <p><?php echo esc_html__( 'If you like the plugin, we\'d really appreciate it if you took a moment to', 'simple-share-buttons-adder' ); ?> <a href="https://wordpress.org/support/view/plugin-reviews/simple-share-buttons-adder" target="_blank"><?php echo esc_html__( 'leave a review', 'simple-share-buttons-adder' ); ?></a>, <?php echo esc_html__( 'if there\'s anything missing to get 5 stars do please', 'simple-share-buttons-adder' ); ?> <a href="https://simplesharebuttons.com/contact/" target="_blank"><?php echo esc_html__( 'let us know', 'simple-share-buttons-adder' ); ?></a>. <?php echo esc_html__( 'If you feel your website is worthy of appearing on our', 'simple-share-buttons-adder' ); ?> <a href="https://simplesharebuttons.com/showcase/" target="_blank"><?php echo esc_html__( 'showcase page', 'simple-share-buttons-adder' ); ?></a> do <a href="https://simplesharebuttons.com/contact/" target="_blank"><?php echo esc_html__( 'get in touch', 'simple-share-buttons-adder' ); ?></a>.</p>
28
- </div>
29
- <div class="modal-footer">
30
- <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo esc_html__( 'Close', 'simple-share-buttons-adder' ); ?></button>
31
- </div>
32
- </div>
33
- </div>
34
- </div>
35
- </div>
36
- </footer>
37
  </div>
38
  <?php if (empty(get_option('ssba-hide-review'))) : ?>
39
  <div class="ssba-review-us">
8
  */
9
 
10
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  </div>
12
  <?php if (empty(get_option('ssba-hide-review'))) : ?>
13
  <div class="ssba-review-us">
templates/admin-panel.php CHANGED
@@ -12,6 +12,7 @@ $selected_tab = null !== $selected_tab && false !== $selected_tab ? $selected_ta
12
  $classic = 'classic' === $selected_tab ? 'active' : '';
13
  $modern = isset( $selected_tab ) && 'modern' === $selected_tab ? 'active' : '';
14
  $bar = isset( $selected_tab ) && 'bar' === $selected_tab ? 'active' : '';
 
15
 
16
  echo $this->admin_header(); // WPCS: XSS ok.
17
  echo $this->forms->open( false ); // WPCS: XSS ok.
@@ -43,22 +44,27 @@ if ( isset( $_GET['accept-terms'] ) && 'Y' === $_GET['accept-terms'] ) { // WPCS
43
  </a>
44
  </li>
45
  <li class="ssba-modern-tab <?php echo esc_attr( $modern ); ?>">
46
- <span class="ssba-new-icon">new</span>
47
  <a href="#plus-share-buttons" data-toggle="tab">
48
  <?php echo esc_html__( 'Modern Share Buttons', 'simple-share-buttons-adder' ); ?>
49
  </a>
50
  </li>
51
  <li class="ssba-bar-tab <?php echo esc_attr( $bar ); ?>">
52
- <span class="ssba-new-icon">new</span>
53
  <a href="#share-bar" data-toggle="tab">
54
  <?php echo esc_html__( 'Share Bar', 'simple-share-buttons-adder' ); ?>
55
  </a>
56
  </li>
 
 
 
 
 
 
57
  </ul>
58
  <div id="ssbaTabContent" class="tab-content">
59
  <?php include_once( "{$this->plugin->dir_path}/templates/classic-tab.php" ); ?>
60
  <?php include_once( "{$this->plugin->dir_path}/templates/plus-tab.php" ); ?>
61
  <?php include_once( "{$this->plugin->dir_path}/templates/share-bar-tab.php" ); ?>
 
62
  </div>
63
  <input id="ssba_selected_tab" name="ssba_selected_tab" type="hidden" value="<?php echo esc_html( $selected_tab ); ?>"/>
64
  <?php
12
  $classic = 'classic' === $selected_tab ? 'active' : '';
13
  $modern = isset( $selected_tab ) && 'modern' === $selected_tab ? 'active' : '';
14
  $bar = isset( $selected_tab ) && 'bar' === $selected_tab ? 'active' : '';
15
+ $gdpr = isset( $selected_tab ) && 'gdpr' === $selected_tab ? 'active' : '';
16
 
17
  echo $this->admin_header(); // WPCS: XSS ok.
18
  echo $this->forms->open( false ); // WPCS: XSS ok.
44
  </a>
45
  </li>
46
  <li class="ssba-modern-tab <?php echo esc_attr( $modern ); ?>">
 
47
  <a href="#plus-share-buttons" data-toggle="tab">
48
  <?php echo esc_html__( 'Modern Share Buttons', 'simple-share-buttons-adder' ); ?>
49
  </a>
50
  </li>
51
  <li class="ssba-bar-tab <?php echo esc_attr( $bar ); ?>">
 
52
  <a href="#share-bar" data-toggle="tab">
53
  <?php echo esc_html__( 'Share Bar', 'simple-share-buttons-adder' ); ?>
54
  </a>
55
  </li>
56
+ <li class="ssba-gdpr <?php echo esc_attr( $gdpr ); ?>">
57
+ <span class="ssba-new-icon">new</span>
58
+ <a href="#gdpr" data-toggle="tab">
59
+ <?php echo esc_html__( 'GDPR', 'simple-share-buttons-adder' ); ?>
60
+ </a>
61
+ </li>
62
  </ul>
63
  <div id="ssbaTabContent" class="tab-content">
64
  <?php include_once( "{$this->plugin->dir_path}/templates/classic-tab.php" ); ?>
65
  <?php include_once( "{$this->plugin->dir_path}/templates/plus-tab.php" ); ?>
66
  <?php include_once( "{$this->plugin->dir_path}/templates/share-bar-tab.php" ); ?>
67
+ <?php include_once( "{$this->plugin->dir_path}/templates/gdpr-tab.php" ); ?>
68
  </div>
69
  <input id="ssba_selected_tab" name="ssba_selected_tab" type="hidden" value="<?php echo esc_html( $selected_tab ); ?>"/>
70
  <?php
templates/config/gdpr/appearance.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Appearence display for gdpr config.
4
+ */
5
+
6
+ // Template vars.
7
+ $colors = [
8
+ '#e31010',
9
+ '#000000',
10
+ '#ffffff',
11
+ '#09cd18',
12
+ '#ff6900',
13
+ '#fcb900',
14
+ '#7bdcb5',
15
+ '#00d084',
16
+ '#8ed1fc',
17
+ '#0693e3',
18
+ '#abb8c3',
19
+ '#eb144c',
20
+ '#f78da7',
21
+ '#9900ef',
22
+ '#b80000',
23
+ '#db3e00',
24
+ '#fccb00',
25
+ '#008b02',
26
+ '#006b76',
27
+ '#1273de',
28
+ '#004dcf',
29
+ '#5300eb',
30
+ '#eb9694',
31
+ '#fad0c3',
32
+ '#fef3bd',
33
+ '#c1e1c5',
34
+ '#bedadc',
35
+ '#c4def6',
36
+ '#bed3f3',
37
+ '#d4c4fb'
38
+ ];
39
+ ?>
40
+ <div class="col-md-12">
41
+ <h3><?php echo esc_html__( 'Form Color', 'simple-share-buttons-adder' ); ?></h3>
42
+ </div>
43
+
44
+ <div id="sharethis-form-color" class="col-md-12">
45
+ <?php foreach ($colors as $color) : ?>
46
+ <div class="color<?php echo $color === $gdpr_config['color'] ? ' selected' : ''; ?>"
47
+ data-value="<?php echo esc_attr($color); ?>"
48
+ style="max-width: 30px; max-height: 30px; overflow: hidden;"
49
+ >
50
+ <span style="content: ' '; background-color:<?php echo esc_html($color); ?>; padding: 40px;"></span>
51
+ </div>
52
+ <?php endforeach; ?>
53
+ </div>
templates/config/gdpr/config.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The Config display for GDPR tab.
4
+ */
5
+
6
+ // User type options.
7
+ $user_types = array(
8
+ 'eu' => esc_html__('Only visitors in the EU', 'sharethis-custom'),
9
+ 'always' => esc_html__('All visitors globally', 'sharethis-custom'),
10
+ );
11
+
12
+ // Consent type options.
13
+ $consent_types = array(
14
+ 'global' => esc_html__(
15
+ 'Global: Publisher consent = 1st party cookie; Vendors consent = 3rd party cookie',
16
+ 'sharethis-custom'
17
+ ),
18
+ 'publisher' => esc_html__(
19
+ 'Service: publisher consent = 1st party cookie; Vendors consent = 1st party cookie',
20
+ 'sharethis-custom'
21
+ ),
22
+ );
23
+
24
+ $languages = array(
25
+ 'English' => 'en',
26
+ 'German' => 'de',
27
+ 'Spanish' => 'es',
28
+ 'French' => 'fr'
29
+ );
30
+
31
+ $publisher_name = !empty($gdpr_config['publisher_name']) ? $gdpr_config['publisher_name'] : '';
32
+ $enabled = !empty($gdpr_config['enabled']) ? $gdpr_config['enabled'] : false;
33
+ ?>
34
+ <label class="control-label">
35
+ <?php echo esc_html__('GDPR', 'simple-share-buttons-adder'); ?>
36
+ </label>
37
+ <div class="input-div">
38
+ <input type="checkbox" id="sharethis-enabled" <?php echo checked('true', $enabled); ?>>
39
+ </div>
40
+ <div class="well">
41
+ <label class="control-label">
42
+ <?php echo esc_html__('PUBLISHER NAME * (this will be displayed in the consent tool)',
43
+ 'sharethis-share-buttons'); ?>
44
+ </label>
45
+ <div class="input-div">
46
+ <input type="text" id="sharethis-publisher-name" placeholder="Enter your company name" value="<?php echo esc_attr($publisher_name); ?>">
47
+ </div>
48
+ <label class="control-label">
49
+ <?php echo esc_html__('WHICH USERS SHOULD BE ASKED FOR CONSENT?',
50
+ 'sharethis-share-buttons'); ?>
51
+ </label>
52
+ <div class="input-div">
53
+ <select id="sharethis-user-type">
54
+ <?php foreach ($user_types as $user_value => $name) : ?>
55
+ <option value="<?php echo esc_attr($user_value); ?>" <?php echo selected($user_value, $gdpr_config['display']); ?>>
56
+ <?php echo esc_html($name); ?>
57
+ </option>
58
+ <?php endforeach; ?>
59
+ </select>
60
+ </div>
61
+ <label class="control-label">
62
+ <?php echo esc_html__('CONSENT SCOPE', 'sharethis-share-buttons'); ?>
63
+ </label>
64
+ <div class="input-div">
65
+ <select id="sharethis-consent-type">
66
+ <?php foreach ($consent_types as $consent_value => $c_name) : ?>
67
+ <option
68
+ value="<?php echo esc_attr($consent_value); ?>"
69
+ <?php echo selected($consent_value, $gdpr_config['scope']); ?>
70
+ >
71
+ <?php echo esc_html($c_name); ?>
72
+ </option>
73
+ <?php endforeach; ?>
74
+ </select>
75
+ </div>
76
+ <label class="control-label">
77
+ <?php echo esc_html__('SELECT LANGUAGE', 'sharethis-share-buttons'); ?>
78
+ </label>
79
+ <div class="input-div">
80
+ <select id="st-language">
81
+ <?php foreach ($languages as $language => $code) : ?>
82
+ <option value="<?php echo esc_attr($code); ?>" <?php echo selected($code, $gdpr_config['language']); ?>>
83
+ <?php echo esc_html($language); ?>
84
+ </option>
85
+ <?php endforeach; ?>
86
+ </select>
87
+ </div>
88
+ </div>
89
+ <div class="accor-wrap">
90
+ <div class="accor-tab">
91
+ <span class="accor-arrow">&#9658;</span>
92
+ <?php echo esc_html__( 'Appearance', 'simple-share-buttons-adder' ); ?>
93
+ </div>
94
+ <div class="accor-content">
95
+ <div class="well">
96
+ <?php include plugin_dir_path(__FILE__) . 'appearance.php'; ?>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ <div class="accor-wrap">
101
+ <div class="accor-tab">
102
+ <span class="accor-arrow">&#9658;</span>
103
+ <?php echo esc_html__( 'Purposes', 'simple-share-buttons-adder' ); ?>
104
+ </div>
105
+ <div class="accor-content">
106
+ <div class="well">
107
+ <?php include plugin_dir_path(__FILE__) . 'purposes.php'; ?>
108
+ </div>
109
+ </div>
110
+ </div>
templates/config/gdpr/landing.php ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template for GDPR landing page display.
4
+ */
5
+ ?>
6
+ <h2 style="text-decoration: underline;">
7
+ <?php esc_html_e('Check out our new GDPR Compliance Tool!', 'simple-share-buttons-adder'); ?>
8
+ </h2>
9
+ <div class="row">
10
+ <div class="col-md-12">
11
+ <img src="<?php echo plugin_dir_url(__FILE__) . '../../../images/gdpr-ex.png'; ?>" />
12
+ </div>
13
+ <div class="col-md-6">
14
+ <h3><?php esc_html_e('Confirm Consent', 'simple-share-buttons-adder'); ?></h3>
15
+ <p>
16
+ <?php esc_html_e(
17
+ 'A simple and streamlined way to confirm a user’s initial acceptance or rejection of cookie collection',
18
+ 'simple-share-buttons-adder'
19
+ ); ?>
20
+ </p>
21
+ </div>
22
+ <div class="col-md-6">
23
+ <h3><?php esc_html_e('Select Purpose', 'simple-share-buttons-adder'); ?></h3>
24
+ <p>
25
+ <?php esc_html_e(
26
+ 'A transparent system of verifying the intent of collecting a user’s cookies, and giving the option to opt in or out',
27
+ 'simple-share-buttons-adder'
28
+ ); ?>
29
+ </p>
30
+ </div>
31
+ </div>
32
+ <div class="row">
33
+ <div class="col-md-6">
34
+ <h3><?php esc_html_e('Indicate Company', 'simple-share-buttons-adder'); ?></h3>
35
+ <p>
36
+ <?php esc_html_e(
37
+ 'A comprehensive record of company-level information that allows users to monitor and control the recipients of cookie collection',
38
+ 'simple-share-buttons-adder'
39
+ ); ?>
40
+ </p>
41
+ </div>
42
+ <div class="col-md-6">
43
+ <h3><?php esc_html_e('Access Data Rights', 'simple-share-buttons-adder'); ?></h3>
44
+ <p>
45
+ <?php esc_html_e(
46
+ 'A centralized database where users can review the latest privacy policies and information pertaining to their cookie collection',
47
+ 'simple-share-buttons-adder'
48
+ ); ?>
49
+ </p>
50
+ </div>
51
+ </div>
52
+ <div class="row register-section">
53
+ <button id="register-selection">Register to enable</button>
54
+ </div>
55
+ <div class="row">
56
+ <h2 style="text-decoration: underline;"><?php esc_html_e('FAQs', 'simple-share-buttons-adder'); ?></h2>
57
+ <div class="accor-wrap">
58
+ <div class="accor-tab">
59
+ <span class="accor-arrow">&#9658;</span>
60
+ <?php esc_html_e('What is GDPR?', 'simple-share-buttons-adder'); ?>
61
+ </div>
62
+ <div class="accor-content">
63
+ <div class="well">
64
+ <?php esc_html_e(
65
+ 'GDPR (General Data Protection Regulation) is a European regulation to provide EU citizens and residents with greater control of their personal data and to streamline the rules for international businesses working in Europe. GDPR affects all companies based in the EU as well as companies anywhere in the world that handle data related to EU residents.',
66
+ 'simple-share-buttons-adder'
67
+ ); ?>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ <div class="accor-wrap">
72
+ <div class="accor-tab">
73
+ <span class="accor-arrow">&#9658;</span>
74
+ <?php esc_html_e('What is “Personal Data” as it relates to GDPR?', 'simple-share-buttons-adder'); ?>
75
+ </div>
76
+ <div class="accor-content">
77
+ <div class="well">
78
+ <?php esc_html_e(
79
+ 'Under GDPR personal data refers to any information that can directly or indirectly identify an individual. Personal information ShareThis collects includes cookies and IP addresses. We do not collect emails, addresses, phone numbers, or national ID numbers which is also considered personal information.',
80
+ 'simple-share-buttons-adder'
81
+ ); ?>
82
+ </div>
83
+ </div>
84
+ </div>
85
+ <div class="accor-wrap">
86
+ <div class="accor-tab">
87
+ <span class="accor-arrow">&#9658;</span>
88
+ <?php esc_html_e('What is a Data Protection Officer (DPO)?', 'simple-share-buttons-adder'); ?>
89
+ </div>
90
+ <div class="accor-content">
91
+ <div class="well">
92
+ <?php esc_html_e(
93
+ 'A DPO is required for companies that handle large scale processing of data. The DPO’s role is to monitor the company’s compliance under GDPR and to communicate with the data protection authorities. ShareThis is working with a DPO.',
94
+ 'simple-share-buttons-adder'
95
+ ); ?>
96
+ </div>
97
+ </div>
98
+ </div>
99
+ <div class="accor-wrap">
100
+ <div class="accor-tab">
101
+ <span class="accor-arrow">&#9658;</span>
102
+ <?php esc_html_e('What is a CMP?', 'simple-share-buttons-adder'); ?>
103
+ </div>
104
+ <div class="accor-content">
105
+ <div class="well">
106
+ <?php esc_html_e(
107
+ 'A consent management platform (CMP) is a tool that collects and stores consented data as well as communicates the consent status of users and their cookies to other vendors within the CMP’s framework. It is customizable by the publisher and editable by the consumer.',
108
+ 'simple-share-buttons-adder'
109
+ ); ?>
110
+ </div>
111
+ </div>
112
+ </div>
113
+ <div class="accor-wrap">
114
+ <div class="accor-tab">
115
+ <span class="accor-arrow">&#9658;</span>
116
+ <?php esc_html_e('What is a CMP?', 'simple-share-buttons-adder'); ?>
117
+ </div>
118
+ <div class="accor-content">
119
+ <div class="well">
120
+ <?php esc_html_e(
121
+ 'A consent management platform (CMP) is a tool that collects and stores consented data as well as communicates the consent status of users and their cookies to other vendors within the CMP’s framework. It is customizable by the publisher and editable by the consumer.',
122
+ 'simple-share-buttons-adder'
123
+ ); ?>
124
+ </div>
125
+ </div>
126
+ </div>
127
+ <div class="accor-wrap">
128
+ <div class="accor-tab">
129
+ <span class="accor-arrow">&#9658;</span>
130
+ <?php esc_html_e(
131
+ 'Are you a member of any self-regulating organizations? Have you any data-related certification?',
132
+ 'simple-share-buttons-adder'
133
+ ); ?>
134
+ </div>
135
+ <div class="accor-content">
136
+ <div class="well">
137
+ <?php esc_html_e(
138
+ 'ShareThis is a member of the IAB, NAI, and DAA in the North American markets and EDAA in Europe.',
139
+ 'simple-share-buttons-adder'
140
+ ); ?>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ <div class="accor-wrap">
145
+ <div class="accor-tab">
146
+ <span class="accor-arrow">&#9658;</span>
147
+ <?php esc_html_e(
148
+ 'How do you manage requests from individuals regarding their data?',
149
+ 'simple-share-buttons-adder'
150
+ ); ?>
151
+ </div>
152
+ <div class="accor-content">
153
+ <div class="well">
154
+ For consumers who wish not to have their data processed,
155
+ or to request withdrawal of consent or deletion of data, our existing opt-out procedure can be found on our
156
+ <a href="https://www.sharethis.com/privacy/" target="_blank">privacy page</a>
157
+ or emailed to
158
+ <a href="mailto:privacy@sharethis.com">privacy@sharethis.com</a>.
159
+ </div>
160
+ </div>
161
+ </div>
162
+ <div class="accor-wrap">
163
+ <div class="accor-tab">
164
+ <span class="accor-arrow">&#9658;</span>
165
+ <?php esc_html_e(
166
+ 'How long can you keep personal data?',
167
+ 'simple-share-buttons-adder'
168
+ ); ?>
169
+ </div>
170
+ <div class="accor-content">
171
+ <div class="well">
172
+ <?php esc_html_e(
173
+ 'We believe Usage Data is relevant for up to 13 months so we retain that data for up to 14 months from the date of collection. Our cookies expire 13 months after they are last updated.',
174
+ 'simple-share-buttons-adder'
175
+ ); ?>
176
+ </div>
177
+ </div>
178
+ </div>
179
+ <div class="accor-wrap">
180
+ <div class="accor-tab">
181
+ <span class="accor-arrow">&#9658;</span>
182
+ <?php esc_html_e(
183
+ 'What do I need to do to comply with GDPR?',
184
+ 'simple-share-buttons-adder'
185
+ ); ?>
186
+ </div>
187
+ <div class="accor-content">
188
+ <div class="well">
189
+ Please review the ShareThis Terms of Use for what ShareThis expects of our publishers in order to be GDPR compliant and to continue using ShareThis tools. Included in our Terms of Use:
190
+
191
+ <ul class="bullets max-width">
192
+ <li>
193
+ ShareThis expects that by maintaining our publisher tools on your website, you agree to these terms of service and will collect, process, and pass personal data on the basis of this consent.
194
+ </li>
195
+ <li>
196
+ To&nbsp;receive consented data, we expect our publishers to have a GDPR compliant consent mechanism of choice on their website.
197
+ </li>
198
+ <li>
199
+ ShareThis&nbsp;expects our publishers to collect, process, and transfer EU/EEA User Personal Data to ShareThis once they have solicited and obtained informed consent from each individual user.
200
+ </li>
201
+ </ul>
202
+ </div>
203
+ </div>
204
+ </div>
205
+ <div class="accor-wrap">
206
+ <div class="accor-tab">
207
+ <span class="accor-arrow">&#9658;</span>
208
+ <?php esc_html_e(
209
+ 'If I choose to show the tool to people only in the EU, how can I check to make sure it’s working?',
210
+ 'simple-share-buttons-adder'
211
+ ); ?>
212
+ </div>
213
+ <div class="accor-content">
214
+ <div class="well">
215
+ <?php esc_html_e(
216
+ 'There are many free and paid VPN services that you can use to check the appearance of your site in other geographic regions.',
217
+ 'simple-share-buttons-adder'
218
+ ); ?>
219
+ </div>
220
+ </div>
221
+ </div>
222
+ <div class="accor-wrap">
223
+ <div class="accor-tab">
224
+ <span class="accor-arrow">&#9658;</span>
225
+ <?php esc_html_e(
226
+ 'If I use the Compliance Tool am I compliant with GDPR?',
227
+ 'simple-share-buttons-adder'
228
+ ); ?>
229
+ </div>
230
+ <div class="accor-content">
231
+ <div class="well">
232
+ <?php esc_html_e(
233
+ 'In order to be GDPR compliant with ShareThis, ShareThis expects a publisher to use a consumer management platform of their choosing, which can include the ShareThis GDPR Compliance Tool. Our publishers must collect, process, and transfer EU/EEA User Personal Data to ShareThis only after it has been solicited with obtained informed consent from each individual user. For general GDPR compliance, please seek legal counsel to understand how the law affects your publisher business in full.',
234
+ 'simple-share-buttons-adder'
235
+ ); ?>
236
+ </div>
237
+ </div>
238
+ </div>
239
+ </div>
templates/config/gdpr/purposes.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Purposes display for gdpr config.
4
+ */
5
+ ?>
6
+ <label>
7
+ <?php echo esc_html__('WHY ARE YOU COLLECTING CUSTOMER DATA?', 'simple-share-buttons-adder'); ?>
8
+ </label>
9
+
10
+ <div id="publisher-purpose" class="switch">
11
+ <div class="empty-choices col-md-12">
12
+ <a id="see-st-choices" class="st-rc-link medium-btn col-md-6" href="#">See Suggested Choices</a>
13
+ <a id="clear-choices" class="st-rc-link medium-btn col-md-6" href="#">Clear Choices</a>
14
+ </div>
15
+ <div class="purpose-item">
16
+ <div class="title">
17
+ <?php echo esc_html__(
18
+ '1) Store and/or access information on a device (Do you collect information on users on your site through cookies or site identifiers?)',
19
+ 'simple-share-buttons-adder'
20
+ ); ?>
21
+ </div>
22
+ <label>
23
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
24
+ <input data-id="1" type="checkbox" name="purposes[1]" value="consent" checked/>
25
+ </label>
26
+ </div>
27
+ <div class="purpose-item">
28
+ <div class="title">
29
+ <?php echo esc_html__(
30
+ '2) Select basic ads (Do you serve ads on your site?)',
31
+ 'simple-share-buttons-adder'
32
+ ); ?>
33
+ </div>
34
+ <label>
35
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
36
+ <input data-id="2" type="radio" name="purposes[2]" value="consent"/>
37
+ <span class="lever"></span>
38
+ </label>
39
+ <label>
40
+ <?php echo esc_html__('Legitimate Interest', 'simple-share-buttons-adder'); ?>
41
+ <input data-id="2" type="radio" name="purposes[2]" value="legitimate"/>
42
+ <span class="lever"></span>
43
+ </label>
44
+ </div>
45
+ <div class="purpose-item">
46
+ <div class="title">
47
+ <?php echo esc_html__(
48
+ '3) Create a personalised ads profile (Do you create personalised advertising profiles associated with users on your site (ie: profiles based on demographic information, location, user’s activity)?)',
49
+ 'simple-share-buttons-adder'
50
+ ); ?>
51
+ </div>
52
+ <label>
53
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
54
+ <input data-id="3" type="radio" name="purposes[3]" value="consent" checked/>
55
+ <span class="lever"></span>
56
+ </label>
57
+ <label>
58
+ <?php echo esc_html__('Legitimate Interest', 'simple-share-buttons-adder'); ?>
59
+ <input data-id="3" type="radio" name="purposes[3]" value="legitimate"/>
60
+ <span class="lever"></span>
61
+ </label>
62
+ </div>
63
+ <div class="purpose-item">
64
+ <div class="title">
65
+ <?php echo esc_html__(
66
+ '4) Select personalised ads (Do you show ads to users based on this user profile)',
67
+ 'simple-share-buttons-adder'
68
+ ); ?>
69
+ </div>
70
+ <label>
71
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
72
+ <input data-id="4" type="radio" name="purposes[4]" value="consent"/>
73
+ <span class="lever"></span>
74
+ </label>
75
+ <label>
76
+ <?php echo esc_html__('Legitimate Interest', 'simple-share-buttons-adder'); ?>
77
+ <input data-id="4" type="radio" name="purposes[4]" value="legitimate"/>
78
+ <span class="lever"></span>
79
+ </label>
80
+ </div>
81
+ <div class="purpose-item">
82
+ <div class="title">
83
+ <?php echo esc_html__(
84
+ '5) Create a personalised content profile (Do you build a personalized content profile associated with users on your site based on the type of content they have viewed?)',
85
+ 'simple-share-buttons-adder'
86
+ ); ?>
87
+ </div>
88
+ <label>
89
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
90
+ <input data-id="5" type="radio" name="purposes[5]" value="consent" checked />
91
+ <span class="lever"></span>
92
+ </label>
93
+ <label>
94
+ <?php echo esc_html__('Legitimate Interest', 'simple-share-buttons-adder'); ?>
95
+ <input data-id="5" type="radio" name="purposes[5]" value="legitimate"/>
96
+ <span class="lever"></span>
97
+ </label>
98
+ </div>
99
+ <div class="purpose-item">
100
+ <div class="title">
101
+ <?php echo esc_html__(
102
+ '6) Select personalised content (Do you serve content to the user on your site based on your recorded content interests)',
103
+ 'simple-share-buttons-adder'
104
+ ); ?>
105
+ </div>
106
+ <label>
107
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
108
+ <input data-id="6" type="radio" name="purposes[6]" value="consent" checked />
109
+ <span class="lever"></span>
110
+ </label>
111
+ <label>
112
+ <?php echo esc_html__('Legitimate Interest', 'simple-share-buttons-adder'); ?>
113
+ <input data-id="6" type="radio" name="purposes[6]" value="legitimate"/>
114
+ <span class="lever"></span>
115
+ </label>
116
+ </div>
117
+ <div class="purpose-item">
118
+ <div class="title">
119
+ <?php echo esc_html__(
120
+ '7) Measure ad performance (Do you measure the performance of advertisements on your site)',
121
+ 'simple-share-buttons-adder'
122
+ ); ?>
123
+ </div>
124
+ <label>
125
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
126
+ <input data-id="7" type="radio" name="purposes[7]" value="consent"/>
127
+ <span class="lever"></span>
128
+ </label>
129
+ <label>
130
+ <?php echo esc_html__('Legitimate Interest', 'simple-share-buttons-adder'); ?>
131
+ <input data-id="7" type="radio" name="purposes[7]" value="legitimate"/>
132
+ <span class="lever"></span>
133
+ </label>
134
+ </div>
135
+ <div class="purpose-item">
136
+ <div class="title">
137
+ <?php echo esc_html__(
138
+ '8) Measure content performance (Do you measure the performance of content served to your site visitors?)',
139
+ 'simple-share-buttons-adder'
140
+ ); ?>
141
+ </div>
142
+ <label>
143
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
144
+ <input data-id="8" type="radio" name="purposes[8]" value="consent"/>
145
+ <span class="lever"></span>
146
+ </label>
147
+ <label>
148
+ <?php echo esc_html__('Legitimate Interest', 'simple-share-buttons-adder'); ?>
149
+ <input data-id="8" type="radio" name="purposes[8]" value="legitimate"/>
150
+ <span class="lever"></span>
151
+ </label>
152
+ </div>
153
+ <div class="purpose-item">
154
+ <div class="title">
155
+ <?php echo esc_html__(
156
+ '9) Apply market research to generate audience insights (Do you aggregate reporting on the ads or content show to your site visitors to advertisers)',
157
+ 'simple-share-buttons-adder'
158
+ ); ?>
159
+ </div>
160
+ <label>
161
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
162
+ <input data-id="9" type="radio" name="purposes[9]" value="consent"/>
163
+ <span class="lever"></span>
164
+ </label>
165
+ <label>
166
+ <?php echo esc_html__('Legitimate Interest', 'simple-share-buttons-adder'); ?>
167
+ <input data-id="9" type="radio" name="purposes[9]" value="legitimate" checked />
168
+ <span class="lever"></span>
169
+ </label>
170
+ </div>
171
+ <div class="purpose-item">
172
+ <div class="title">
173
+ <?php echo esc_html__(
174
+ '10) Develop and improve products (Do you use data collected on your site visitors to improve your systems or software or create new products?)',
175
+ 'simple-share-buttons-adder'
176
+ ); ?>
177
+ </div>
178
+ <label>
179
+ <?php echo esc_html__('Consent', 'simple-share-buttons-adder'); ?>
180
+ <input data-id="10" type="radio" name="purposes[10]" value="consent"/>
181
+ <span class="lever"></span>
182
+ </label>
183
+ <label>
184
+ <?php echo esc_html__('Legitimate Interest', 'simple-share-buttons-adder'); ?>
185
+ <input data-id="10" type="radio" name="purposes[10]" value="legitimate" checked/>
186
+ <span class="lever"></span>
187
+ </label>
188
+ </div>
189
+ </div>
templates/config/gdpr/register.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Create account section of GDPR tab.
4
+ */
5
+
6
+ ?>
7
+ <h3>
8
+ <?php echo esc_html__('Create an account', 'sharethis-custom'); ?>
9
+ </h3>
10
+
11
+ <div class="sharethis-account-creation">
12
+ <div class="page-content" data-size="small" style="text-align: left;">
13
+ <div class="input">
14
+ <input type="text" id="st-email" name="email" placeholder="john@acme.com">
15
+ </div>
16
+ <div class="input " style="margin-bottom: 10px;">
17
+ <input type="password" id="st-password" name="password" minlength="6"
18
+ placeholder="Create a password">
19
+ </div>
20
+ <div style="margin: 20px 0 50px;" class="item gdpr-check">
21
+ <input id="email-enabled" type="checkbox"/>
22
+ <label class="gdpr">
23
+ <?php echo esc_html__('Subscribe to our monthly newsletter for tips and trends to grow your site.', 'sharethis-custom'); ?>
24
+ </label>
25
+ </div>
26
+ </div>
27
+ <div class="sharethis-login-message">
28
+ <p style="font-size:.9rem;">
29
+ <?php echo esc_html__('By clicking "Register," you certify that you are agreeing to our', 'sharethis-custom'); ?>
30
+ <a href="/privacy/" target="_blank" rel="nofollow">Privacy Policy</a> and <a
31
+ href="/publisher-terms-of-use/" target="_blank" rel="nofollow">Terms of Service</a> for
32
+ Publishers.
33
+ </p>
34
+ </div>
35
+
36
+ <a class="create-account st-rc-link medium-btn" href="#">
37
+ <?php esc_html_e('Register', 'sharethis'); ?>
38
+ </a>
39
+ </div>
templates/gdpr-tab.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * GDPR tab template.
4
+ *
5
+ * The template wrapper for the gdpr tab.
6
+ *
7
+ * @package SimpleShareButtonsAdder
8
+ */
9
+
10
+ $propertyid = get_option('ssba_property_id');
11
+ $ssba_settings = get_option('ssba_settings', true);
12
+ $gdpr_config = isset($ssba_settings['ssba_gdpr_config']) ?
13
+ $ssba_settings['ssba_gdpr_config'] :
14
+ '';
15
+ ?>
16
+ <div class="tab-pane gdpr-platform fade <?php echo 'active' === $gdpr ? esc_attr($gdpr . ' in'): ''; ?>" id="gdpr">
17
+ <div class="col-sm-12 ssba-tab-container">
18
+ <?php if (empty($propertyid)) : ?>
19
+ <div class="gdpr-landing">
20
+ <?php include plugin_dir_path(__FILE__) . 'config/gdpr/landing.php'; ?>
21
+ </div>
22
+ <div style="display:none;" class="gdpr-register">
23
+ <?php include plugin_dir_path(__FILE__) . 'config/gdpr/register.php'; ?>
24
+ </div>
25
+ <?php endif; ?>
26
+ <div
27
+ <?php if (empty($propertyid)) : ?>
28
+ style="display:none;"
29
+ <?php endif; ?>
30
+ class="gdpr-config"
31
+ >
32
+ <?php include plugin_dir_path(__FILE__) . 'config/gdpr/config.php'; ?>
33
+ </div>
34
+ </div>
35
+ </div>