Simple Share Buttons Adder - Version 8.2.4

Version Description

  • Test with WordPress 5.9.1.
  • Clean up and sanitize things.
Download this release

Release Info

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

Code changes from version 8.2.3 to 8.2.4

instance.php CHANGED
@@ -9,7 +9,7 @@ namespace SimpleShareButtonsAdder;
9
 
10
  define( 'SSBA_FILE', __FILE__ );
11
  define( 'SSBA_ROOT', dirname( __FILE__ ) );
12
- define( 'SSBA_VERSION', '8.2.3' );
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.2.4' );
13
 
14
  global $simple_share_buttons_adder_plugin;
15
 
js/ssba.js CHANGED
@@ -22,9 +22,11 @@ var Main = ( function( $, FB ) {
22
  boot: function( data ) {
23
  this.data = data;
24
 
25
- $( document ).ready( function() {
26
- this.init();
27
- }.bind( this ) );
 
 
28
  },
29
 
30
  /**
@@ -42,12 +44,16 @@ var Main = ( function( $, FB ) {
42
  var self = this;
43
 
44
  // Upon clicking a share button.
45
- $( 'body' ).on( 'click', '.ssbp-wrap a', function( event ) {
 
 
 
46
 
47
- // Don't go the the href yet.
48
- event.preventDefault();
49
- self.engageShareButton( this );
50
- } );
 
51
  },
52
 
53
  /**
@@ -59,11 +65,14 @@ var Main = ( function( $, FB ) {
59
 
60
  // If it's facebook mobile.
61
  if ( 'mobile' === $( event ).data( 'facebook' ) ) {
62
- FB.ui( {
63
- method: 'share',
64
- mobile_iframe: true,
65
- href: $( event ).data( 'href' )
66
- }, function( response ) {} );
 
 
 
67
  } else {
68
 
69
  // These share options don't need to have a popup.
@@ -76,13 +85,13 @@ var Main = ( function( $, FB ) {
76
  // Prepare popup window.
77
  var width = 575,
78
  height = 520,
79
- left = ( $( window ).width() - width ) / 2,
80
- top = ( $( window ).height() - height ) / 2,
81
- opts = 'status=1' +
82
- ',width=' + width +
83
- ',height=' + height +
84
- ',top=' + top +
85
- ',left=' + left;
86
 
87
  // Open the share url in a smaller window.
88
  window.open( $( event ).attr( 'href' ), 'share', opts );
22
  boot: function( data ) {
23
  this.data = data;
24
 
25
+ $( document ).ready(
26
+ function() {
27
+ this.init();
28
+ }.bind( this )
29
+ );
30
  },
31
 
32
  /**
44
  var self = this;
45
 
46
  // Upon clicking a share button.
47
+ $( 'body' ).on(
48
+ 'click',
49
+ '.ssbp-wrap a',
50
+ function( event ) {
51
 
52
+ // Don't go the the href yet.
53
+ event.preventDefault();
54
+ self.engageShareButton( this );
55
+ }
56
+ );
57
  },
58
 
59
  /**
65
 
66
  // If it's facebook mobile.
67
  if ( 'mobile' === $( event ).data( 'facebook' ) ) {
68
+ FB.ui(
69
+ {
70
+ method: 'share',
71
+ mobile_iframe: true,
72
+ href: $( event ).data( 'href' )
73
+ },
74
+ function( response ) {}
75
+ );
76
  } else {
77
 
78
  // These share options don't need to have a popup.
85
  // Prepare popup window.
86
  var width = 575,
87
  height = 520,
88
+ left = ( $( window ).width() - width ) / 2,
89
+ top = ( $( window ).height() - height ) / 2,
90
+ opts = 'status=1' +
91
+ ',width=' + width +
92
+ ',height=' + height +
93
+ ',top=' + top +
94
+ ',left=' + left;
95
 
96
  // Open the share url in a smaller window.
97
  window.open( $( event ).attr( 'href' ), 'share', opts );
php/class-admin-bits.php CHANGED
@@ -12,236 +12,253 @@ namespace SimpleShareButtonsAdder;
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
- class Admin_Bits
16
- {
17
-
18
- /**
19
- * Plugin instance.
20
- *
21
- * @var object
22
- */
23
- public $plugin;
24
-
25
- /**
26
- * Simple_Share_Buttons_Adder instance.
27
- *
28
- * @var object
29
- */
30
- public $class_ssba;
31
-
32
- /**
33
- * Database instance.
34
- *
35
- * @var object
36
- */
37
- public $database;
38
-
39
- /**
40
- * Admin Panel instance.
41
- *
42
- * @var object
43
- */
44
- public $admin_panel;
45
-
46
- /**
47
- * Class constructor.
48
- *
49
- * @param object $plugin Plugin class.
50
- * @param object $class_ssba Simple Share Buttons Adder class.
51
- * @param object $database Database class.
52
- * @param object $admin_panel Admin Panel class.
53
- */
54
- public function __construct($plugin, $class_ssba, $database, $admin_panel)
55
- {
56
- $this->plugin = $plugin;
57
- $this->class_ssba = $class_ssba;
58
- $this->database = $database;
59
- $this->admin_panel = $admin_panel;
60
- }
61
-
62
- /**
63
- * ShareThis terms notice detector.
64
- *
65
- */
66
- public static function sharethisTermsNotice()
67
- {
68
- $arr_settings = get_option('ssba_settings', true);
69
-
70
- // If the sharethis terms have not yet been accepted.
71
- if (isset($arr_settings['accepted_sharethis_terms']) && 'Y' !== $arr_settings['accepted_sharethis_terms']) {
72
- ?>
73
- <div id="sharethis_terms_notice" class="update-nag notice is-dismissible">
74
- <p>
75
- <?php esc_html_e('We\'ve updated our', 'simple-share-buttons-adder'); ?>
76
- <a style="text-decoration: underline;" href="http://simplesharebuttons.com/privacy" target="_blank">
77
- <?php echo esc_html__('privacy policy and terms of use ',
78
- 'simple-share-buttons-adder'); ?>
79
- </a>
80
- <?php echo esc_html__('with important changes you should review. To take advantage of the new features, please review and accept the new ',
81
- 'simple-share-buttons-adder'); ?>
82
- <a style="text-decoration: underline;" href="http://simplesharebuttons.com/privacy" target="_blank">
83
- <?php esc_html_e('terms and privacy policy', 'simple-share-button-adder'); ?>
84
- </a>.
85
- <a href="options-general.php?page=simple-share-buttons-adder&accept-terms=Y">
 
 
 
 
86
  <span class="button button-primary">
87
- <?php echo esc_html__('I accept', 'simple-share-buttons-adder'); ?>
88
  </span>
89
- </a>
90
- </p>
91
- </div>
92
- <?php
93
- }
94
- }
95
-
96
- /**
97
- * Add settings link on plugin page.
98
- *
99
- * @filter plugin_action_links_simple-share-buttons-adder
100
- *
101
- * @param array $links The supplied links.
102
- *
103
- * @return mixed
104
- */
105
- public function ssbaSettingsLink($links)
106
- {
107
- // Add to plugins links.
108
- array_unshift($links,
109
- '<a href="options-general.php?page=simple-share-buttons-adder">' . esc_html__('Settings') . '</a>');
110
-
111
- return $links;
112
- }
113
-
114
- /**
115
- * AJAX Call for adding hide option to review popup.
116
- *
117
- * @action wp_ajax_ssba_ajax_hide_review
118
- *
119
- * @param $post
120
- */
121
- public function ssbaAjaxHideReview($post)
122
- {
123
- update_option('ssba-hide-review', true);
124
-
125
- wp_send_json_success('hidden');
126
- }
127
-
128
- /**
129
- * AJAX Call for saving property id and token.
130
- *
131
- * @action wp_ajax_ssba_ajax_add_creds
132
- *
133
- * @param $post
134
- */
135
- public function ssbaAjaxAddCreds()
136
- {
137
- check_ajax_referer($this->plugin->meta_prefix, 'nonce');
138
-
139
- if (!isset($_POST['propertyId'], $_POST['token']) ||
140
- in_array('', [$_POST['propertyId'], $_POST['token']], true)) {
141
- wp_send_json_error('Property Creation Failed.');
142
- }
143
-
144
- $property_id = sanitize_text_field(wp_unslash($_POST['propertyId']));
145
- $token = sanitize_text_field(wp_unslash($_POST['token']));
146
-
147
- update_option('ssba_property_id', $property_id);
148
- update_option('ssba_token', $token);
149
- }
150
-
151
- /**
152
- * Includes js/css files and upload script.
153
- *
154
- * @param string $hook_suffix The current admin page hook suffix.
155
- *
156
- * @action admin_enqueue_scripts
157
- */
158
- public function enqueueAdminAssets($hook_suffix)
159
- {
160
- $current_url = $this->plugin->dir_url . 'buttons/';
161
-
162
- if ($this->hook_suffix === $hook_suffix) {
163
- // All extra scripts needed.
164
- wp_enqueue_media();
165
- wp_enqueue_script('media-upload');
166
- wp_enqueue_script('jquery-ui-sortable');
167
- wp_enqueue_script('jquery-ui');
168
- wp_enqueue_script("{$this->plugin->assets_prefix}-bootstrap-js");
169
- wp_enqueue_script("{$this->plugin->assets_prefix}-colorpicker");
170
- wp_enqueue_script("{$this->plugin->assets_prefix}-switch");
171
- wp_enqueue_script("{$this->plugin->assets_prefix}-admin");
172
-
173
- // Get sbba settings.
174
- $arr_settings = $this->class_ssba->get_ssba_settings();
175
- $token = get_option('ssba_token');
176
- $propertyid = get_option('ssba_property_id');
177
-
178
- wp_add_inline_script("{$this->plugin->assets_prefix}-admin", sprintf('%s.boot( %s );',
179
- __NAMESPACE__,
180
- wp_json_encode(array(
181
- 'site' => $current_url,
182
- 'homeUrl' => str_replace(['https://', 'http://'], '', get_home_url()),
183
- 'nonce' => wp_create_nonce($this->plugin->meta_prefix),
184
- 'publisher_purposes' => !empty($arr_settings['ssba_gdpr_config']['publisher_purposes']) ? $arr_settings['ssba_gdpr_config']['publisher_purposes'] : false,
185
- 'publisher_restrictions' => !empty($arr_settings['ssba_gdpr_config']['publisher_restrictions']) ? $arr_settings['ssba_gdpr_config']['publisher_restrictions'] : false,
186
- 'token' => !empty($token) ? $token : false,
187
- 'propertyid' => !empty($propertyid) ? $propertyid : false
188
- ))
189
- ));
190
-
191
- $custom_css = ! empty($arr_settings['ssba_additional_css']) ? $arr_settings['ssba_additional_css'] : '';
192
- $custom_css .= ! empty($arr_settings['ssba_plus_additional_css']) ? $arr_settings['ssba_plus_additional_css'] : '';
193
- $custom_css .= ! empty($arr_settings['ssba_bar_additional_css']) ? $arr_settings['ssba_bar_additional_css'] : '';
194
-
195
- wp_add_inline_style("{$this->plugin->assets_prefix}-admin-theme", $custom_css);
196
-
197
- // Admin styles.
198
- wp_enqueue_style("{$this->plugin->assets_prefix}-readable");
199
- wp_enqueue_style("{$this->plugin->assets_prefix}-colorpicker");
200
- wp_enqueue_style("{$this->plugin->assets_prefix}-switch");
201
- wp_enqueue_style("{$this->plugin->assets_prefix}-font-awesome");
202
- wp_enqueue_style("{$this->plugin->assets_prefix}-admin-theme");
203
- wp_enqueue_style("{$this->plugin->assets_prefix}-admin");
204
- wp_enqueue_style("{$this->plugin->assets_prefix}-styles");
205
-
206
- $html_share_buttons_form = '';
207
-
208
- // Get settings.
209
- $arr_settings = $this->class_ssba->get_ssba_settings();
210
-
211
- // If user is accepting terms.
212
- if (isset($_GET['accept-terms']) && 'Y' === $_GET['accept-terms']) { // WPCS: CSRF ok.
213
- // Save acceptance.
214
- $this->class_ssba->ssba_update_options(array(
215
- 'accepted_sharethis_terms' => 'Y',
216
- ));
217
-
218
- // Hide the notice for now, it will disappear upon reload.
219
- $html_share_buttons_form .= '#sharethis_terms_notice { display: none }.ssbp-facebook_save { background-color: #365397 !important; }';
220
- }
221
-
222
- // Get the font family needed.
223
- $html_share_buttons_form .= $this->get_font_family();
224
-
225
- // If left to right.
226
- if (is_rtl()) {
227
- // Move save button.
228
- $html_share_buttons_form .= '.ssba-btn-save{ left: 0!important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  right: auto !important;
230
  border-radius: 0 5px 5px 0; }';
231
- }
232
-
233
- wp_add_inline_style("{$this->plugin->assets_prefix}-admin-theme", $html_share_buttons_form);
234
- }
235
- }
236
-
237
- /**
238
- * Get ssbp font family.
239
- *
240
- * @return string
241
- */
242
- private function get_font_family()
243
- {
244
- return "@font-face {
245
  font-family: 'ssbp';
246
  src:url('{$this->plugin->dir_url}fonts/ssbp.eot?xj3ol1');
247
  src:url('{$this->plugin->dir_url}fonts/ssbp.eot?#iefixxj3ol1') format('embedded-opentype'),
@@ -255,322 +272,337 @@ class Admin_Bits
255
  -webkit-font-smoothing: antialiased;
256
  -moz-osx-font-smoothing: grayscale;
257
  }";
258
- }
259
-
260
- /**
261
- * Save dismiss notice status.
262
- *
263
- * @action wp_ajax_dismiss_notice
264
- */
265
- public function dismissNotice()
266
- {
267
- check_ajax_referer($this->plugin->meta_prefix, 'nonce');
268
-
269
- if (! isset($_POST['type']) || '' === $_POST['type']) { // WPCS: input var okay.
270
- wp_send_json_error('dismiss notice failed');
271
- }
272
-
273
- $type = sanitize_text_field(wp_unslash($_POST['type']));
274
- $current_notices = get_option('ssba_dismiss_notice');
275
- $current_notices = null !== $current_notices && false !== $current_notices && '' !== $current_notices ? $current_notices : '';
276
-
277
- if ('' !== $current_notices) {
278
- $new_notice = array_merge($current_notices, array(
279
- $type => false,
280
- ));
281
- } else {
282
- $new_notice = array(
283
- $type => false,
284
- );
285
- }
286
-
287
- update_option('ssba_dismiss_notice', $new_notice);
288
- }
289
-
290
- /**
291
- * Save dismiss notice status.
292
- *
293
- * @action wp_ajax_ssba_ajax_update_gdpr
294
- */
295
- public function updateGdpr()
296
- {
297
- check_ajax_referer($this->plugin->meta_prefix, 'nonce');
298
-
299
- if (! isset($_POST['config']) || '' === $_POST['config']) { // WPCS: input var okay.
300
- wp_send_json_error('gdpr update fail');
301
- }
302
-
303
- $current_settings = get_option('ssba_settings');
304
- $current_settings = !empty($current_settings) ? $current_settings : '';
305
-
306
- if ('' === $current_settings) {
307
- wp_send_json_error('no settings');
308
- }
309
-
310
- $current_settings['ssba_gdpr_config'] = $_POST['config'];
311
-
312
- update_option('ssba_settings', $current_settings);
313
- }
314
-
315
-
316
- /**
317
- * Register the new simple share button adder menu dashboard link.
318
- *
319
- * @action admin_menu
320
- */
321
- public function addSsbaMenu()
322
- {
323
- $icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDIwMDEwOTA0Ly9FTiIKICJodHRwOi8vd3d3LnczLm9yZy9UUi8yMDAxL1JFQy1TVkctMjAwMTA5MDQvRFREL3N2ZzEwLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiB3aWR0aD0iMjcyLjAwMDAwMHB0IiBoZWlnaHQ9IjIzNi4wMDAwMDBwdCIgdmlld0JveD0iMCAwIDI3Mi4wMDAwMDAgMjM2LjAwMDAwMCIKIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIG1lZXQiPgoKPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsMjM2LjAwMDAwMCkgc2NhbGUoMC4xMDAwMDAsLTAuMTAwMDAwKSIKZmlsbD0iIzAwMDAwMCIgc3Ryb2tlPSJub25lIj4KPHBhdGggZD0iTTk3NSAyMjkzIGMtMTQwIC0xNiAtMjQ2IC00OCAtMzY5IC0xMTEgLTI3NSAtMTQxIC00NjEgLTM5MCAtNTI3Ci03MDcgLTE2IC03NyAtMTYgLTI4MyAwIC0zNjAgODIgLTM5NCAzNTkgLTY5MSA3MzcgLTc5MCAxNjQgLTQzIDM1MSAtNDEgNTI2CjYgMTE0IDMxIDExNSAzMiA4NyAxMTAgLTEyIDM1IC0yMyA2NSAtMjQgNjYgLTEgMiAtMjUgLTYgLTUzIC0xNyAtMTE1IC00NAotMjkxIC02MCAtNDIyIC00MCAtMjg3IDQ2IC01MjUgMjI2IC02NDkgNDkyIC01MyAxMTEgLTcwIDE4MyAtNzggMzA4IC0xNCAyNDgKNjYgNDY1IDIzNSA2NDIgMTc5IDE4OCA0MDMgMjc3IDY2MSAyNjUgNjQgLTMgMTQxIC0xMiAxNzEgLTIwIDI1MyAtNzAgNDQxCi0yMTkgNTU4IC00NDUgNDcgLTg5IDkyIC0yNDcgOTIgLTMyMCBsMCAtNDUgNTMgNyBjMjggMyA2MyA2IDc2IDYgMjMgMCAyMyAxCjE3IDYzIC0xNyAxNTIgLTkzIDM1MyAtMTgwIDQ3MiAtOTQgMTMwIC0yNTcgMjY0IC00MDAgMzMwIC0xNTIgNzEgLTM1OSAxMDYKLTUxMSA4OHoiLz4KPHBhdGggZD0iTTg3MCAyMDcwIGMtMjIxIC01OSAtNDA5IC0yMDYgLTUwOSAtNDAwIC02MiAtMTE5IC04MiAtMTk4IC04OCAtMzM1Ci01IC0xMzMgOCAtMjIwIDUwIC0zMjUgNzkgLTE5NCAyNTAgLTM2NyA0NDAgLTQ0MyAxNjcgLTY3IDM3NiAtNzUgNTM3IC0yMQpsODUgMjkgNiAxMTAgYzE2IDI2NiAxNDYgNDY4IDM3NiA1ODIgbDkyIDQ2IC01IDUxIGMtMzMgMzI1IC0yNDIgNTg5IC01NDkKNjkyIC02OCAyMiAtMTAxIDI3IC0yMjAgMzAgLTExNyAzIC0xNTMgMSAtMjE1IC0xNnogbTU4IC01MjUgYzM4IC0zMiA0OCAtNzIKMjggLTExOCAtNDUgLTEwOCAtMTk1IC03NiAtMTk2IDQxIDAgOTAgOTkgMTM1IDE2OCA3N3ogbTM3MiAxMCBjMzcgLTE5IDUwCi00MyA1MCAtOTUgMCAtNTcgLTQyIC0xMDAgLTk3IC0xMDAgLTEwMSAwIC0xNDggMTIwIC03MiAxODQgMzUgMzAgNzYgMzMgMTE5CjExeiBtLTM2MCAtNDEyIGM0MiAtMzkgNDkgLTg3IDE4IC0xMzMgLTM5IC01OCAtMTE0IC02NSAtMTY0IC0xNSAtMTggMTkgLTI0CjM1IC0yNCA3MCAwIDk1IDEwMCAxNDAgMTcwIDc4eiBtMzY5IDEzIGM1OCAtMzAgNjkgLTExOSAyMiAtMTY3IC0yMyAtMjMgLTM4Ci0yOSAtNzEgLTI5IC0zNSAwIC00OCA2IC03NyAzNSAtMzIgMzIgLTM1IDQwIC0zMCA3NiAxMSA4MSA4NSAxMjEgMTU2IDg1eiIvPgo8cGF0aCBkPSJNMTkxMiAxMjUwIGMtMTEwIC0yOSAtMTg3IC03NSAtMjczIC0xNjAgLTEyMiAtMTIwIC0xNzkgLTI1NiAtMTc5Ci00MjUgMCAtMTcwIDU3IC0zMDMgMTgxIC00MjYgMzQwIC0zNDAgOTA5IC0xNjggMTAxNCAzMDUgNjUgMjkyIC0xMDggNTkyCi0zOTcgNjkzIC0xMDIgMzUgLTI0NSA0MSAtMzQ2IDEzeiBtMTk4IC0zNjkgYzUgLTExIDEwIC00OSAxMCAtODUgbDAgLTY2IDc3CjAgYzg5IDAgMTEzIC0xNCAxMTMgLTY2IDAgLTQ4IC0yOCAtNjQgLTExNyAtNjQgbC03MyAwIDAgLTgyIGMwIC05MCAtMTQgLTExOAotNTcgLTExOCAtNTUgMCAtNjMgMTMgLTYzIDExMCBsMCA5MCAtNzMgMCBjLTg5IDAgLTExNyAxNSAtMTE3IDY1IDAgNTMgMjAgNjUKMTExIDY1IGw3OSAwIDAgNzMgYzAgNDMgNSA3OCAxMiA4NSAyMCAyMCA4NiAxNSA5OCAtN3oiLz4KPC9nPgo8L3N2Zz4K';
324
-
325
- add_menu_page(
326
- 'Simple Share Buttons Adder',
327
- 'Simple Share Buttons',
328
- 'manage_options',
329
- 'simple-share-buttons-adder',
330
- array($this, 'ssbaSettings'),
331
- $icon,
332
- 26
333
- );
334
- }
335
-
336
- /**
337
- * Menu settings.
338
- *
339
- * @action admin_menu
340
- */
341
- public function ssbaMenu()
342
- {
343
- // Add menu page.
344
- $this->hook_suffix = add_options_page(
345
- esc_html__('Simple Share Buttons Adder', 'simple-share-buttons-adder'),
346
- esc_html__('Simple Share Buttons', 'simple-share-buttons-adder'),
347
- 'manage_options',
348
- $this->plugin->assets_prefix,
349
- array($this, 'ssbaSettings')
350
- );
351
-
352
- // Query the db for current ssba settings.
353
- $arr_settings = $this->class_ssba->get_ssba_settings();
354
-
355
- // Get the current version.
356
- $version = get_option('ssba_version');
357
-
358
- // There was a version set.
359
- if (false !== $version) {
360
- // Check if not updated to current version.
361
- if ($version < SSBA_VERSION) {
362
- // Run the upgrade function.
363
- $this->database->upgrade_ssba($arr_settings, $version);
364
- }
365
- }
366
- }
367
-
368
- /**
369
- * Answer form.
370
- *
371
- * @return bool
372
- */
373
- public function ssbaSettings()
374
- {
375
- // Check if user has the rights to manage options.
376
- if ( ! current_user_can('manage_options')) {
377
- // Permissions message.
378
- wp_die(esc_html__('You do not have sufficient permissions to access this page.',
379
- 'simple-share-buttons-adder'));
380
- }
381
-
382
- // If a post has been made.
383
- if (isset($_POST['ssbaData'])) { // WPCS: CSRF ok.
384
- // Get posted data.
385
- $ssba_post = $_POST['ssbaData']; // WPCS: CSRF ok.
386
- $selected_tab = isset($_POST['ssba_selected_tab']) ? sanitize_text_field(wp_unslash($_POST['ssba_selected_tab'])) : ''; // WPCS: CSRF ok.
387
- $gdpr_config = !empty($_POST['gdpr_config']) ? $_POST['gdpr_config'] : '';
388
- parse_str($ssba_post, $ssba_post);
389
-
390
- // If the nonce doesn't check out.
391
- if ( ! isset($ssba_post['ssba_save_nonce']) || ! wp_verify_nonce($ssba_post['ssba_save_nonce'],
392
- 'ssba_save_settings')) {
393
- die(esc_html__('There was no nonce provided, or the one provided did not verify.',
394
- 'simple-share-buttons-adder'));
395
- }
396
-
397
- // Prepare array.
398
- $arr_options = array(
399
- 'ssba_image_set' => $ssba_post['ssba_image_set'],
400
- 'ssba_size' => $ssba_post['ssba_size'],
401
- 'ssba_omit_pages' => (isset($ssba_post['ssba_omit_pages']) ? $ssba_post['ssba_omit_pages'] : ''),
402
- 'ssba_omit_pages_plus' => (isset($ssba_post['ssba_omit_pages_plus']) ? $ssba_post['ssba_omit_pages_plus'] : ''),
403
- 'ssba_omit_pages_bar' => (isset($ssba_post['ssba_omit_pages_bar']) ? $ssba_post['ssba_omit_pages_bar'] : ''),
404
- 'ssba_pages' => (isset($ssba_post['ssba_pages']) ? $ssba_post['ssba_pages'] : 'N'),
405
- 'ssba_posts' => (isset($ssba_post['ssba_posts']) ? $ssba_post['ssba_posts'] : 'N'),
406
- 'ssba_cats_archs' => (isset($ssba_post['ssba_cats_archs']) ? $ssba_post['ssba_cats_archs'] : 'N'),
407
- 'ssba_homepage' => (isset($ssba_post['ssba_homepage']) ? $ssba_post['ssba_homepage'] : 'N'),
408
- 'ssba_excerpts' => (isset($ssba_post['ssba_excerpts']) ? $ssba_post['ssba_excerpts'] : 'N'),
409
- 'ssba_plus_pages' => (isset($ssba_post['ssba_plus_pages']) ? $ssba_post['ssba_plus_pages'] : 'N'),
410
- 'ssba_plus_posts' => (isset($ssba_post['ssba_plus_posts']) ? $ssba_post['ssba_plus_posts'] : 'N'),
411
- 'ssba_plus_cats_archs' => (isset($ssba_post['ssba_plus_cats_archs']) ? $ssba_post['ssba_plus_cats_archs'] : 'N'),
412
- 'ssba_plus_homepage' => (isset($ssba_post['ssba_plus_homepage']) ? $ssba_post['ssba_plus_homepage'] : 'N'),
413
- 'ssba_plus_excerpts' => (isset($ssba_post['ssba_plus_excerpts']) ? $ssba_post['ssba_plus_excerpts'] : 'N'),
414
- 'ssba_bar_pages' => (isset($ssba_post['ssba_bar_pages']) ? $ssba_post['ssba_bar_pages'] : 'N'),
415
- 'ssba_bar_posts' => (isset($ssba_post['ssba_bar_posts']) ? $ssba_post['ssba_bar_posts'] : 'N'),
416
- 'ssba_bar_cats_archs' => (isset($ssba_post['ssba_bar_cats_archs']) ? $ssba_post['ssba_bar_cats_archs'] : 'N'),
417
- 'ssba_bar_homepage' => (isset($ssba_post['ssba_bar_homepage']) ? $ssba_post['ssba_bar_homepage'] : 'N'),
418
- 'ssba_bar_excerpts' => (isset($ssba_post['ssba_bar_excerpts']) ? $ssba_post['ssba_bar_excerpts'] : 'N'),
419
- 'ssba_align' => (isset($ssba_post['ssba_align']) ? $ssba_post['ssba_align'] : 'N'),
420
- 'ssba_plus_align' => (isset($ssba_post['ssba_plus_align']) ? $ssba_post['ssba_plus_align'] : 'N'),
421
- 'ssba_padding' => $ssba_post['ssba_padding'],
422
- 'ssba_before_or_after' => $ssba_post['ssba_before_or_after'],
423
- 'ssba_before_or_after_plus' => $ssba_post['ssba_before_or_after_plus'],
424
- 'ssba_additional_css' => $ssba_post['ssba_additional_css'],
425
- 'ssba_custom_styles' => $ssba_post['ssba_custom_styles'],
426
- 'ssba_custom_styles_enabled' => $ssba_post['ssba_custom_styles_enabled'],
427
- 'ssba_email_message' => stripslashes_deep($ssba_post['ssba_email_message']),
428
- 'ssba_twitter_text' => stripslashes_deep($ssba_post['ssba_twitter_text']),
429
- 'ssba_buffer_text' => stripslashes_deep($ssba_post['ssba_buffer_text']),
430
- 'ssba_flattr_user_id' => stripslashes_deep($ssba_post['ssba_flattr_user_id']),
431
- 'ssba_flattr_url' => stripslashes_deep($ssba_post['ssba_flattr_url']),
432
- 'ssba_share_new_window' => (isset($ssba_post['ssba_share_new_window']) ? $ssba_post['ssba_share_new_window'] : 'N'),
433
- 'ssba_link_to_ssb' => (isset($ssba_post['ssba_link_to_ssb']) ? $ssba_post['ssba_link_to_ssb'] : 'N'),
434
- 'ssba_show_share_count' => (isset($ssba_post['ssba_show_share_count']) ? $ssba_post['ssba_show_share_count'] : 'N'),
435
- 'ssba_share_count_style' => $ssba_post['ssba_share_count_style'],
436
- 'ssba_share_count_css' => $ssba_post['ssba_share_count_css'],
437
- 'ssba_share_count_once' => (isset($ssba_post['ssba_share_count_once']) ? $ssba_post['ssba_share_count_once'] : 'N'),
438
- 'ssba_widget_text' => $ssba_post['ssba_widget_text'],
439
- 'ssba_rel_nofollow' => (isset($ssba_post['ssba_rel_nofollow']) ? $ssba_post['ssba_rel_nofollow'] : 'N'),
440
- 'ssba_default_pinterest' => (isset($ssba_post['ssba_default_pinterest']) ? $ssba_post['ssba_default_pinterest'] : 'N'),
441
- 'ssba_pinterest_featured' => (isset($ssba_post['ssba_pinterest_featured']) ? $ssba_post['ssba_pinterest_featured'] : 'N'),
442
- 'ssba_content_priority' => (isset($ssba_post['ssba_content_priority']) ? $ssba_post['ssba_content_priority'] : 'N'),
443
- 'ssba_plus_additional_css' => $ssba_post['ssba_plus_additional_css'],
444
- 'ssba_plus_email_message' => stripslashes_deep($ssba_post['ssba_plus_email_message']),
445
- 'ssba_plus_twitter_text' => stripslashes_deep($ssba_post['ssba_plus_twitter_text']),
446
- 'ssba_plus_buffer_text' => stripslashes_deep($ssba_post['ssba_plus_buffer_text']),
447
- 'ssba_plus_flattr_user_id' => stripslashes_deep($ssba_post['ssba_plus_flattr_user_id']),
448
- 'ssba_plus_flattr_url' => stripslashes_deep($ssba_post['ssba_plus_flattr_url']),
449
- 'ssba_plus_share_new_window' => (isset($ssba_post['ssba_plus_share_new_window']) ? $ssba_post['ssba_plus_share_new_window'] : 'N'),
450
- 'ssba_plus_link_to_ssb' => (isset($ssba_post['ssba_plus_link_to_ssb']) ? $ssba_post['ssba_plus_link_to_ssb'] : 'N'),
451
- 'ssba_plus_show_share_count' => (isset($ssba_post['ssba_plus_show_share_count']) ? $ssba_post['ssba_plus_show_share_count'] : 'N'),
452
- 'ssba_plus_share_count_style' => $ssba_post['ssba_plus_share_count_style'],
453
- 'ssba_plus_share_count_css' => $ssba_post['ssba_plus_share_count_css'],
454
- 'ssba_plus_share_count_once' => (isset($ssba_post['ssba_plus_share_count_once']) ? $ssba_post['ssba_plus_share_count_once'] : 'N'),
455
- 'ssba_plus_widget_text' => $ssba_post['ssba_plus_widget_text'],
456
- 'ssba_plus_rel_nofollow' => (isset($ssba_post['ssba_plus_rel_nofollow']) ? $ssba_post['ssba_plus_rel_nofollow'] : 'N'),
457
- 'ssba_plus_default_pinterest' => (isset($ssba_post['ssba_plus_default_pinterest']) ? $ssba_post['ssba_plus_default_pinterest'] : 'N'),
458
- 'ssba_plus_pinterest_featured' => (isset($ssba_post['ssba_plus_pinterest_featured']) ? $ssba_post['ssba_plus_pinterest_featured'] : 'N'),
459
- 'ssba_bar_additional_css' => $ssba_post['ssba_bar_additional_css'],
460
- 'ssba_bar_email_message' => stripslashes_deep($ssba_post['ssba_bar_email_message']),
461
- 'ssba_bar_twitter_text' => stripslashes_deep($ssba_post['ssba_bar_twitter_text']),
462
- 'ssba_bar_buffer_text' => stripslashes_deep($ssba_post['ssba_bar_buffer_text']),
463
- 'ssba_bar_flattr_user_id' => stripslashes_deep($ssba_post['ssba_bar_flattr_user_id']),
464
- 'ssba_bar_flattr_url' => stripslashes_deep($ssba_post['ssba_bar_flattr_url']),
465
- 'ssba_bar_share_new_window' => (isset($ssba_post['ssba_bar_share_new_window']) ? $ssba_post['ssba_bar_share_new_window'] : 'N'),
466
- 'ssba_bar_link_to_ssb' => (isset($ssba_post['ssba_bar_link_to_ssb']) ? $ssba_post['ssba_bar_link_to_ssb'] : 'N'),
467
- 'ssba_bar_show_share_count' => (isset($ssba_post['ssba_bar_show_share_count']) ? $ssba_post['ssba_bar_show_share_count'] : 'N'),
468
- 'ssba_bar_share_count_style' => $ssba_post['ssba_bar_share_count_style'],
469
- 'ssba_bar_share_count_css' => $ssba_post['ssba_bar_share_count_css'],
470
- 'ssba_bar_share_count_once' => (isset($ssba_post['ssba_bar_share_count_once']) ? $ssba_post['ssba_bar_share_count_once'] : 'N'),
471
- 'ssba_bar_widget_text' => $ssba_post['ssba_bar_widget_text'],
472
- 'ssba_bar_rel_nofollow' => (isset($ssba_post['ssba_bar_rel_nofollow']) ? $ssba_post['ssba_bar_rel_nofollow'] : 'N'),
473
- 'ssba_bar_default_pinterest' => (isset($ssba_post['ssba_bar_default_pinterest']) ? $ssba_post['ssba_bar_default_pinterest'] : 'N'),
474
- 'ssba_bar_pinterest_featured' => (isset($ssba_post['ssba_bar_pinterest_featured']) ? $ssba_post['ssba_bar_pinterest_featured'] : 'N'),
475
-
476
- // Share container.
477
- 'ssba_div_padding' => $ssba_post['ssba_div_padding'],
478
- 'ssba_div_rounded_corners' => (isset($ssba_post['ssba_div_rounded_corners']) ? $ssba_post['ssba_div_rounded_corners'] : 'N'),
479
- 'ssba_border_width' => $ssba_post['ssba_border_width'],
480
- 'ssba_div_border' => $ssba_post['ssba_div_border'],
481
- 'ssba_div_background' => $ssba_post['ssba_div_background'],
482
-
483
- // Text.
484
- 'ssba_share_text' => stripslashes_deep($ssba_post['ssba_share_text']),
485
- 'ssba_text_placement' => $ssba_post['ssba_text_placement'],
486
- 'ssba_font_family' => $ssba_post['ssba_font_family'],
487
- 'ssba_font_color' => $ssba_post['ssba_font_color'],
488
- 'ssba_font_size' => $ssba_post['ssba_font_size'],
489
- 'ssba_font_weight' => $ssba_post['ssba_font_weight'],
490
- 'ssba_plus_share_text' => stripslashes_deep($ssba_post['ssba_plus_share_text']),
491
- 'ssba_plus_text_placement' => $ssba_post['ssba_plus_text_placement'],
492
- 'ssba_plus_font_family' => $ssba_post['ssba_plus_font_family'],
493
- 'ssba_plus_font_color' => $ssba_post['ssba_plus_font_color'],
494
- 'ssba_plus_font_size' => $ssba_post['ssba_plus_font_size'],
495
- 'ssba_plus_font_weight' => $ssba_post['ssba_plus_font_weight'],
496
-
497
- // Included buttons.
498
- 'ssba_selected_buttons' => $ssba_post['ssba_selected_buttons'],
499
- 'ssba_selected_bar_buttons' => $ssba_post['ssba_selected_bar_buttons'],
500
- 'ssba_selected_plus_buttons' => $ssba_post['ssba_selected_plus_buttons'],
501
- 'ssba_plus_button_style' => $ssba_post['ssba_plus_button_style'],
502
- 'ssba_bar_style' => $ssba_post['ssba_bar_style'],
503
- 'ssba_new_buttons' => $ssba_post['ssba_new_buttons'],
504
- 'ssba_bar_enabled' => $ssba_post['ssba_bar_enabled'],
505
- 'ssba_bar_position' => $ssba_post['ssba_bar_position'],
506
- 'ssba_plus_height' => $ssba_post['ssba_plus_height'],
507
- 'ssba_plus_width' => $ssba_post['ssba_plus_width'],
508
- 'ssba_plus_margin' => $ssba_post['ssba_plus_margin'],
509
- 'ssba_plus_button_color' => $ssba_post['ssba_plus_button_color'],
510
- 'ssba_plus_button_hover_color' => $ssba_post['ssba_plus_button_hover_color'],
511
- 'ssba_plus_icon_size' => $ssba_post['ssba_plus_icon_size'],
512
- 'ssba_plus_icon_color' => $ssba_post['ssba_plus_icon_color'],
513
- 'ssba_plus_icon_hover_color' => $ssba_post['ssba_plus_icon_hover_color'],
514
- 'ssba_bar_height' => $ssba_post['ssba_bar_height'],
515
- 'ssba_bar_width' => $ssba_post['ssba_bar_width'],
516
- 'ssba_bar_button_color' => $ssba_post['ssba_bar_button_color'],
517
- 'ssba_bar_button_hover_color' => $ssba_post['ssba_bar_button_hover_color'],
518
- 'ssba_bar_icon_size' => $ssba_post['ssba_bar_icon_size'],
519
- 'ssba_bar_icon_color' => $ssba_post['ssba_bar_icon_color'],
520
- 'ssba_bar_icon_hover_color' => $ssba_post['ssba_bar_icon_hover_color'],
521
- 'ssba_bar_desktop' => isset($ssba_post['ssba_bar_desktop']) ? $ssba_post['ssba_bar_desktop'] : 'N',
522
- 'ssba_bar_margin' => $ssba_post['ssba_bar_margin'],
523
- 'ssba_bar_mobile' => isset($ssba_post['ssba_bar_mobile']) ? $ssba_post['ssba_bar_mobile'] : 'N',
524
- 'ssba_mobile_breakpoint' => $ssba_post['ssba_mobile_breakpoint'],
525
- 'ssba_custom_facebook' => $ssba_post['ssba_custom_facebook'],
526
- 'ssba_custom_twitter' => $ssba_post['ssba_custom_twitter'],
527
- 'ssba_custom_linkedin' => $ssba_post['ssba_custom_linkedin'],
528
- 'ssba_custom_flattr' => $ssba_post['ssba_custom_flattr'],
529
- 'ssba_custom_pinterest' => $ssba_post['ssba_custom_pinterest'],
530
- 'ssba_custom_print' => $ssba_post['ssba_custom_print'],
531
- 'ssba_custom_reddit' => $ssba_post['ssba_custom_reddit'],
532
- 'ssba_custom_stumbleupon' => $ssba_post['ssba_custom_stumbleupon'],
533
- 'ssba_custom_tumblr' => $ssba_post['ssba_custom_tumblr'],
534
- 'ssba_custom_vk' => $ssba_post['ssba_custom_vk'],
535
- 'ssba_custom_whatsapp' => $ssba_post['ssba_custom_whatsapp'],
536
- 'ssba_custom_xing' => $ssba_post['ssba_custom_xing'],
537
- 'ssba_custom_yummly' => $ssba_post['ssba_custom_yummly'],
538
- 'ssba_custom_email' => $ssba_post['ssba_custom_email'],
539
- 'ssba_custom_buffer' => $ssba_post['ssba_custom_buffer'],
540
- 'ssba_custom_diggit' => $ssba_post['ssba_custom_diggit'],
541
- 'ssba_custom_facebook_save' => $ssba_post['ssba_custom_facebook_save'],
542
-
543
- // Shared count.
544
- 'sharedcount_enabled' => isset($ssba_post['sharedcount_enabled']) ? $ssba_post['sharedcount_enabled'] : 'N',
545
- 'sharedcount_api_key' => $ssba_post['sharedcount_api_key'],
546
- 'sharedcount_plan' => $ssba_post['sharedcount_plan'],
547
-
548
- // Facebook.
549
- 'facebook_insights' => $ssba_post['facebook_insights'],
550
- 'facebook_app_id' => $ssba_post['facebook_app_id'],
551
- 'ignore_facebook_sdk' => $ssba_post['ignore_facebook_sdk'],
552
- 'plus_facebook_insights' => $ssba_post['plus_facebook_insights'],
553
- 'plus_facebook_app_id' => $ssba_post['plus_facebook_app_id'],
554
- 'plus_ignore_facebook_sdk' => $ssba_post['plus_ignore_facebook_sdk'],
555
- 'bar_facebook_insights' => $ssba_post['bar_facebook_insights'],
556
- 'bar_facebook_app_id' => $ssba_post['bar_facebook_app_id'],
557
- 'ssba_gdpr_config' => $gdpr_config
558
- );
559
-
560
- // Save the settings.
561
- $this->class_ssba->ssba_update_options($arr_options);
562
-
563
- // Save selected tab.
564
- update_option('ssba_selected_tab', $selected_tab);
565
-
566
- // Return success.
567
- return true;
568
- } // End if().
569
-
570
- // Query the db for current ssba settings.
571
- $arr_settings = $this->class_ssba->get_ssba_settings();
572
-
573
- // Admin panel.
574
- $this->admin_panel->admin_panel($arr_settings);
575
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
576
  }
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
+ class Admin_Bits {
16
+
17
+ /**
18
+ * Plugin instance.
19
+ *
20
+ * @var object
21
+ */
22
+ public $plugin;
23
+
24
+ /**
25
+ * Simple_Share_Buttons_Adder instance.
26
+ *
27
+ * @var object
28
+ */
29
+ public $class_ssba;
30
+
31
+ /**
32
+ * Database instance.
33
+ *
34
+ * @var object
35
+ */
36
+ public $database;
37
+
38
+ /**
39
+ * Admin Panel instance.
40
+ *
41
+ * @var object
42
+ */
43
+ public $admin_panel;
44
+
45
+ /**
46
+ * Class constructor.
47
+ *
48
+ * @param object $plugin Plugin class.
49
+ * @param object $class_ssba Simple Share Buttons Adder class.
50
+ * @param object $database Database class.
51
+ * @param Admin_Panel $admin_panel Admin Panel class.
52
+ */
53
+ public function __construct( $plugin, $class_ssba, $database, $admin_panel ) {
54
+ $this->plugin = $plugin;
55
+ $this->class_ssba = $class_ssba;
56
+ $this->database = $database;
57
+ $this->admin_panel = $admin_panel;
58
+ }
59
+
60
+ /**
61
+ * ShareThis terms notice detector.
62
+ */
63
+ public static function sharethis_terms_notice() {
64
+ $arr_settings = get_option( 'ssba_settings', true );
65
+
66
+ // If the sharethis terms have not yet been accepted.
67
+ if ( true === isset( $arr_settings['accepted_sharethis_terms'] ) && 'Y' !== $arr_settings['accepted_sharethis_terms'] ) {
68
+ ?>
69
+ <div id="sharethis_terms_notice" class="update-nag notice is-dismissible">
70
+ <p>
71
+ <?php esc_html_e( 'We\'ve updated our', 'simple-share-buttons-adder' ); ?>
72
+ <a style="text-decoration: underline;" href="http://simplesharebuttons.com/privacy" target="_blank">
73
+ <?php
74
+ echo esc_html__(
75
+ 'privacy policy and terms of use ',
76
+ 'simple-share-buttons-adder'
77
+ );
78
+ ?>
79
+ </a>
80
+ <?php
81
+ echo esc_html__(
82
+ 'with important changes you should review. To take advantage of the new features, please review and accept the new ',
83
+ 'simple-share-buttons-adder'
84
+ );
85
+ ?>
86
+ <a style="text-decoration: underline;" href="http://simplesharebuttons.com/privacy" target="_blank">
87
+ <?php esc_html_e( 'terms and privacy policy', 'simple-share-button-adder' ); ?>
88
+ </a>.
89
+ <a href="options-general.php?page=simple-share-buttons-adder&accept-terms=Y">
90
  <span class="button button-primary">
91
+ <?php echo esc_html__( 'I accept', 'simple-share-buttons-adder' ); ?>
92
  </span>
93
+ </a>
94
+ </p>
95
+ </div>
96
+ <?php
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Add settings link on plugin page.
102
+ *
103
+ * @filter plugin_action_links_simple-share-buttons-adder
104
+ *
105
+ * @param array $links The supplied links.
106
+ *
107
+ * @return mixed
108
+ */
109
+ public function ssba_settings_link( $links ) {
110
+ // Add to plugins links.
111
+ array_unshift(
112
+ $links,
113
+ '<a href="options-general.php?page=simple-share-buttons-adder">'
114
+ . esc_html__( 'Settings', 'simple-share-buttons-adder' )
115
+ . '</a>'
116
+ );
117
+
118
+ return $links;
119
+ }
120
+
121
+ /**
122
+ * AJAX Call for adding hide option to review popup.
123
+ *
124
+ * @action wp_ajax_ssba_ajax_hide_review
125
+ *
126
+ * @param mixed $post Post.
127
+ */
128
+ public function ssba_ajax_hide_review( $post ) {
129
+ update_option( 'ssba-hide-review', true );
130
+
131
+ wp_send_json_success( 'hidden' );
132
+ }
133
+
134
+ /**
135
+ * AJAX Call for saving property id and token.
136
+ *
137
+ * @action wp_ajax_ssba_ajax_add_creds
138
+ */
139
+ public function ssba_ajax_add_creds() {
140
+ check_ajax_referer( $this->plugin->meta_prefix, 'nonce' );
141
+
142
+ $property_id = filter_input( INPUT_POST, 'propertyId', FILTER_SANITIZE_STRING );
143
+
144
+ $token = filter_input( INPUT_POST, 'token', FILTER_SANITIZE_STRING );
145
+
146
+ if ( true === empty( $property_id )
147
+ || true === empty( $token )
148
+ || in_array( '', array( $property_id, $token ), true )
149
+ ) {
150
+ wp_send_json_error( 'Property Creation Failed.' );
151
+ }
152
+
153
+ $property_id = sanitize_text_field( wp_unslash( $property_id ) );
154
+ $token = sanitize_text_field( wp_unslash( $token ) );
155
+
156
+ update_option( 'ssba_property_id', $property_id );
157
+ update_option( 'ssba_token', $token );
158
+ }
159
+
160
+ /**
161
+ * Includes js/css files and upload script.
162
+ *
163
+ * @param string $hook_suffix The current admin page hook suffix.
164
+ *
165
+ * @action admin_enqueue_scripts
166
+ */
167
+ public function enqueue_admin_assets( $hook_suffix ) {
168
+ $current_url = $this->plugin->dir_url . 'buttons/';
169
+
170
+ if ( $this->hook_suffix === $hook_suffix ) {
171
+ // All extra scripts needed.
172
+ wp_enqueue_media();
173
+ wp_enqueue_script( 'media-upload' );
174
+ wp_enqueue_script( 'jquery-ui-sortable' );
175
+ wp_enqueue_script( 'jquery-ui' );
176
+ wp_enqueue_script( "{$this->plugin->assets_prefix}-bootstrap-js" );
177
+ wp_enqueue_script( "{$this->plugin->assets_prefix}-colorpicker" );
178
+ wp_enqueue_script( "{$this->plugin->assets_prefix}-switch" );
179
+ wp_enqueue_script( "{$this->plugin->assets_prefix}-admin" );
180
+
181
+ // Get sbba settings.
182
+ $arr_settings = $this->class_ssba->get_ssba_settings();
183
+ $token = get_option( 'ssba_token' );
184
+ $propertyid = get_option( 'ssba_property_id' );
185
+
186
+ wp_add_inline_script(
187
+ "{$this->plugin->assets_prefix}-admin",
188
+ sprintf(
189
+ '%s.boot( %s );',
190
+ __NAMESPACE__,
191
+ wp_json_encode(
192
+ array(
193
+ 'site' => $current_url,
194
+ 'homeUrl' => str_replace( array( 'https://', 'http://' ), '', get_home_url() ),
195
+ 'nonce' => wp_create_nonce( $this->plugin->meta_prefix ),
196
+ 'publisher_purposes' => ! empty( $arr_settings['ssba_gdpr_config']['publisher_purposes'] ) ? $arr_settings['ssba_gdpr_config']['publisher_purposes'] : false,
197
+ 'publisher_restrictions' => ! empty( $arr_settings['ssba_gdpr_config']['publisher_restrictions'] ) ? $arr_settings['ssba_gdpr_config']['publisher_restrictions'] : false,
198
+ 'token' => ! empty( $token ) ? $token : false,
199
+ 'propertyid' => ! empty( $propertyid ) ? $propertyid : false,
200
+ )
201
+ )
202
+ )
203
+ );
204
+
205
+ $custom_css = ! empty( $arr_settings['ssba_additional_css'] ) ? $arr_settings['ssba_additional_css'] : '';
206
+ $custom_css .= ! empty( $arr_settings['ssba_plus_additional_css'] ) ? $arr_settings['ssba_plus_additional_css'] : '';
207
+ $custom_css .= ! empty( $arr_settings['ssba_bar_additional_css'] ) ? $arr_settings['ssba_bar_additional_css'] : '';
208
+
209
+ wp_add_inline_style( "{$this->plugin->assets_prefix}-admin-theme", $custom_css );
210
+
211
+ // Admin styles.
212
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-readable" );
213
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-colorpicker" );
214
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-switch" );
215
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-font-awesome" );
216
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-admin-theme" );
217
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-admin" );
218
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-styles" );
219
+
220
+ $html_share_buttons_form = '';
221
+
222
+ // Get settings.
223
+ $arr_settings = $this->class_ssba->get_ssba_settings();
224
+
225
+ $accept_terms = filter_input( INPUT_GET, 'accept-terms', FILTER_SANITIZE_STRING );
226
+
227
+ // If user is accepting terms.
228
+ if ( 'Y' === $accept_terms ) {
229
+ // Save acceptance.
230
+ $this->class_ssba->ssba_update_options(
231
+ array(
232
+ 'accepted_sharethis_terms' => 'Y',
233
+ )
234
+ );
235
+
236
+ // Hide the notice for now, it will disappear upon reload.
237
+ $html_share_buttons_form .= '#sharethis_terms_notice { display: none }.ssbp-facebook_save { background-color: #365397 !important; }';
238
+ }
239
+
240
+ // Get the font family needed.
241
+ $html_share_buttons_form .= $this->get_font_family();
242
+
243
+ // If left to right.
244
+ if ( true === is_rtl() ) {
245
+ // Move save button.
246
+ $html_share_buttons_form .= '.ssba-btn-save{ left: 0!important;
247
  right: auto !important;
248
  border-radius: 0 5px 5px 0; }';
249
+ }
250
+
251
+ wp_add_inline_style( "{$this->plugin->assets_prefix}-admin-theme", $html_share_buttons_form );
252
+ }
253
+ }
254
+
255
+ /**
256
+ * Get ssbp font family.
257
+ *
258
+ * @return string
259
+ */
260
+ private function get_font_family() {
261
+ return "@font-face {
 
262
  font-family: 'ssbp';
263
  src:url('{$this->plugin->dir_url}fonts/ssbp.eot?xj3ol1');
264
  src:url('{$this->plugin->dir_url}fonts/ssbp.eot?#iefixxj3ol1') format('embedded-opentype'),
272
  -webkit-font-smoothing: antialiased;
273
  -moz-osx-font-smoothing: grayscale;
274
  }";
275
+ }
276
+
277
+ /**
278
+ * Save dismiss notice status.
279
+ *
280
+ * @action wp_ajax_dismiss_notice
281
+ */
282
+ public function dismiss_notice() {
283
+ check_ajax_referer( $this->plugin->meta_prefix, 'nonce' );
284
+
285
+ $type = filter_input( INPUT_POST, 'type', FILTER_SANITIZE_STRING );
286
+ $type = sanitize_text_field( wp_unslash( $type ) );
287
+
288
+ if ( true === empty( $type ) ) {
289
+ wp_send_json_error( 'dismiss notice failed' );
290
+ }
291
+
292
+ $current_notices = get_option( 'ssba_dismiss_notice' );
293
+ $current_notices = null !== $current_notices && false !== $current_notices && '' !== $current_notices ? $current_notices : '';
294
+
295
+ if ( '' !== $current_notices ) {
296
+ $new_notice = array_merge(
297
+ $current_notices,
298
+ array(
299
+ $type => false,
300
+ )
301
+ );
302
+ } else {
303
+ $new_notice = array(
304
+ $type => false,
305
+ );
306
+ }
307
+
308
+ update_option( 'ssba_dismiss_notice', $new_notice );
309
+ }
310
+
311
+ /**
312
+ * Save dismiss notice status.
313
+ *
314
+ * @action wp_ajax_ssba_ajax_update_gdpr
315
+ */
316
+ public function update_gdpr() {
317
+ check_ajax_referer( $this->plugin->meta_prefix, 'nonce' );
318
+
319
+ $config = filter_input( INPUT_POST, 'config', FILTER_DEFAULT );
320
+
321
+ if ( true === empty( $config ) ) {
322
+ wp_send_json_error( 'gdpr update fail' );
323
+ }
324
+
325
+ $current_settings = get_option( 'ssba_settings' );
326
+ $current_settings = false === empty( $current_settings ) ? $current_settings : '';
327
+
328
+ if ( '' === $current_settings ) {
329
+ wp_send_json_error( 'no settings' );
330
+ }
331
+
332
+ $current_settings['ssba_gdpr_config'] = $config;
333
+
334
+ update_option( 'ssba_settings', $current_settings );
335
+ }
336
+
337
+ /**
338
+ * Register the new simple share button adder menu dashboard link.
339
+ *
340
+ * @action admin_menu
341
+ */
342
+ public function add_ssba_menu() {
343
+ $icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDIwMDEwOTA0Ly9FTiIKICJodHRwOi8vd3d3LnczLm9yZy9UUi8yMDAxL1JFQy1TVkctMjAwMTA5MDQvRFREL3N2ZzEwLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiB3aWR0aD0iMjcyLjAwMDAwMHB0IiBoZWlnaHQ9IjIzNi4wMDAwMDBwdCIgdmlld0JveD0iMCAwIDI3Mi4wMDAwMDAgMjM2LjAwMDAwMCIKIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIG1lZXQiPgoKPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsMjM2LjAwMDAwMCkgc2NhbGUoMC4xMDAwMDAsLTAuMTAwMDAwKSIKZmlsbD0iIzAwMDAwMCIgc3Ryb2tlPSJub25lIj4KPHBhdGggZD0iTTk3NSAyMjkzIGMtMTQwIC0xNiAtMjQ2IC00OCAtMzY5IC0xMTEgLTI3NSAtMTQxIC00NjEgLTM5MCAtNTI3Ci03MDcgLTE2IC03NyAtMTYgLTI4MyAwIC0zNjAgODIgLTM5NCAzNTkgLTY5MSA3MzcgLTc5MCAxNjQgLTQzIDM1MSAtNDEgNTI2CjYgMTE0IDMxIDExNSAzMiA4NyAxMTAgLTEyIDM1IC0yMyA2NSAtMjQgNjYgLTEgMiAtMjUgLTYgLTUzIC0xNyAtMTE1IC00NAotMjkxIC02MCAtNDIyIC00MCAtMjg3IDQ2IC01MjUgMjI2IC02NDkgNDkyIC01MyAxMTEgLTcwIDE4MyAtNzggMzA4IC0xNCAyNDgKNjYgNDY1IDIzNSA2NDIgMTc5IDE4OCA0MDMgMjc3IDY2MSAyNjUgNjQgLTMgMTQxIC0xMiAxNzEgLTIwIDI1MyAtNzAgNDQxCi0yMTkgNTU4IC00NDUgNDcgLTg5IDkyIC0yNDcgOTIgLTMyMCBsMCAtNDUgNTMgNyBjMjggMyA2MyA2IDc2IDYgMjMgMCAyMyAxCjE3IDYzIC0xNyAxNTIgLTkzIDM1MyAtMTgwIDQ3MiAtOTQgMTMwIC0yNTcgMjY0IC00MDAgMzMwIC0xNTIgNzEgLTM1OSAxMDYKLTUxMSA4OHoiLz4KPHBhdGggZD0iTTg3MCAyMDcwIGMtMjIxIC01OSAtNDA5IC0yMDYgLTUwOSAtNDAwIC02MiAtMTE5IC04MiAtMTk4IC04OCAtMzM1Ci01IC0xMzMgOCAtMjIwIDUwIC0zMjUgNzkgLTE5NCAyNTAgLTM2NyA0NDAgLTQ0MyAxNjcgLTY3IDM3NiAtNzUgNTM3IC0yMQpsODUgMjkgNiAxMTAgYzE2IDI2NiAxNDYgNDY4IDM3NiA1ODIgbDkyIDQ2IC01IDUxIGMtMzMgMzI1IC0yNDIgNTg5IC01NDkKNjkyIC02OCAyMiAtMTAxIDI3IC0yMjAgMzAgLTExNyAzIC0xNTMgMSAtMjE1IC0xNnogbTU4IC01MjUgYzM4IC0zMiA0OCAtNzIKMjggLTExOCAtNDUgLTEwOCAtMTk1IC03NiAtMTk2IDQxIDAgOTAgOTkgMTM1IDE2OCA3N3ogbTM3MiAxMCBjMzcgLTE5IDUwCi00MyA1MCAtOTUgMCAtNTcgLTQyIC0xMDAgLTk3IC0xMDAgLTEwMSAwIC0xNDggMTIwIC03MiAxODQgMzUgMzAgNzYgMzMgMTE5CjExeiBtLTM2MCAtNDEyIGM0MiAtMzkgNDkgLTg3IDE4IC0xMzMgLTM5IC01OCAtMTE0IC02NSAtMTY0IC0xNSAtMTggMTkgLTI0CjM1IC0yNCA3MCAwIDk1IDEwMCAxNDAgMTcwIDc4eiBtMzY5IDEzIGM1OCAtMzAgNjkgLTExOSAyMiAtMTY3IC0yMyAtMjMgLTM4Ci0yOSAtNzEgLTI5IC0zNSAwIC00OCA2IC03NyAzNSAtMzIgMzIgLTM1IDQwIC0zMCA3NiAxMSA4MSA4NSAxMjEgMTU2IDg1eiIvPgo8cGF0aCBkPSJNMTkxMiAxMjUwIGMtMTEwIC0yOSAtMTg3IC03NSAtMjczIC0xNjAgLTEyMiAtMTIwIC0xNzkgLTI1NiAtMTc5Ci00MjUgMCAtMTcwIDU3IC0zMDMgMTgxIC00MjYgMzQwIC0zNDAgOTA5IC0xNjggMTAxNCAzMDUgNjUgMjkyIC0xMDggNTkyCi0zOTcgNjkzIC0xMDIgMzUgLTI0NSA0MSAtMzQ2IDEzeiBtMTk4IC0zNjkgYzUgLTExIDEwIC00OSAxMCAtODUgbDAgLTY2IDc3CjAgYzg5IDAgMTEzIC0xNCAxMTMgLTY2IDAgLTQ4IC0yOCAtNjQgLTExNyAtNjQgbC03MyAwIDAgLTgyIGMwIC05MCAtMTQgLTExOAotNTcgLTExOCAtNTUgMCAtNjMgMTMgLTYzIDExMCBsMCA5MCAtNzMgMCBjLTg5IDAgLTExNyAxNSAtMTE3IDY1IDAgNTMgMjAgNjUKMTExIDY1IGw3OSAwIDAgNzMgYzAgNDMgNSA3OCAxMiA4NSAyMCAyMCA4NiAxNSA5OCAtN3oiLz4KPC9nPgo8L3N2Zz4K';
344
+
345
+ add_menu_page(
346
+ 'Simple Share Buttons Adder',
347
+ 'Simple Share Buttons',
348
+ 'manage_options',
349
+ 'simple-share-buttons-adder',
350
+ array( $this, 'ssba_settings' ),
351
+ $icon,
352
+ 26
353
+ );
354
+ }
355
+
356
+ /**
357
+ * Menu settings.
358
+ *
359
+ * @action admin_menu
360
+ */
361
+ public function ssba_menu() {
362
+ // Add menu page.
363
+ $this->hook_suffix = add_options_page(
364
+ esc_html__( 'Simple Share Buttons Adder', 'simple-share-buttons-adder' ),
365
+ esc_html__( 'Simple Share Buttons', 'simple-share-buttons-adder' ),
366
+ 'manage_options',
367
+ $this->plugin->assets_prefix,
368
+ array( $this, 'ssba_settings' )
369
+ );
370
+
371
+ // Query the db for current ssba settings.
372
+ $arr_settings = $this->class_ssba->get_ssba_settings();
373
+
374
+ // Get the current version.
375
+ $version = get_option( 'ssba_version' );
376
+
377
+ // There was a version set.
378
+ if ( false !== $version ) {
379
+ // Check if not updated to current version.
380
+ if ( $version < SSBA_VERSION ) {
381
+ // Run the upgrade function.
382
+ $this->database->upgrade_ssba( $arr_settings, $version );
383
+ }
384
+ }
385
+ }
386
+
387
+ /**
388
+ * Answer form.
389
+ *
390
+ * @return bool
391
+ */
392
+ public function ssba_settings() {
393
+ // Check if user has the rights to manage options.
394
+ if ( ! current_user_can( 'manage_options' ) ) {
395
+ // Permissions message.
396
+ wp_die(
397
+ esc_html__(
398
+ 'You do not have sufficient permissions to access this page.',
399
+ 'simple-share-buttons-adder'
400
+ )
401
+ );
402
+ }
403
+
404
+ $ssba_post = filter_input( INPUT_POST, 'ssbaData', FILTER_SANITIZE_STRING );
405
+
406
+ // If a post has been made.
407
+ if ( false === empty( $ssba_post ) ) {
408
+ // Get posted data.
409
+ $selected_tab = filter_input( INPUT_POST, 'ssba_selected_tab', FILTER_SANITIZE_STRING );
410
+ $selected_tab = sanitize_text_field( wp_unslash( $selected_tab ) );
411
+
412
+ $gdpr_config = filter_input( INPUT_POST, 'gdpr_config', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
413
+
414
+ parse_str( $ssba_post, $ssba_post );
415
+
416
+ // If the nonce doesn't check out.
417
+ if ( false === isset( $ssba_post['ssba_save_nonce'] ) || false === wp_verify_nonce(
418
+ $ssba_post['ssba_save_nonce'],
419
+ 'ssba_save_settings'
420
+ ) ) {
421
+ die(
422
+ esc_html__(
423
+ 'There was no nonce provided, or the one provided did not verify.',
424
+ 'simple-share-buttons-adder'
425
+ )
426
+ );
427
+ }
428
+
429
+ // Prepare array.
430
+ $arr_options = array(
431
+ 'ssba_image_set' => $ssba_post['ssba_image_set'],
432
+ 'ssba_size' => $ssba_post['ssba_size'],
433
+ 'ssba_omit_pages' => ( isset( $ssba_post['ssba_omit_pages'] ) ? $ssba_post['ssba_omit_pages'] : '' ),
434
+ 'ssba_omit_pages_plus' => ( isset( $ssba_post['ssba_omit_pages_plus'] ) ? $ssba_post['ssba_omit_pages_plus'] : '' ),
435
+ 'ssba_omit_pages_bar' => ( isset( $ssba_post['ssba_omit_pages_bar'] ) ? $ssba_post['ssba_omit_pages_bar'] : '' ),
436
+ 'ssba_pages' => ( isset( $ssba_post['ssba_pages'] ) ? $ssba_post['ssba_pages'] : 'N' ),
437
+ 'ssba_posts' => ( isset( $ssba_post['ssba_posts'] ) ? $ssba_post['ssba_posts'] : 'N' ),
438
+ 'ssba_cats_archs' => ( isset( $ssba_post['ssba_cats_archs'] ) ? $ssba_post['ssba_cats_archs'] : 'N' ),
439
+ 'ssba_homepage' => ( isset( $ssba_post['ssba_homepage'] ) ? $ssba_post['ssba_homepage'] : 'N' ),
440
+ 'ssba_excerpts' => ( isset( $ssba_post['ssba_excerpts'] ) ? $ssba_post['ssba_excerpts'] : 'N' ),
441
+ 'ssba_plus_pages' => ( isset( $ssba_post['ssba_plus_pages'] ) ? $ssba_post['ssba_plus_pages'] : 'N' ),
442
+ 'ssba_plus_posts' => ( isset( $ssba_post['ssba_plus_posts'] ) ? $ssba_post['ssba_plus_posts'] : 'N' ),
443
+ 'ssba_plus_cats_archs' => ( isset( $ssba_post['ssba_plus_cats_archs'] ) ? $ssba_post['ssba_plus_cats_archs'] : 'N' ),
444
+ 'ssba_plus_homepage' => ( isset( $ssba_post['ssba_plus_homepage'] ) ? $ssba_post['ssba_plus_homepage'] : 'N' ),
445
+ 'ssba_plus_excerpts' => ( isset( $ssba_post['ssba_plus_excerpts'] ) ? $ssba_post['ssba_plus_excerpts'] : 'N' ),
446
+ 'ssba_bar_pages' => ( isset( $ssba_post['ssba_bar_pages'] ) ? $ssba_post['ssba_bar_pages'] : 'N' ),
447
+ 'ssba_bar_posts' => ( isset( $ssba_post['ssba_bar_posts'] ) ? $ssba_post['ssba_bar_posts'] : 'N' ),
448
+ 'ssba_bar_cats_archs' => ( isset( $ssba_post['ssba_bar_cats_archs'] ) ? $ssba_post['ssba_bar_cats_archs'] : 'N' ),
449
+ 'ssba_bar_homepage' => ( isset( $ssba_post['ssba_bar_homepage'] ) ? $ssba_post['ssba_bar_homepage'] : 'N' ),
450
+ 'ssba_bar_excerpts' => ( isset( $ssba_post['ssba_bar_excerpts'] ) ? $ssba_post['ssba_bar_excerpts'] : 'N' ),
451
+ 'ssba_align' => ( isset( $ssba_post['ssba_align'] ) ? $ssba_post['ssba_align'] : 'N' ),
452
+ 'ssba_plus_align' => ( isset( $ssba_post['ssba_plus_align'] ) ? $ssba_post['ssba_plus_align'] : 'N' ),
453
+ 'ssba_padding' => $ssba_post['ssba_padding'],
454
+ 'ssba_before_or_after' => $ssba_post['ssba_before_or_after'],
455
+ 'ssba_before_or_after_plus' => $ssba_post['ssba_before_or_after_plus'],
456
+ 'ssba_additional_css' => $ssba_post['ssba_additional_css'],
457
+ 'ssba_custom_styles' => $ssba_post['ssba_custom_styles'],
458
+ 'ssba_custom_styles_enabled' => $ssba_post['ssba_custom_styles_enabled'],
459
+ 'ssba_email_message' => stripslashes_deep( $ssba_post['ssba_email_message'] ),
460
+ 'ssba_twitter_text' => stripslashes_deep( $ssba_post['ssba_twitter_text'] ),
461
+ 'ssba_buffer_text' => stripslashes_deep( $ssba_post['ssba_buffer_text'] ),
462
+ 'ssba_flattr_user_id' => stripslashes_deep( $ssba_post['ssba_flattr_user_id'] ),
463
+ 'ssba_flattr_url' => stripslashes_deep( $ssba_post['ssba_flattr_url'] ),
464
+ 'ssba_share_new_window' => ( isset( $ssba_post['ssba_share_new_window'] ) ? $ssba_post['ssba_share_new_window'] : 'N' ),
465
+ 'ssba_link_to_ssb' => ( isset( $ssba_post['ssba_link_to_ssb'] ) ? $ssba_post['ssba_link_to_ssb'] : 'N' ),
466
+ 'ssba_show_share_count' => ( isset( $ssba_post['ssba_show_share_count'] ) ? $ssba_post['ssba_show_share_count'] : 'N' ),
467
+ 'ssba_share_count_style' => $ssba_post['ssba_share_count_style'],
468
+ 'ssba_share_count_css' => $ssba_post['ssba_share_count_css'],
469
+ 'ssba_share_count_once' => ( isset( $ssba_post['ssba_share_count_once'] ) ? $ssba_post['ssba_share_count_once'] : 'N' ),
470
+ 'ssba_widget_text' => $ssba_post['ssba_widget_text'],
471
+ 'ssba_rel_nofollow' => ( isset( $ssba_post['ssba_rel_nofollow'] ) ? $ssba_post['ssba_rel_nofollow'] : 'N' ),
472
+ 'ssba_default_pinterest' => ( isset( $ssba_post['ssba_default_pinterest'] ) ? $ssba_post['ssba_default_pinterest'] : 'N' ),
473
+ 'ssba_pinterest_featured' => ( isset( $ssba_post['ssba_pinterest_featured'] ) ? $ssba_post['ssba_pinterest_featured'] : 'N' ),
474
+ 'ssba_content_priority' => ( isset( $ssba_post['ssba_content_priority'] ) ? $ssba_post['ssba_content_priority'] : 'N' ),
475
+ 'ssba_plus_additional_css' => $ssba_post['ssba_plus_additional_css'],
476
+ 'ssba_plus_email_message' => stripslashes_deep( $ssba_post['ssba_plus_email_message'] ),
477
+ 'ssba_plus_twitter_text' => stripslashes_deep( $ssba_post['ssba_plus_twitter_text'] ),
478
+ 'ssba_plus_buffer_text' => stripslashes_deep( $ssba_post['ssba_plus_buffer_text'] ),
479
+ 'ssba_plus_flattr_user_id' => stripslashes_deep( $ssba_post['ssba_plus_flattr_user_id'] ),
480
+ 'ssba_plus_flattr_url' => stripslashes_deep( $ssba_post['ssba_plus_flattr_url'] ),
481
+ 'ssba_plus_share_new_window' => ( isset( $ssba_post['ssba_plus_share_new_window'] ) ? $ssba_post['ssba_plus_share_new_window'] : 'N' ),
482
+ 'ssba_plus_link_to_ssb' => ( isset( $ssba_post['ssba_plus_link_to_ssb'] ) ? $ssba_post['ssba_plus_link_to_ssb'] : 'N' ),
483
+ 'ssba_plus_show_share_count' => ( isset( $ssba_post['ssba_plus_show_share_count'] ) ? $ssba_post['ssba_plus_show_share_count'] : 'N' ),
484
+ 'ssba_plus_share_count_style' => $ssba_post['ssba_plus_share_count_style'],
485
+ 'ssba_plus_share_count_css' => $ssba_post['ssba_plus_share_count_css'],
486
+ 'ssba_plus_share_count_once' => ( isset( $ssba_post['ssba_plus_share_count_once'] ) ? $ssba_post['ssba_plus_share_count_once'] : 'N' ),
487
+ 'ssba_plus_widget_text' => $ssba_post['ssba_plus_widget_text'],
488
+ 'ssba_plus_rel_nofollow' => ( isset( $ssba_post['ssba_plus_rel_nofollow'] ) ? $ssba_post['ssba_plus_rel_nofollow'] : 'N' ),
489
+ 'ssba_plus_default_pinterest' => ( isset( $ssba_post['ssba_plus_default_pinterest'] ) ? $ssba_post['ssba_plus_default_pinterest'] : 'N' ),
490
+ 'ssba_plus_pinterest_featured' => ( isset( $ssba_post['ssba_plus_pinterest_featured'] ) ? $ssba_post['ssba_plus_pinterest_featured'] : 'N' ),
491
+ 'ssba_bar_additional_css' => $ssba_post['ssba_bar_additional_css'],
492
+ 'ssba_bar_email_message' => stripslashes_deep( $ssba_post['ssba_bar_email_message'] ),
493
+ 'ssba_bar_twitter_text' => stripslashes_deep( $ssba_post['ssba_bar_twitter_text'] ),
494
+ 'ssba_bar_buffer_text' => stripslashes_deep( $ssba_post['ssba_bar_buffer_text'] ),
495
+ 'ssba_bar_flattr_user_id' => stripslashes_deep( $ssba_post['ssba_bar_flattr_user_id'] ),
496
+ 'ssba_bar_flattr_url' => stripslashes_deep( $ssba_post['ssba_bar_flattr_url'] ),
497
+ 'ssba_bar_share_new_window' => ( isset( $ssba_post['ssba_bar_share_new_window'] ) ? $ssba_post['ssba_bar_share_new_window'] : 'N' ),
498
+ 'ssba_bar_link_to_ssb' => ( isset( $ssba_post['ssba_bar_link_to_ssb'] ) ? $ssba_post['ssba_bar_link_to_ssb'] : 'N' ),
499
+ 'ssba_bar_show_share_count' => ( isset( $ssba_post['ssba_bar_show_share_count'] ) ? $ssba_post['ssba_bar_show_share_count'] : 'N' ),
500
+ 'ssba_bar_share_count_style' => $ssba_post['ssba_bar_share_count_style'],
501
+ 'ssba_bar_share_count_css' => $ssba_post['ssba_bar_share_count_css'],
502
+ 'ssba_bar_share_count_once' => ( isset( $ssba_post['ssba_bar_share_count_once'] ) ? $ssba_post['ssba_bar_share_count_once'] : 'N' ),
503
+ 'ssba_bar_widget_text' => $ssba_post['ssba_bar_widget_text'],
504
+ 'ssba_bar_rel_nofollow' => ( isset( $ssba_post['ssba_bar_rel_nofollow'] ) ? $ssba_post['ssba_bar_rel_nofollow'] : 'N' ),
505
+ 'ssba_bar_default_pinterest' => ( isset( $ssba_post['ssba_bar_default_pinterest'] ) ? $ssba_post['ssba_bar_default_pinterest'] : 'N' ),
506
+ 'ssba_bar_pinterest_featured' => ( isset( $ssba_post['ssba_bar_pinterest_featured'] ) ? $ssba_post['ssba_bar_pinterest_featured'] : 'N' ),
507
+
508
+ // Share container.
509
+ 'ssba_div_padding' => $ssba_post['ssba_div_padding'],
510
+ 'ssba_div_rounded_corners' => ( isset( $ssba_post['ssba_div_rounded_corners'] ) ? $ssba_post['ssba_div_rounded_corners'] : 'N' ),
511
+ 'ssba_border_width' => $ssba_post['ssba_border_width'],
512
+ 'ssba_div_border' => $ssba_post['ssba_div_border'],
513
+ 'ssba_div_background' => $ssba_post['ssba_div_background'],
514
+
515
+ // Text.
516
+ 'ssba_share_text' => stripslashes_deep( $ssba_post['ssba_share_text'] ),
517
+ 'ssba_text_placement' => $ssba_post['ssba_text_placement'],
518
+ 'ssba_font_family' => $ssba_post['ssba_font_family'],
519
+ 'ssba_font_color' => $ssba_post['ssba_font_color'],
520
+ 'ssba_font_size' => $ssba_post['ssba_font_size'],
521
+ 'ssba_font_weight' => $ssba_post['ssba_font_weight'],
522
+ 'ssba_plus_share_text' => stripslashes_deep( $ssba_post['ssba_plus_share_text'] ),
523
+ 'ssba_plus_text_placement' => $ssba_post['ssba_plus_text_placement'],
524
+ 'ssba_plus_font_family' => $ssba_post['ssba_plus_font_family'],
525
+ 'ssba_plus_font_color' => $ssba_post['ssba_plus_font_color'],
526
+ 'ssba_plus_font_size' => $ssba_post['ssba_plus_font_size'],
527
+ 'ssba_plus_font_weight' => $ssba_post['ssba_plus_font_weight'],
528
+
529
+ // Included buttons.
530
+ 'ssba_selected_buttons' => $ssba_post['ssba_selected_buttons'],
531
+ 'ssba_selected_bar_buttons' => $ssba_post['ssba_selected_bar_buttons'],
532
+ 'ssba_selected_plus_buttons' => $ssba_post['ssba_selected_plus_buttons'],
533
+ 'ssba_plus_button_style' => $ssba_post['ssba_plus_button_style'],
534
+ 'ssba_bar_style' => $ssba_post['ssba_bar_style'],
535
+ 'ssba_new_buttons' => $ssba_post['ssba_new_buttons'],
536
+ 'ssba_bar_enabled' => $ssba_post['ssba_bar_enabled'],
537
+ 'ssba_bar_position' => $ssba_post['ssba_bar_position'],
538
+ 'ssba_plus_height' => $ssba_post['ssba_plus_height'],
539
+ 'ssba_plus_width' => $ssba_post['ssba_plus_width'],
540
+ 'ssba_plus_margin' => $ssba_post['ssba_plus_margin'],
541
+ 'ssba_plus_button_color' => $ssba_post['ssba_plus_button_color'],
542
+ 'ssba_plus_button_hover_color' => $ssba_post['ssba_plus_button_hover_color'],
543
+ 'ssba_plus_icon_size' => $ssba_post['ssba_plus_icon_size'],
544
+ 'ssba_plus_icon_color' => $ssba_post['ssba_plus_icon_color'],
545
+ 'ssba_plus_icon_hover_color' => $ssba_post['ssba_plus_icon_hover_color'],
546
+ 'ssba_bar_height' => $ssba_post['ssba_bar_height'],
547
+ 'ssba_bar_width' => $ssba_post['ssba_bar_width'],
548
+ 'ssba_bar_button_color' => $ssba_post['ssba_bar_button_color'],
549
+ 'ssba_bar_button_hover_color' => $ssba_post['ssba_bar_button_hover_color'],
550
+ 'ssba_bar_icon_size' => $ssba_post['ssba_bar_icon_size'],
551
+ 'ssba_bar_icon_color' => $ssba_post['ssba_bar_icon_color'],
552
+ 'ssba_bar_icon_hover_color' => $ssba_post['ssba_bar_icon_hover_color'],
553
+ 'ssba_bar_desktop' => isset( $ssba_post['ssba_bar_desktop'] ) ? $ssba_post['ssba_bar_desktop'] : 'N',
554
+ 'ssba_bar_margin' => $ssba_post['ssba_bar_margin'],
555
+ 'ssba_bar_mobile' => isset( $ssba_post['ssba_bar_mobile'] ) ? $ssba_post['ssba_bar_mobile'] : 'N',
556
+ 'ssba_mobile_breakpoint' => $ssba_post['ssba_mobile_breakpoint'],
557
+ 'ssba_custom_facebook' => $ssba_post['ssba_custom_facebook'],
558
+ 'ssba_custom_twitter' => $ssba_post['ssba_custom_twitter'],
559
+ 'ssba_custom_linkedin' => $ssba_post['ssba_custom_linkedin'],
560
+ 'ssba_custom_flattr' => $ssba_post['ssba_custom_flattr'],
561
+ 'ssba_custom_pinterest' => $ssba_post['ssba_custom_pinterest'],
562
+ 'ssba_custom_print' => $ssba_post['ssba_custom_print'],
563
+ 'ssba_custom_reddit' => $ssba_post['ssba_custom_reddit'],
564
+ 'ssba_custom_stumbleupon' => $ssba_post['ssba_custom_stumbleupon'],
565
+ 'ssba_custom_tumblr' => $ssba_post['ssba_custom_tumblr'],
566
+ 'ssba_custom_vk' => $ssba_post['ssba_custom_vk'],
567
+ 'ssba_custom_whatsapp' => $ssba_post['ssba_custom_whatsapp'],
568
+ 'ssba_custom_xing' => $ssba_post['ssba_custom_xing'],
569
+ 'ssba_custom_yummly' => $ssba_post['ssba_custom_yummly'],
570
+ 'ssba_custom_email' => $ssba_post['ssba_custom_email'],
571
+ 'ssba_custom_buffer' => $ssba_post['ssba_custom_buffer'],
572
+ 'ssba_custom_diggit' => $ssba_post['ssba_custom_diggit'],
573
+ 'ssba_custom_facebook_save' => $ssba_post['ssba_custom_facebook_save'],
574
+
575
+ // Shared count.
576
+ 'sharedcount_enabled' => isset( $ssba_post['sharedcount_enabled'] ) ? $ssba_post['sharedcount_enabled'] : 'N',
577
+ 'sharedcount_api_key' => $ssba_post['sharedcount_api_key'],
578
+ 'sharedcount_plan' => $ssba_post['sharedcount_plan'],
579
+
580
+ // Facebook.
581
+ 'facebook_insights' => $ssba_post['facebook_insights'],
582
+ 'facebook_app_id' => $ssba_post['facebook_app_id'],
583
+ 'ignore_facebook_sdk' => $ssba_post['ignore_facebook_sdk'],
584
+ 'plus_facebook_insights' => $ssba_post['plus_facebook_insights'],
585
+ 'plus_facebook_app_id' => $ssba_post['plus_facebook_app_id'],
586
+ 'plus_ignore_facebook_sdk' => $ssba_post['plus_ignore_facebook_sdk'],
587
+ 'bar_facebook_insights' => $ssba_post['bar_facebook_insights'],
588
+ 'bar_facebook_app_id' => $ssba_post['bar_facebook_app_id'],
589
+ 'ssba_gdpr_config' => $gdpr_config,
590
+ );
591
+
592
+ // Save the settings.
593
+ $this->class_ssba->ssba_update_options( $arr_options );
594
+
595
+ // Save selected tab.
596
+ update_option( 'ssba_selected_tab', $selected_tab );
597
+
598
+ // Return success.
599
+ return true;
600
+ }
601
+
602
+ // Query the db for current ssba settings.
603
+ $arr_settings = $this->class_ssba->get_ssba_settings();
604
+
605
+ // Admin panel.
606
+ $this->admin_panel->admin_panel( $arr_settings );
607
+ }
608
  }
php/class-admin-panel.php CHANGED
@@ -12,1780 +12,1817 @@ namespace SimpleShareButtonsAdder;
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
- class Admin_Panel
16
- {
17
-
18
- /**
19
- * Plugin instance.
20
- *
21
- * @var object
22
- */
23
- public $plugin;
24
-
25
- /**
26
- * Simple Share Buttons Adder instance.
27
- *
28
- * @var object
29
- */
30
- public $class_ssba;
31
-
32
- /**
33
- * Widget Class instance.
34
- *
35
- * @var object
36
- */
37
- public $widget_class;
38
-
39
- /**
40
- * Forms instance.
41
- *
42
- * @var object
43
- */
44
- public $forms;
45
-
46
- /**
47
- * Admin_Panel constructor.
48
- *
49
- * @param object $plugin Plugin instance.
50
- * @param object $class_ssba Simple Share Buttons Adder instance.
51
- * @param object $forms Forms instance.
52
- */
53
- public function __construct($plugin, $class_ssba, $forms, $widget_class)
54
- {
55
- $this->plugin = $plugin;
56
- $this->class_ssba = $class_ssba;
57
- $this->forms = $forms;
58
- $this->widget_class = $widget_class;
59
- }
60
-
61
- /**
62
- * Display the admin header.
63
- */
64
- public function admin_header()
65
- {
66
- include_once("{$this->plugin->dir_path}/templates/admin-header.php");
67
- }
68
-
69
- /**
70
- * Display the admin footer.
71
- */
72
- public function admin_footer()
73
- {
74
- include_once("{$this->plugin->dir_path}/templates/admin-footer.php");
75
- }
76
-
77
- /**
78
- * Enqueue the custom gutenberg block script.
79
- *
80
- * @action enqueue_block_editor_assets
81
- */
82
- public function enqueue_custom_blocks()
83
- {
84
- wp_enqueue_script("{$this->plugin->assets_prefix}-blocks", "{$this->plugin->dir_url}js/blocks.js",
85
- array('wp-blocks', 'wp-editor', 'wp-element', 'wp-components'), time(), true);
86
- }
87
-
88
- /**
89
- * Register new block category for share buttons.
90
- *
91
- * @param array $categories The current block categories.
92
- *
93
- * @filter block_categories, 999
94
- */
95
- public function simpleshare_block_category($categories, $post)
96
- {
97
- return array_merge(
98
- $categories,
99
- [
100
- [
101
- 'slug' => 'simpleshare-blocks',
102
- 'title' => __('SimpleShare Blocks', 'simple-share-buttons-adder'),
103
- ],
104
- ]
105
- );
106
- }
107
-
108
-
109
- /**
110
- * Build the Admin Panel html variables and include template.
111
- *
112
- * @param array $arr_settings The current ssba settings.
113
- */
114
- public function admin_panel($arr_settings)
115
- {
116
- // Locations array.
117
- $locs = array(
118
- 'Homepage' => array(
119
- 'value' => 'ssba_homepage',
120
- 'checked' => isset($arr_settings['ssba_homepage']) && 'Y' === $arr_settings['ssba_homepage'] ? true : false,
121
- ),
122
- 'Pages' => array(
123
- 'value' => 'ssba_pages',
124
- 'checked' => isset($arr_settings['ssba_pages']) && 'Y' === $arr_settings['ssba_pages'] ? true : false,
125
- ),
126
- 'Posts' => array(
127
- 'value' => 'ssba_posts',
128
- 'checked' => isset($arr_settings['ssba_posts']) && 'Y' === $arr_settings['ssba_posts'] ? true : false,
129
- ),
130
- 'Excerpts' => array(
131
- 'value' => 'ssba_excerpts',
132
- 'checked' => isset($arr_settings['ssba_excerpts']) && 'Y' === $arr_settings['ssba_excerpts'] ? true : false,
133
- ),
134
- 'Categories/Archives' => array(
135
- 'value' => 'ssba_cats_archs',
136
- 'checked' => isset($arr_settings['ssba_cats_archs']) && 'Y' === $arr_settings['ssba_cats_archs'] ? true : false,
137
- ),
138
- );
139
-
140
- // Locations array.
141
- $locs2 = array(
142
- 'Homepage' => array(
143
- 'value' => 'ssba_bar_homepage',
144
- 'checked' => isset($arr_settings['ssba_bar_homepage']) && 'Y' === $arr_settings['ssba_bar_homepage'] ? true : false,
145
- ),
146
- 'Pages' => array(
147
- 'value' => 'ssba_bar_pages',
148
- 'checked' => isset($arr_settings['ssba_bar_pages']) && 'Y' === $arr_settings['ssba_bar_pages'] ? true : false,
149
- ),
150
- 'Posts' => array(
151
- 'value' => 'ssba_bar_posts',
152
- 'checked' => isset($arr_settings['ssba_bar_posts']) && 'Y' === $arr_settings['ssba_bar_posts'] ? true : false,
153
- ),
154
- 'Categories/Archives' => array(
155
- 'value' => 'ssba_bar_cats_archs',
156
- 'checked' => isset($arr_settings['ssba_bar_cats_archs']) && 'Y' === $arr_settings['ssba_bar_cats_archs'] ? true : false,
157
- ),
158
- );
159
-
160
- // Locations array for plus.
161
- $locs3 = array(
162
- 'Homepage' => array(
163
- 'value' => 'ssba_plus_homepage',
164
- 'checked' => isset($arr_settings['ssba_plus_homepage']) && 'Y' === $arr_settings['ssba_plus_homepage'] ? true : false,
165
- ),
166
- 'Pages' => array(
167
- 'value' => 'ssba_plus_pages',
168
- 'checked' => isset($arr_settings['ssba_plus_pages']) && 'Y' === $arr_settings['ssba_plus_pages'] ? true : false,
169
- ),
170
- 'Posts' => array(
171
- 'value' => 'ssba_plus_posts',
172
- 'checked' => isset($arr_settings['ssba_plus_posts']) && 'Y' === $arr_settings['ssba_plus_posts'] ? true : false,
173
- ),
174
- 'Excerpts' => array(
175
- 'value' => 'ssba_plus_excerpts',
176
- 'checked' => isset($arr_settings['ssba_plus_excerpts']) && 'Y' === $arr_settings['ssba_plus_excerpts'] ? true : false,
177
- ),
178
- 'Categories/Archives' => array(
179
- 'value' => 'ssba_plus_cats_archs',
180
- 'checked' => isset($arr_settings['ssba_plus_cats_archs']) && 'Y' === $arr_settings['ssba_plus_cats_archs'] ? true : false,
181
- ),
182
- );
183
-
184
- // Display options.
185
- $display_loc = array(
186
- 'Desktop' => array(
187
- 'value' => 'ssba_bar_desktop',
188
- 'checked' => isset($arr_settings['ssba_bar_desktop']) && 'Y' === $arr_settings['ssba_bar_desktop'] ? true : false,
189
- ),
190
- 'Mobile' => array(
191
- 'value' => 'ssba_bar_mobile',
192
- 'checked' => isset($arr_settings['ssba_bar_mobile']) && 'Y' === $arr_settings['ssba_bar_mobile'] ? true : false,
193
- ),
194
- );
195
-
196
- // Prepare array of buttons.
197
- $arr_buttons = get_option('ssba_buttons', true);
198
-
199
- // Locations.
200
- $opts1 = array(
201
- 'form_group' => false,
202
- 'label' => 'Locations',
203
- 'tooltip' => 'Enable the locations you wish for share buttons to appear',
204
- 'value' => 'Y',
205
- 'checkboxes' => $locs,
206
- );
207
-
208
- // Placement.
209
- $opts2 = array(
210
- 'form_group' => false,
211
- 'type' => 'select',
212
- 'name' => 'ssba_before_or_after',
213
- 'label' => 'Placement',
214
- 'tooltip' => 'Place share buttons before or after your content',
215
- 'selected' => isset($arr_settings['ssba_before_or_after']) ? $arr_settings['ssba_before_or_after'] : '',
216
- 'options' => array(
217
- 'After' => 'after',
218
- 'Before' => 'before',
219
- 'Both' => 'both',
220
- ),
221
- );
222
-
223
- // Share text.
224
- $opts3 = array(
225
- 'form_group' => false,
226
- 'type' => 'text',
227
- 'placeholder' => 'Share this...',
228
- 'name' => 'ssba_share_text',
229
- 'label' => 'Call To Action',
230
- 'tooltip' => 'Add some custom text by your share buttons',
231
- 'value' => isset($arr_settings['ssba_share_text']) ? $arr_settings['ssba_share_text'] : '',
232
- );
233
-
234
- // Share text for plus.
235
- $opts3p = array(
236
- 'form_group' => false,
237
- 'type' => 'text',
238
- 'placeholder' => 'Share this...',
239
- 'name' => 'ssba_plus_share_text',
240
- 'label' => 'Call To Action',
241
- 'tooltip' => 'Add some custom text by your share buttons',
242
- 'value' => isset($arr_settings['ssba_plus_share_text']) ? $arr_settings['ssba_plus_share_text'] : '',
243
- );
244
-
245
- // Placement.
246
- $opts4 = array(
247
- 'form_group' => false,
248
- 'type' => 'select',
249
- 'name' => 'ssba_image_set',
250
- 'label' => 'Theme',
251
- 'tooltip' => 'Choose your favourite set of buttons, or set to custom to choose your own',
252
- 'selected' => isset($arr_settings['ssba_image_set']) ? $arr_settings['ssba_image_set'] : '',
253
- 'options' => array(
254
- 'Arbenta' => 'arbenta',
255
- 'Custom' => 'custom',
256
- 'Metal' => 'metal',
257
- 'Pagepeel' => 'pagepeel',
258
- 'Plain' => 'plain',
259
- 'Retro' => 'retro',
260
- 'Ribbons' => 'ribbons',
261
- 'Simple' => 'simple',
262
- 'Somacro' => 'somacro',
263
- ),
264
- );
265
-
266
- // Button size.
267
- $opts6 = array(
268
- 'form_group' => false,
269
- 'type' => 'number_addon',
270
- 'addon' => 'px',
271
- 'placeholder' => '35',
272
- 'name' => 'ssba_size',
273
- 'label' => 'Button Size',
274
- 'tooltip' => 'Set the size of your buttons in pixels',
275
- 'value' => isset($arr_settings['ssba_size']) ? $arr_settings['ssba_size'] : '',
276
- );
277
-
278
- // Alignment.
279
- $opts7 = array(
280
- 'form_group' => false,
281
- 'type' => 'select',
282
- 'name' => 'ssba_align',
283
- 'label' => 'Alignment',
284
- 'tooltip' => 'Align your buttons the way you wish',
285
- 'selected' => isset($arr_settings['ssba_align']) ? $arr_settings['ssba_align'] : '',
286
- 'options' => array(
287
- 'Left' => 'left',
288
- 'Center' => 'center',
289
- 'Right' => 'right',
290
- ),
291
- );
292
-
293
- // Alignment for Plus.
294
- $opts7p = array(
295
- 'form_group' => false,
296
- 'type' => 'select',
297
- 'name' => 'ssba_plus_align',
298
- 'label' => 'Alignment',
299
- 'tooltip' => 'Align your plus buttons the way you wish',
300
- 'selected' => isset($arr_settings['ssba_plus_align']) ? $arr_settings['ssba_plus_align'] : 'center',
301
- 'options' => array(
302
- 'Left' => 'left',
303
- 'Center' => 'center',
304
- 'Right' => 'right',
305
- ),
306
- );
307
-
308
- // Padding.
309
- $opts8 = array(
310
- 'form_group' => false,
311
- 'type' => 'number_addon',
312
- 'addon' => 'px',
313
- 'placeholder' => '10',
314
- 'max' => '50',
315
- 'name' => 'ssba_padding',
316
- 'label' => 'Padding',
317
- 'tooltip' => 'Apply some space around your images',
318
- 'value' => isset($arr_settings['ssba_padding']) ? $arr_settings['ssba_padding'] : '',
319
- );
320
-
321
- // Font color.
322
- $opts9 = array(
323
- 'form_group' => false,
324
- 'type' => 'colorpicker',
325
- 'name' => 'ssba_font_color',
326
- 'label' => 'Font Color',
327
- 'tooltip' => 'Choose the color of your share text',
328
- 'value' => isset($arr_settings['ssba_font_color']) ? $arr_settings['ssba_font_color'] : '',
329
- );
330
-
331
- // Font color for plus.
332
- $opts9p = array(
333
- 'form_group' => false,
334
- 'type' => 'colorpicker',
335
- 'name' => 'ssba_plus_font_color',
336
- 'label' => 'Font Color',
337
- 'tooltip' => 'Choose the color of your share text',
338
- 'value' => isset($arr_settings['ssba_plus_font_color']) ? $arr_settings['ssba_plus_font_color'] : '',
339
- );
340
-
341
- // Font family.
342
- $opts10 = array(
343
- 'form_group' => false,
344
- 'type' => 'select',
345
- 'name' => 'ssba_font_family',
346
- 'label' => 'Font Family',
347
- 'tooltip' => 'Choose a font available or inherit the font from your website',
348
- 'selected' => isset($arr_settings['ssba_font_family']) ? $arr_settings['ssba_font_family'] : '',
349
- 'options' => array(
350
- 'Reenie Beanie' => 'Reenie Beanie',
351
- 'Indie Flower' => 'Indie Flower',
352
- 'Inherit from my website' => '',
353
- ),
354
- );
355
-
356
- // Font family for plus.
357
- $opts10p = array(
358
- 'form_group' => false,
359
- 'type' => 'select',
360
- 'name' => 'ssba_plus_font_family',
361
- 'label' => 'Font Family',
362
- 'tooltip' => 'Choose a font available or inherit the font from your website',
363
- 'selected' => isset($arr_settings['ssba_plus_font_family']) ? $arr_settings['ssba_plus_font_family'] : '',
364
- 'options' => array(
365
- 'Reenie Beanie' => 'Reenie Beanie',
366
- 'Indie Flower' => 'Indie Flower',
367
- 'Inherit from my website' => '',
368
- ),
369
- );
370
-
371
- // Enqueue the styles so preview can update.
372
- wp_enqueue_style("{$this->plugin->assets_prefix}-reenie");
373
- wp_enqueue_style("{$this->plugin->assets_prefix}-indie");
374
-
375
- // Font size.
376
- $opts11 = array(
377
- 'form_group' => false,
378
- 'type' => 'number_addon',
379
- 'addon' => 'px',
380
- 'placeholder' => '20',
381
- 'name' => 'ssba_font_size',
382
- 'label' => 'Font Size',
383
- 'tooltip' => 'Set the size of the share text in pixels',
384
- 'value' => isset($arr_settings['ssba_font_size']) ? $arr_settings['ssba_font_size'] : '',
385
- );
386
-
387
- // Font size for plus.
388
- $opts11p = array(
389
- 'form_group' => false,
390
- 'type' => 'number_addon',
391
- 'addon' => 'px',
392
- 'placeholder' => '20',
393
- 'name' => 'ssba_plus_font_size',
394
- 'label' => 'Font Size',
395
- 'tooltip' => 'Set the size of the share text in pixels',
396
- 'value' => isset($arr_settings['ssba_plus_font_size']) ? $arr_settings['ssba_plus_font_size'] : '',
397
- );
398
-
399
- // Font weight.
400
- $opts12 = array(
401
- 'form_group' => false,
402
- 'type' => 'select',
403
- 'name' => 'ssba_font_weight',
404
- 'label' => 'Font Weight',
405
- 'tooltip' => 'Set the weight of the share text',
406
- 'selected' => isset($arr_settings['ssba_font_weight']) ? $arr_settings['ssba_font_weight'] : '',
407
- 'options' => array(
408
- 'Normal' => 'normal',
409
- 'Bold' => 'bold',
410
- 'Light' => 'light',
411
- ),
412
- );
413
-
414
- // Font weight for plus.
415
- $opts12p = array(
416
- 'form_group' => false,
417
- 'type' => 'select',
418
- 'name' => 'ssba_plus_font_weight',
419
- 'label' => 'Font Weight',
420
- 'tooltip' => 'Set the weight of the share text',
421
- 'selected' => isset($arr_settings['ssba_plus_font_weight']) ? $arr_settings['ssba_plus_font_weight'] : '',
422
- 'options' => array(
423
- 'Normal' => 'normal',
424
- 'Bold' => 'bold',
425
- 'Light' => 'light',
426
- ),
427
- );
428
-
429
- // Text placement.
430
- $opts13 = array(
431
- 'form_group' => false,
432
- 'type' => 'select',
433
- 'name' => 'ssba_text_placement',
434
- 'label' => 'Text placement',
435
- 'tooltip' => 'Choose where you want your text to be displayed, in relation to the buttons',
436
- 'selected' => isset($arr_settings['ssba_text_placement']) ? $arr_settings['ssba_text_placement'] : '',
437
- 'options' => array(
438
- 'Above' => 'above',
439
- 'Left' => 'left',
440
- 'Right' => 'right',
441
- 'Below' => 'below',
442
- ),
443
- );
444
-
445
- // Text placement for plus.
446
- $opts13p = array(
447
- 'form_group' => false,
448
- 'type' => 'select',
449
- 'name' => 'ssba_plus_text_placement',
450
- 'label' => 'Text placement',
451
- 'tooltip' => 'Choose where you want your text to be displayed, in relation to the buttons',
452
- 'selected' => isset($arr_settings['ssba_plus_text_placement']) ? $arr_settings['ssba_plus_text_placement'] : '',
453
- 'options' => array(
454
- 'Above' => 'above',
455
- 'Left' => 'left',
456
- 'Right' => 'right',
457
- 'Below' => 'below',
458
- ),
459
- );
460
-
461
- // Container padding.
462
- $opts14 = array(
463
- 'form_group' => false,
464
- 'type' => 'number_addon',
465
- 'addon' => 'px',
466
- 'placeholder' => '10',
467
- 'name' => 'ssba_div_padding',
468
- 'label' => 'Container Padding',
469
- 'tooltip' => 'Add some padding to your share container',
470
- 'value' => isset($arr_settings['ssba_div_padding']) ? $arr_settings['ssba_div_padding'] : '',
471
- );
472
-
473
- // Div background color.
474
- $opts15 = array(
475
- 'form_group' => false,
476
- 'type' => 'colorpicker',
477
- 'name' => 'ssba_div_background',
478
- 'label' => 'Container Background Color',
479
- 'tooltip' => 'Choose the color of your share container',
480
- 'value' => isset($arr_settings['ssba_div_background']) ? $arr_settings['ssba_div_background'] : '',
481
- );
482
-
483
- // Div border color.
484
- $opts16 = array(
485
- 'form_group' => false,
486
- 'type' => 'colorpicker',
487
- 'name' => 'ssba_div_border',
488
- 'label' => 'Container Border Color',
489
- 'tooltip' => 'Choose the color of your share container border',
490
- 'value' => isset($arr_settings['ssba_div_border']) ? $arr_settings['ssba_div_border'] : '',
491
- );
492
-
493
- // Container border width.
494
- $opts17 = array(
495
- 'form_group' => false,
496
- 'type' => 'number_addon',
497
- 'addon' => 'px',
498
- 'placeholder' => '1',
499
- 'name' => 'ssba_border_width',
500
- 'label' => 'Container Border Width',
501
- 'tooltip' => 'Set the width of the share container border',
502
- 'value' => isset($arr_settings['ssba_border_width']) ? $arr_settings['ssba_border_width'] : '',
503
- );
504
-
505
- // Rounded container corners.
506
- $opts18 = array(
507
- 'form_group' => false,
508
- 'type' => 'checkbox',
509
- 'name' => 'ssba_div_rounded_corners',
510
- 'label' => 'Rounded Container Corners',
511
- 'tooltip' => 'Switch on to enable rounded corners for your share container',
512
- 'value' => 'Y',
513
- 'checked' => isset($arr_settings['ssba_div_rounded_corners']) && 'Y' === $arr_settings['ssba_div_rounded_corners'] ? esc_attr('checked') : '',
514
- );
515
-
516
- // Share count.
517
- $opts19 = array(
518
- 'form_group' => false,
519
- 'type' => 'checkbox',
520
- 'name' => 'ssba_show_share_count',
521
- 'label' => 'Share Count',
522
- 'tooltip' => 'Check the box if you wish to enable share counts. Enabling this option will slow down the loading of any pages that use share buttons',
523
- 'value' => 'Y',
524
- 'checked' => isset($arr_settings['ssba_show_share_count']) && 'Y' === $arr_settings['ssba_show_share_count'] ? esc_attr('checked') : null,
525
- );
526
-
527
- // Share count for plus.
528
- $opts19p = array(
529
- 'form_group' => false,
530
- 'type' => 'checkbox',
531
- 'name' => 'ssba_plus_show_share_count',
532
- 'label' => 'Share Count',
533
- 'tooltip' => 'Check the box if you wish to enable share counts. Enabling this option will slow down the loading of any pages that use share buttons',
534
- 'value' => 'Y',
535
- 'checked' => isset($arr_settings['ssba_plus_show_share_count']) && 'Y' === $arr_settings['ssba_plus_show_share_count'] ? esc_attr('checked') : null,
536
- );
537
-
538
- // Share count for share bar.
539
- $opts19s = array(
540
- 'form_group' => false,
541
- 'type' => 'checkbox',
542
- 'name' => 'ssba_bar_show_share_count',
543
- 'label' => 'Share Count',
544
- 'tooltip' => 'Check the box if you wish to enable share counts. Enabling this option will slow down the loading of any pages that use share buttons',
545
- 'value' => 'Y',
546
- 'checked' => isset($arr_settings['ssba_bar_show_share_count']) && 'Y' === $arr_settings['ssba_bar_show_share_count'] ? esc_attr('checked') : null,
547
- );
548
-
549
- // Show count once.
550
- $opts20 = array(
551
- 'form_group' => false,
552
- 'type' => 'checkbox',
553
- 'name' => 'ssba_share_count_once',
554
- 'label' => 'Show Once',
555
- 'tooltip' => 'This option is recommended, it deactivates share counts for categories and archives allowing them to load more quickly',
556
- 'value' => 'Y',
557
- 'checked' => isset($arr_settings['ssba_share_count_once']) && 'Y' === $arr_settings['ssba_share_count_once'] ? esc_attr('checked') : null,
558
- );
559
-
560
- // Show count once for plus.
561
- $opts20p = array(
562
- 'form_group' => false,
563
- 'type' => 'checkbox',
564
- 'name' => 'ssba_plus_share_count_once',
565
- 'label' => 'Show Once',
566
- 'tooltip' => 'This option is recommended, it deactivates share counts for categories and archives allowing them to load more quickly',
567
- 'value' => 'Y',
568
- 'checked' => isset($arr_settings['ssba_plus_share_count_once']) && 'Y' === $arr_settings['ssba_plus_share_count_once'] ? esc_attr('checked') : null,
569
- );
570
-
571
- // Show count once for share bar.
572
- $opts20s = array(
573
- 'form_group' => false,
574
- 'type' => 'checkbox',
575
- 'name' => 'ssba_bar_share_count_once',
576
- 'label' => 'Show Once',
577
- 'tooltip' => 'This option is recommended, it deactivates share counts for categories and archives allowing them to load more quickly',
578
- 'value' => 'Y',
579
- 'checked' => isset($arr_settings['ssba_bar_share_count_once']) && 'Y' === $arr_settings['ssba_bar_share_count_once'] ? esc_attr('checked') : null,
580
- );
581
-
582
- // Share counters style.
583
- $opts21 = array(
584
- 'form_group' => false,
585
- 'type' => 'select',
586
- 'name' => 'ssba_share_count_style',
587
- 'label' => 'Counters Style',
588
- 'tooltip' => 'Pick a setting to style the share counters',
589
- 'selected' => isset($arr_settings['ssba_share_count_style']) ? $arr_settings['ssba_share_count_style'] : '',
590
- 'options' => array(
591
- 'Default' => 'default',
592
- 'White' => 'white',
593
- 'Blue' => 'blue',
594
- ),
595
- );
596
-
597
- // Sharedcount enable.
598
- $opts23 = array(
599
- 'form_group' => false,
600
- 'type' => 'checkbox',
601
- 'name' => 'sharedcount_enabled',
602
- 'label' => 'Enable sharedcount.com API',
603
- 'tooltip' => 'Enable if you wish to enable the use of the sharedcount.com API',
604
- 'value' => 'Y',
605
- 'checked' => isset($arr_settings['sharedcount_enabled']) && 'Y' === $arr_settings['sharedcount_enabled'] ? esc_attr('checked') : null,
606
- );
607
-
608
- // Sharedcount plan.
609
- $opts24 = array(
610
- 'form_group' => false,
611
- 'type' => 'select',
612
- 'name' => 'sharedcount_plan',
613
- 'label' => 'sharedcount.com plan',
614
- 'tooltip' => 'Select your sharedcount.com plan',
615
- 'selected' => isset($arr_settings['sharedcount_plan']) ? $arr_settings['sharedcount_plan'] : '',
616
- 'options' => array(
617
- 'Free' => 'free',
618
- 'Plus' => 'plus',
619
- 'Business' => 'business',
620
- ),
621
- );
622
-
623
- // Sharedcount api key.
624
- $opts25 = array(
625
- 'form_group' => false,
626
- 'type' => 'text',
627
- 'placeholder' => '9b17c12712c691491ef95f46c51ce3917118fdf9',
628
- 'name' => 'sharedcount_api_key',
629
- 'label' => 'sharedcount.com API Key',
630
- 'tooltip' => 'Add some text included in an email when people share that way',
631
- 'value' => isset($arr_settings['sharedcount_api_key']) ? $arr_settings['sharedcount_api_key'] : '',
632
- );
633
-
634
- // Sharedcount enable.
635
- $opts23p = array(
636
- 'form_group' => false,
637
- 'type' => 'checkbox',
638
- 'name' => 'plus_sharedcount_enabled',
639
- 'label' => 'Enable sharedcount.com API',
640
- 'tooltip' => 'Enable if you wish to enable the use of the sharedcount.com API',
641
- 'value' => 'Y',
642
- 'checked' => isset($arr_settings['plus_sharedcount_enabled']) && 'Y' === $arr_settings['plus_sharedcount_enabled'] ? esc_attr('checked') : null,
643
- );
644
-
645
- // Sharedcount plan.
646
- $opts24p = array(
647
- 'form_group' => false,
648
- 'type' => 'select',
649
- 'name' => 'plus_sharedcount_plan',
650
- 'label' => 'sharedcount.com plan',
651
- 'tooltip' => 'Select your sharedcount.com plan',
652
- 'selected' => isset($arr_settings['plus_sharedcount_plan']) ? $arr_settings['plus_sharedcount_plan'] : '',
653
- 'options' => array(
654
- 'Free' => 'free',
655
- 'Plus' => 'plus',
656
- 'Business' => 'business',
657
- ),
658
- );
659
-
660
- // Sharedcount api key.
661
- $opts25p = array(
662
- 'form_group' => false,
663
- 'type' => 'text',
664
- 'placeholder' => '9b17c12712c691491ef95f46c51ce3917118fdf9',
665
- 'name' => 'plus_sharedcount_api_key',
666
- 'label' => 'sharedcount.com API Key',
667
- 'tooltip' => 'Add some text included in an email when people share that way',
668
- 'value' => isset($arr_settings['plus_sharedcount_api_key']) ? $arr_settings['plus_sharedcount_api_key'] : '',
669
- );
670
-
671
- // Sharedcount enable.
672
- $opts23b = array(
673
- 'form_group' => false,
674
- 'type' => 'checkbox',
675
- 'name' => 'bar_sharedcount_enabled',
676
- 'label' => 'Enable sharedcount.com API',
677
- 'tooltip' => 'Enable if you wish to enable the use of the sharedcount.com API',
678
- 'value' => 'Y',
679
- 'checked' => isset($arr_settings['bar_sharedcount_enabled']) && 'Y' === $arr_settings['bar_sharedcount_enabled'] ? esc_attr('checked') : null,
680
- );
681
-
682
- // Sharedcount plan.
683
- $opts24b = array(
684
- 'form_group' => false,
685
- 'type' => 'select',
686
- 'name' => 'bar_sharedcount_plan',
687
- 'label' => 'sharedcount.com plan',
688
- 'tooltip' => 'Select your sharedcount.com plan',
689
- 'selected' => isset($arr_settings['bar_sharedcount_plan']) ? $arr_settings['bar_sharedcount_plan'] : '',
690
- 'options' => array(
691
- 'Free' => 'free',
692
- 'Plus' => 'plus',
693
- 'Business' => 'business',
694
- ),
695
- );
696
-
697
- // Sharedcount api key.
698
- $opts25b = array(
699
- 'form_group' => false,
700
- 'type' => 'text',
701
- 'placeholder' => '9b17c12712c691491ef95f46c51ce3917118fdf9',
702
- 'name' => 'bar_sharedcount_api_key',
703
- 'label' => 'sharedcount.com API Key',
704
- 'tooltip' => 'Add some text included in an email when people share that way',
705
- 'value' => isset($arr_settings['bar_sharedcount_api_key']) ? $arr_settings['bar_sharedcount_api_key'] : '',
706
- );
707
-
708
- // Link to ssb.
709
- $opts26 = array(
710
- 'form_group' => false,
711
- 'type' => 'checkbox',
712
- 'name' => 'ssba_link_to_ssb',
713
- 'label' => 'Share Text Link',
714
- 'tooltip' => 'Enabling this will set your share text as a link to simplesharebuttons.com to help others learn of the plugin',
715
- 'value' => 'Y',
716
- 'checked' => isset($arr_settings['ssba_link_to_ssb']) && 'Y' === $arr_settings['ssba_link_to_ssb'] ? esc_attr('checked') : null,
717
- );
718
-
719
- // Link to ssb for plus.
720
- $opts26p = array(
721
- 'form_group' => false,
722
- 'type' => 'checkbox',
723
- 'name' => 'ssba_plus_link_to_ssb',
724
- 'label' => 'Share Text Link',
725
- 'tooltip' => 'Enabling this will set your share text as a link to simplesharebuttons.com to help others learn of the plugin',
726
- 'value' => 'Y',
727
- 'checked' => isset($arr_settings['ssba_plus_link_to_ssb']) && 'Y' === $arr_settings['ssba_plus_link_to_ssb'] ? esc_attr('checked') : null,
728
- );
729
-
730
- // Content priority.
731
- $opts27 = array(
732
- 'form_group' => false,
733
- 'type' => 'number',
734
- 'placeholder' => '10',
735
- 'name' => 'ssba_content_priority',
736
- 'label' => 'Content Priority',
737
- 'tooltip' => 'Set the priority for your share buttons within your content. 1-10, default is 10',
738
- 'value' => isset($arr_settings['ssba_content_priority']) ? $arr_settings['ssba_content_priority'] : '',
739
- );
740
-
741
- // Share in new window.
742
- $opts28 = array(
743
- 'form_group' => false,
744
- 'type' => 'checkbox',
745
- 'name' => 'ssba_share_new_window',
746
- 'label' => 'Open links in a new window',
747
- 'tooltip' => 'Disabling this will make links open in the same window',
748
- 'value' => 'Y',
749
- 'checked' => isset($arr_settings['ssba_share_new_window']) && 'Y' === $arr_settings['ssba_share_new_window'] ? esc_attr('checked') : null,
750
- );
751
-
752
- // Share in new window for plus.
753
- $opts28p = array(
754
- 'form_group' => false,
755
- 'type' => 'checkbox',
756
- 'name' => 'ssba_plus_share_new_window',
757
- 'label' => 'Open links in a new window',
758
- 'tooltip' => 'Disabling this will make links open in the same window',
759
- 'value' => 'Y',
760
- 'checked' => isset($arr_settings['ssba_plus_share_new_window']) && 'Y' === $arr_settings['ssba_plus_share_new_window'] ? esc_attr('checked') : null,
761
- );
762
-
763
- // Share in new window for share bar.
764
- $opts28s = array(
765
- 'form_group' => false,
766
- 'type' => 'checkbox',
767
- 'name' => 'ssba_bar_share_new_window',
768
- 'label' => 'Open links in a new window',
769
- 'tooltip' => 'Disabling this will make links open in the same window',
770
- 'value' => 'Y',
771
- 'checked' => isset($arr_settings['ssba_bar_share_new_window']) && 'Y' === $arr_settings['ssba_bar_share_new_window'] ? esc_attr('checked') : null,
772
- );
773
-
774
- // Nofollow.
775
- $opts29 = array(
776
- 'form_group' => false,
777
- 'type' => 'checkbox',
778
- 'name' => 'ssba_rel_nofollow',
779
- 'label' => 'Add rel="nofollow"',
780
- 'tooltip' => 'Enable this to add nofollow to all share links',
781
- 'value' => 'Y',
782
- 'checked' => isset($arr_settings['ssba_rel_nofollow']) && 'Y' === $arr_settings['ssba_rel_nofollow'] ? esc_attr('checked') : null,
783
- );
784
-
785
- // Nofollow for plus.
786
- $opts29p = array(
787
- 'form_group' => false,
788
- 'type' => 'checkbox',
789
- 'name' => 'ssba_plus_rel_nofollow',
790
- 'label' => 'Add rel="nofollow"',
791
- 'tooltip' => 'Enable this to add nofollow to all share links',
792
- 'value' => 'Y',
793
- 'checked' => isset($arr_settings['ssba_plus_rel_nofollow']) && 'Y' === $arr_settings['ssba_plus_rel_nofollow'] ? esc_attr('checked') : null,
794
- );
795
-
796
- // Nofollow for share bar.
797
- $opts29s = array(
798
- 'form_group' => false,
799
- 'type' => 'checkbox',
800
- 'name' => 'ssba_bar_rel_nofollow',
801
- 'label' => 'Add rel="nofollow"',
802
- 'tooltip' => 'Enable this to add nofollow to all share links',
803
- 'value' => 'Y',
804
- 'checked' => isset($arr_settings['ssba_bar_rel_nofollow']) && 'Y' === $arr_settings['ssba_bar_rel_nofollow'] ? esc_attr('checked') : null,
805
- );
806
-
807
- // Widget share text.
808
- $opts30 = array(
809
- 'form_group' => false,
810
- 'type' => 'text',
811
- 'placeholder' => 'Keeping sharing simple...',
812
- 'name' => 'ssba_widget_text',
813
- 'label' => 'Widget Share Text',
814
- 'tooltip' => 'Add custom share text when used as a widget',
815
- 'value' => isset($arr_settings['ssba_widget_text']) ? $arr_settings['ssba_widget_text'] : '',
816
- );
817
-
818
- // Widget share text for plus.
819
- $opts30p = array(
820
- 'form_group' => false,
821
- 'type' => 'text',
822
- 'placeholder' => 'Keeping sharing simple...',
823
- 'name' => 'ssba_plus_widget_text',
824
- 'label' => 'Widget Share Text',
825
- 'tooltip' => 'Add custom share text when used as a widget',
826
- 'value' => isset($arr_settings['ssba_plus_widget_text']) ? $arr_settings['ssba_plus_widget_text'] : '',
827
- );
828
-
829
- // Email share text.
830
- $opts31 = array(
831
- 'form_group' => false,
832
- 'type' => 'text',
833
- 'placeholder' => 'Share by email...',
834
- 'name' => 'ssba_email_message',
835
- 'label' => 'Email Text',
836
- 'tooltip' => 'Add some text included in an email when people share that way',
837
- 'value' => isset($arr_settings['ssba_email_message']) ? $arr_settings['ssba_email_message'] : '',
838
- );
839
-
840
- // Email share text for plus.
841
- $opts31p = array(
842
- 'form_group' => false,
843
- 'type' => 'text',
844
- 'placeholder' => 'Share by email...',
845
- 'name' => 'ssba_plus_email_message',
846
- 'label' => 'Email Text',
847
- 'tooltip' => 'Add some text included in an email when people share that way',
848
- 'value' => isset($arr_settings['ssba_plus_email_message']) ? $arr_settings['ssba_plus_email_message'] : '',
849
- );
850
-
851
- // Email share text for share bar.
852
- $opts31s = array(
853
- 'form_group' => false,
854
- 'type' => 'text',
855
- 'placeholder' => 'Share by email...',
856
- 'name' => 'ssba_bar_email_message',
857
- 'label' => 'Email Text',
858
- 'tooltip' => 'Add some text included in an email when people share that way',
859
- 'value' => isset($arr_settings['ssba_bar_email_message']) ? $arr_settings['ssba_bar_email_message'] : '',
860
- );
861
-
862
- // Facebook app id.
863
- $opts32 = array(
864
- 'form_group' => false,
865
- 'type' => 'text',
866
- 'placeholder' => '123456789123',
867
- 'name' => 'facebook_app_id',
868
- 'label' => 'Facebook App ID',
869
- 'tooltip' => 'Enter your Facebook App ID, e.g. 123456789123',
870
- 'value' => isset($arr_settings['facebook_app_id']) ? $arr_settings['facebook_app_id'] : '',
871
- 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? esc_attr('disabled') : null,
872
- );
873
-
874
- // Facebook app id for plus.
875
- $opts32p = array(
876
- 'form_group' => false,
877
- 'type' => 'text',
878
- 'placeholder' => '123456789123',
879
- 'name' => 'plus_facebook_app_id',
880
- 'label' => 'Facebook App ID',
881
- 'tooltip' => 'Enter your Facebook App ID, e.g. 123456789123',
882
- 'value' => isset($arr_settings['plus_facebook_app_id']) ? $arr_settings['plus_facebook_app_id'] : '',
883
- 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? esc_attr('disabled') : null,
884
- );
885
-
886
- // Facebook app id for share bar.
887
- $opts32s = array(
888
- 'form_group' => false,
889
- 'type' => 'text',
890
- 'placeholder' => '123456789123',
891
- 'name' => 'share_facebook_app_id',
892
- 'label' => 'Facebook App ID',
893
- 'tooltip' => 'Enter your Facebook App ID, e.g. 123456789123',
894
- 'value' => isset($arr_settings['bar_facebook_app_id']) ? $arr_settings['bar_facebook_app_id'] : '',
895
- 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? esc_attr('disabled') : null,
896
- );
897
-
898
- // Facebook insights.
899
- $opts33 = array(
900
- 'form_group' => false,
901
- 'type' => 'checkbox',
902
- 'name' => 'facebook_insights',
903
- 'label' => 'Facebook Insights',
904
- 'tooltip' => 'Enable this feature to enable Facebook Insights',
905
- 'value' => 'Y',
906
- 'checked' => isset($arr_settings['facebook_insights']) && 'Y' === $arr_settings['facebook_insights'] ? 'checked' : null,
907
- 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? 'disabled' : null,
908
- );
909
-
910
- // Ignore sdk.
911
- $ignore_sdk = array(
912
- 'form_group' => false,
913
- 'type' => 'checkbox',
914
- 'name' => 'ignore_facebook_sdk',
915
- 'label' => 'Ignore FB SDK',
916
- 'tooltip' => 'Using you\'re own Facebook SDK? Ignore ours.',
917
- 'value' => 'Y',
918
- 'checked' => isset($arr_settings['ignore_facebook_sdk']) && 'Y' === $arr_settings['ignore_facebook_sdk'] ? esc_attr('checked') : '',
919
- );
920
-
921
- // Facebook insights for plus.
922
- $opts33p = array(
923
- 'form_group' => false,
924
- 'type' => 'checkbox',
925
- 'name' => 'plus_facebook_insights',
926
- 'label' => 'Facebook Insights',
927
- 'tooltip' => 'Enable this feature to enable Facebook Insights',
928
- 'value' => 'Y',
929
- 'checked' => isset($arr_settings['plus_facebook_insights']) && 'Y' === $arr_settings['plus_facebook_insights'] ? 'checked' : null,
930
- 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? 'disabled' : null,
931
- );
932
-
933
- // Plus ignore sdk.
934
- $plus_ignore_sdk = array(
935
- 'form_group' => false,
936
- 'type' => 'checkbox',
937
- 'name' => 'plus_ignore_facebook_sdk',
938
- 'label' => 'Ignore FB SDK',
939
- 'tooltip' => 'Using you\'re own Facebook SDK? Ignore ours.',
940
- 'value' => 'Y',
941
- 'checked' => isset($arr_settings['plus_ignore_facebook_sdk']) && 'Y' === $arr_settings['plus_ignore_facebook_sdk'] ? esc_attr('checked') : '',
942
- );
943
-
944
- // Facebook insights for share bar.
945
- $opts33s = array(
946
- 'form_group' => false,
947
- 'type' => 'checkbox',
948
- 'name' => 'share_facebook_insights',
949
- 'label' => 'Facebook Insights',
950
- 'tooltip' => 'Enable this feature to enable Facebook Insights',
951
- 'value' => 'Y',
952
- 'checked' => isset($arr_settings['bar_facebook_insights']) && 'Y' === $arr_settings['bar_facebook_insights'] ? 'checked' : null,
953
- 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? 'disabled' : null,
954
- );
955
-
956
- // Twitter share text.
957
- $opts34 = array(
958
- 'form_group' => false,
959
- 'type' => 'text',
960
- 'placeholder' => 'Shared by Twitter...',
961
- 'name' => 'ssba_twitter_text',
962
- 'label' => 'Twitter Text',
963
- 'tooltip' => 'Add some custom text for when people share via Twitter',
964
- 'value' => isset($arr_settings['ssba_twitter_text']) ? $arr_settings['ssba_twitter_text'] : '',
965
- );
966
-
967
- // Twitter share text for plus.
968
- $opts34p = array(
969
- 'form_group' => false,
970
- 'type' => 'text',
971
- 'placeholder' => 'Shared by Twitter...',
972
- 'name' => 'ssba_plus_twitter_text',
973
- 'label' => 'Twitter Text',
974
- 'tooltip' => 'Add some custom text for when people share via Twitter',
975
- 'value' => isset($arr_settings['ssba_plus_twitter_text']) ? $arr_settings['ssba_plus_twitter_text'] : '',
976
- );
977
-
978
- // Twitter share text for share bar.
979
- $opts34s = array(
980
- 'form_group' => false,
981
- 'type' => 'text',
982
- 'placeholder' => 'Shared by Twitter...',
983
- 'name' => 'ssba_bar_twitter_text',
984
- 'label' => 'Twitter Text',
985
- 'tooltip' => 'Add some custom text for when people share via Twitter',
986
- 'value' => isset($arr_settings['ssba_bar_twitter_text']) ? $arr_settings['ssba_bar_twitter_text'] : '',
987
- );
988
-
989
- // Flattr user id.
990
- $opts35 = array(
991
- 'form_group' => false,
992
- 'type' => 'text',
993
- 'placeholder' => 'davidsneal',
994
- 'name' => 'ssba_flattr_user_id',
995
- 'label' => 'Flattr User ID',
996
- 'tooltip' => 'Enter your Flattr ID, e.g. davidsneal',
997
- 'value' => isset($arr_settings['ssba_flattr_user_id']) ? $arr_settings['ssba_flattr_user_id'] : '',
998
- );
999
-
1000
- // Flattr user id for plus.
1001
- $opts35p = array(
1002
- 'form_group' => false,
1003
- 'type' => 'text',
1004
- 'placeholder' => 'davidsneal',
1005
- 'name' => 'ssba_plus_flattr_user_id',
1006
- 'label' => 'Flattr User ID',
1007
- 'tooltip' => 'Enter your Flattr ID, e.g. davidsneal',
1008
- 'value' => isset($arr_settings['ssba_plus_flattr_user_id']) ? $arr_settings['ssba_plus_flattr_user_id'] : '',
1009
- );
1010
-
1011
- // Flattr user id for share bar.
1012
- $opts35s = array(
1013
- 'form_group' => false,
1014
- 'type' => 'text',
1015
- 'placeholder' => 'davidsneal',
1016
- 'name' => 'ssba_bar_flattr_user_id',
1017
- 'label' => 'Flattr User ID',
1018
- 'tooltip' => 'Enter your Flattr ID, e.g. davidsneal',
1019
- 'value' => isset($arr_settings['ssba_bar_flattr_user_id']) ? $arr_settings['ssba_bar_flattr_user_id'] : '',
1020
- );
1021
-
1022
- // Flattr url.
1023
- $opts36 = array(
1024
- 'form_group' => false,
1025
- 'type' => 'text',
1026
- 'placeholder' => 'flattr.com/@username',
1027
- 'name' => 'ssba_flattr_url',
1028
- 'label' => 'Flattr URL',
1029
- 'tooltip' => 'This option is perfect for dedicated sites, e.g. https://simplesharebuttons.com',
1030
- 'value' => isset($arr_settings['ssba_flattr_url']) ? $arr_settings['ssba_flattr_url'] : '',
1031
- );
1032
-
1033
- // Flattr url for plus.
1034
- $opts36p = array(
1035
- 'form_group' => false,
1036
- 'type' => 'text',
1037
- 'placeholder' => 'flattr.com/@username',
1038
- 'name' => 'ssba_plus_flattr_url',
1039
- 'label' => 'Flattr URL',
1040
- 'tooltip' => 'This option is perfect for dedicated sites, e.g. https://simplesharebuttons.com',
1041
- 'value' => isset($arr_settings['ssba_plus_flattr_url']) ? $arr_settings['ssba_plus_flattr_url'] : '',
1042
- );
1043
-
1044
- // Flattr url for share bar.
1045
- $opts36s = array(
1046
- 'form_group' => false,
1047
- 'type' => 'text',
1048
- 'placeholder' => 'flattr.com/@username',
1049
- 'name' => 'ssba_bar_flattr_url',
1050
- 'label' => 'Flattr URL',
1051
- 'tooltip' => 'This option is perfect for dedicated sites, e.g. https://simplesharebuttons.com',
1052
- 'value' => isset($arr_settings['ssba_bar_flattr_url']) ? $arr_settings['ssba_bar_flattr_url'] : '',
1053
- );
1054
-
1055
- // Buffer text.
1056
- $opts37 = array(
1057
- 'form_group' => false,
1058
- 'type' => 'text',
1059
- 'placeholder' => 'Shared by Buffer...',
1060
- 'name' => 'ssba_buffer_text',
1061
- 'label' => 'Custom Buffer Text',
1062
- 'tooltip' => 'Add some custom text for when people share via Buffer',
1063
- 'value' => isset($arr_settings['ssba_buffer_text']) ? $arr_settings['ssba_buffer_text'] : '',
1064
- );
1065
-
1066
- // Buffer text for plus.
1067
- $opts37p = array(
1068
- 'form_group' => false,
1069
- 'type' => 'text',
1070
- 'placeholder' => 'Shared by Buffer...',
1071
- 'name' => 'ssba_plus_buffer_text',
1072
- 'label' => 'Custom Buffer Text',
1073
- 'tooltip' => 'Add some custom text for when people share via Buffer',
1074
- 'value' => isset($arr_settings['ssba_plus_buffer_text']) ? $arr_settings['ssba_plus_buffer_text'] : '',
1075
- );
1076
-
1077
- // Buffer text for share bar.
1078
- $opts37s = array(
1079
- 'form_group' => false,
1080
- 'type' => 'text',
1081
- 'placeholder' => 'Shared by Buffer...',
1082
- 'name' => 'ssba_bar_buffer_text',
1083
- 'label' => 'Custom Buffer Text',
1084
- 'tooltip' => 'Add some custom text for when people share via Buffer',
1085
- 'value' => isset($arr_settings['ssba_bar_buffer_text']) ? $arr_settings['ssba_bar_buffer_text'] : '',
1086
- );
1087
-
1088
- // Pin featured images.
1089
- $opts38 = array(
1090
- 'form_group' => false,
1091
- 'type' => 'checkbox',
1092
- 'name' => 'ssba_pinterest_featured',
1093
- 'label' => 'Pin Featured Images',
1094
- 'tooltip' => 'Force the use of featured images for posts/pages when pinning',
1095
- 'value' => 'Y',
1096
- 'checked' => isset($arr_settings['ssba_pinterest_featured']) && 'Y' === $arr_settings['ssba_pinterest_featured'] ? 'checked' : null,
1097
- );
1098
-
1099
- // Pin featured images for plus.
1100
- $opts38p = array(
1101
- 'form_group' => false,
1102
- 'type' => 'checkbox',
1103
- 'name' => 'ssba_plus_pinterest_featured',
1104
- 'label' => 'Pin Featured Images',
1105
- 'tooltip' => 'Force the use of featured images for posts/pages when pinning',
1106
- 'value' => 'Y',
1107
- 'checked' => isset($arr_settings['ssba_plus_pinterest_featured']) && 'Y' === $arr_settings['ssba_plus_pinterest_featured'] ? 'checked' : null,
1108
- );
1109
-
1110
- // Pin featured images for share bar.
1111
- $opts38s = array(
1112
- 'form_group' => false,
1113
- 'type' => 'checkbox',
1114
- 'name' => 'ssba_bar_pinterest_featured',
1115
- 'label' => 'Pin Featured Images',
1116
- 'tooltip' => 'Force the use of featured images for posts/pages when pinning',
1117
- 'value' => 'Y',
1118
- 'checked' => isset($arr_settings['ssba_bar_pinterest_featured']) && 'Y' === $arr_settings['ssba_bar_pinterest_featured'] ? 'checked' : null,
1119
- );
1120
-
1121
- // Default pinterest image.
1122
- $opts39 = array(
1123
- 'form_group' => false,
1124
- 'type' => 'image_upload',
1125
- 'name' => 'ssba_default_pinterest',
1126
- 'label' => 'Default Pinterest Image',
1127
- 'tooltip' => 'Upload a default Pinterest image',
1128
- 'value' => isset($arr_settings['ssba_default_pinterest']) ? $arr_settings['ssba_default_pinterest'] : '',
1129
- );
1130
-
1131
- // Default pinterest image for plus.
1132
- $opts39p = array(
1133
- 'form_group' => false,
1134
- 'type' => 'image_upload',
1135
- 'name' => 'ssba_plus_default_pinterest',
1136
- 'label' => 'Default Pinterest Image',
1137
- 'tooltip' => 'Upload a default Pinterest image',
1138
- 'value' => isset($arr_settings['ssba_plus_default_pinterest']) ? $arr_settings['ssba_plus_default_pinterest'] : '',
1139
- );
1140
-
1141
- // Default pinterest image for share bar.
1142
- $opts39s = array(
1143
- 'form_group' => false,
1144
- 'type' => 'image_upload',
1145
- 'name' => 'ssba_bar_default_pinterest',
1146
- 'label' => 'Default Pinterest Image',
1147
- 'tooltip' => 'Upload a default Pinterest image',
1148
- 'value' => isset($arr_settings['ssba_bar_default_pinterest']) ? $arr_settings['ssba_bar_default_pinterest'] : '',
1149
- );
1150
-
1151
- // Additional css.
1152
- $opts40 = array(
1153
- 'form_group' => false,
1154
- 'type' => 'textarea',
1155
- 'rows' => '15',
1156
- 'class' => 'code-font',
1157
- 'name' => 'ssba_additional_css',
1158
- 'label' => 'Additional CSS',
1159
- 'tooltip' => 'Add your own additional CSS if you wish',
1160
- 'value' => isset($arr_settings['ssba_additional_css']) ? $arr_settings['ssba_additional_css'] : '',
1161
- );
1162
-
1163
- // Additional css for plus.
1164
- $opts40p = array(
1165
- 'form_group' => false,
1166
- 'type' => 'textarea',
1167
- 'rows' => '15',
1168
- 'class' => 'code-font',
1169
- 'name' => 'ssba_plus_additional_css',
1170
- 'label' => 'Additional CSS',
1171
- 'tooltip' => 'Add your own additional CSS if you wish',
1172
- 'value' => isset($arr_settings['ssba_plus_additional_css']) ? $arr_settings['ssba_plus_additional_css'] : '',
1173
- );
1174
-
1175
- // Additional css for share.
1176
- $opts40s = array(
1177
- 'form_group' => false,
1178
- 'type' => 'textarea',
1179
- 'rows' => '15',
1180
- 'class' => 'code-font',
1181
- 'name' => 'ssba_bar_additional_css',
1182
- 'label' => 'Additional CSS',
1183
- 'tooltip' => 'Add your own additional CSS if you wish',
1184
- 'value' => isset($arr_settings['ssba_bar_additional_css']) ? $arr_settings['ssba_bar_additional_css'] : '',
1185
- );
1186
-
1187
- // Enable custom css.
1188
- $opts41 = array(
1189
- 'form_group' => false,
1190
- 'type' => 'checkbox',
1191
- 'name' => 'ssba_custom_styles_enabled',
1192
- 'label' => 'Enable Custom CSS',
1193
- 'tooltip' => 'Switch on to disable all SSBA styles and use your own custom CSS',
1194
- 'value' => 'Y',
1195
- 'checked' => isset($arr_settings['ssba_custom_styles_enabled']) && 'Y' === $arr_settings['ssba_custom_styles_enabled'] ? 'checked' : null,
1196
- );
1197
-
1198
- // Custom css.
1199
- $opts42 = array(
1200
- 'form_group' => false,
1201
- 'type' => 'textarea',
1202
- 'rows' => '15',
1203
- 'class' => 'code-font',
1204
- 'name' => 'ssba_custom_styles',
1205
- 'label' => 'Custom CSS',
1206
- 'tooltip' => 'Enter in your own custom CSS for your share buttons',
1207
- 'value' => isset($arr_settings['ssba_custom_styles']) ? $arr_settings['ssba_custom_styles'] : '',
1208
- );
1209
-
1210
- // Switch to new buttons.
1211
- $opts43 = array(
1212
- 'form_group' => false,
1213
- 'type' => 'checkbox',
1214
- 'name' => 'ssba_new_buttons',
1215
- 'label' => 'Plus Share Buttons',
1216
- 'tooltip' => 'If "On" new buttons replace the old on your site.',
1217
- 'value' => 'Y',
1218
- 'checked' => isset($arr_settings['ssba_new_buttons']) && 'Y' === $arr_settings['ssba_new_buttons'] ? 'checked' : null,
1219
- );
1220
-
1221
- // Select style of new buttons.
1222
- $opts44 = array(
1223
- 'form_group' => false,
1224
- 'type' => 'select',
1225
- 'name' => 'ssba_plus_button_style',
1226
- 'label' => 'Theme',
1227
- 'tooltip' => 'Choose the style of the new buttons',
1228
- 'selected' => isset($arr_settings['ssba_plus_button_style']) ? $arr_settings['ssba_plus_button_style'] : '',
1229
- 'options' => array(
1230
- 'Round' => 1,
1231
- 'Square' => 2,
1232
- 'Logo Name' => 3,
1233
- 'Rounded' => 4,
1234
- '3D' => 5,
1235
- 'Border Round' => 6,
1236
- 'Border Logo Name' => 7,
1237
- 'Black Border' => 8,
1238
- 'Underline' => 9,
1239
- 'Auto Square' => 10,
1240
- 'Name' => 11,
1241
- ),
1242
- );
1243
-
1244
- // Locations.
1245
- $opts48 = array(
1246
- 'form_group' => false,
1247
- 'label' => 'Locations',
1248
- 'tooltip' => 'Enable the locations you wish for plus buttons to appear',
1249
- 'value' => 'Y',
1250
- 'checkboxes' => $locs3,
1251
- );
1252
-
1253
- // Placement.
1254
- $opts49 = array(
1255
- 'form_group' => false,
1256
- 'type' => 'select',
1257
- 'name' => 'ssba_before_or_after_plus',
1258
- 'label' => 'Placement',
1259
- 'tooltip' => 'Place share buttons before or after your content',
1260
- 'selected' => isset($arr_settings['ssba_before_or_after_plus']) ? $arr_settings['ssba_before_or_after_plus'] : '',
1261
- 'options' => array(
1262
- 'After' => 'after',
1263
- 'Before' => 'before',
1264
- 'Both' => 'both',
1265
- ),
1266
- );
1267
-
1268
- // Locations.
1269
- $opts45 = array(
1270
- 'form_group' => false,
1271
- 'label' => 'Locations',
1272
- 'tooltip' => 'Enable the locations you wish for share buttons to appear',
1273
- 'value' => 'Y',
1274
- 'checkboxes' => $locs2,
1275
- );
1276
-
1277
- // Select style of share bar.
1278
- $opts46 = array(
1279
- 'form_group' => false,
1280
- 'type' => 'select',
1281
- 'name' => 'ssba_bar_style',
1282
- 'label' => 'Style',
1283
- 'tooltip' => 'Choose the style of the share bar buttons',
1284
- 'selected' => isset($arr_settings['ssba_bar_style']) ? $arr_settings['ssba_bar_style'] : '',
1285
- 'options' => array(
1286
- 'Round' => 1,
1287
- 'Square' => 2,
1288
- 'Rounded' => 4,
1289
- '3D' => 5,
1290
- 'Border Round' => 6,
1291
- 'Black Border' => 8,
1292
- 'Underline' => 9,
1293
- ),
1294
- );
1295
-
1296
- // Select position of share bar.
1297
- $opts47 = array(
1298
- 'form_group' => false,
1299
- 'type' => 'select',
1300
- 'name' => 'ssba_bar_position',
1301
- 'label' => 'Alignment',
1302
- 'tooltip' => 'Choose the share bar position',
1303
- 'selected' => isset($arr_settings['ssba_bar_position']) ? $arr_settings['ssba_bar_position'] : '',
1304
- 'options' => array(
1305
- 'Sticky Left' => 'left',
1306
- 'Sticky Right' => 'right',
1307
- ),
1308
- );
1309
-
1310
- // Plus buttons height.
1311
- $plus_height = array(
1312
- 'form_group' => false,
1313
- 'type' => 'number_addon',
1314
- 'addon' => 'px',
1315
- 'placeholder' => '48',
1316
- 'name' => 'ssba_plus_height',
1317
- 'label' => 'Height',
1318
- 'tooltip' => 'Set the height of the plus buttons',
1319
- 'value' => isset($arr_settings['ssba_plus_height']) ? $arr_settings['ssba_plus_height'] : '',
1320
- );
1321
-
1322
- // Plus buttons width.
1323
- $plus_width = array(
1324
- 'form_group' => false,
1325
- 'type' => 'number_addon',
1326
- 'addon' => 'px',
1327
- 'placeholder' => '48',
1328
- 'name' => 'ssba_plus_width',
1329
- 'label' => 'Width',
1330
- 'tooltip' => 'Set the width of the plus buttons',
1331
- 'value' => isset($arr_settings['ssba_plus_width']) ? $arr_settings['ssba_plus_width'] : '',
1332
- );
1333
-
1334
- // Plus icon size.
1335
- $plus_icon_size = array(
1336
- 'form_group' => false,
1337
- 'type' => 'number_addon',
1338
- 'addon' => 'px',
1339
- 'placeholder' => '24',
1340
- 'name' => 'ssba_plus_icon_size',
1341
- 'label' => 'Icon Size',
1342
- 'tooltip' => 'Set the icon size of the plus buttons',
1343
- 'value' => isset($arr_settings['ssba_plus_icon_size']) ? $arr_settings['ssba_plus_icon_size'] : '',
1344
- );
1345
-
1346
- // Plus button margin.
1347
- $plus_margin = array(
1348
- 'form_group' => false,
1349
- 'type' => 'number_addon',
1350
- 'addon' => 'px',
1351
- 'placeholder' => '12',
1352
- 'name' => 'ssba_plus_margin',
1353
- 'label' => 'Margin',
1354
- 'tooltip' => 'Set the margin of the plus buttons',
1355
- 'value' => isset($arr_settings['ssba_plus_margin']) ? $arr_settings['ssba_plus_margin'] : '',
1356
- );
1357
-
1358
- // Plus button color override.
1359
- $plus_button_color = array(
1360
- 'form_group' => false,
1361
- 'type' => 'colorpicker',
1362
- 'name' => 'ssba_plus_button_color',
1363
- 'label' => 'Button Color',
1364
- 'tooltip' => 'Choose the color for all plus buttons',
1365
- 'value' => isset($arr_settings['ssba_plus_button_color']) ? $arr_settings['ssba_plus_button_color'] : '',
1366
- );
1367
-
1368
- // Plus button hover color override.
1369
- $plus_hover_color = array(
1370
- 'form_group' => false,
1371
- 'type' => 'colorpicker',
1372
- 'name' => 'ssba_plus_button_hover_color',
1373
- 'label' => 'Hover Color',
1374
- 'tooltip' => 'Choose the color for all plus buttons hover',
1375
- 'value' => isset($arr_settings['ssba_plus_button_hover_color']) ? $arr_settings['ssba_plus_button_hover_color'] : '',
1376
- );
1377
-
1378
- // Plus icon color override.
1379
- $plus_icon_color = array(
1380
- 'form_group' => false,
1381
- 'type' => 'colorpicker',
1382
- 'name' => 'ssba_plus_icon_color',
1383
- 'label' => 'Icon Color',
1384
- 'tooltip' => 'Choose the color for all plus button icons',
1385
- 'value' => isset($arr_settings['ssba_plus_icon_color']) ? $arr_settings['ssba_plus_icon_color'] : '',
1386
- );
1387
-
1388
- // Plus button color override.
1389
- $plus_icon_hover_color = array(
1390
- 'form_group' => false,
1391
- 'type' => 'colorpicker',
1392
- 'name' => 'ssba_plus_icon_hover_color',
1393
- 'label' => 'Icon Hover Color',
1394
- 'tooltip' => 'Choose the color for all plus button icons hover',
1395
- 'value' => isset($arr_settings['ssba_plus_icon_hover_color']) ? $arr_settings['ssba_plus_icon_hover_color'] : '',
1396
- );
1397
-
1398
- // share buttons height.
1399
- $share_height = array(
1400
- 'form_group' => false,
1401
- 'type' => 'number_addon',
1402
- 'addon' => 'px',
1403
- 'placeholder' => '48',
1404
- 'name' => 'ssba_bar_height',
1405
- 'label' => 'Height',
1406
- 'tooltip' => 'Set the height of the share bar buttons',
1407
- 'value' => isset($arr_settings['ssba_bar_height']) ? $arr_settings['ssba_bar_height'] : '',
1408
- );
1409
-
1410
- // share buttons width.
1411
- $share_width = array(
1412
- 'form_group' => false,
1413
- 'type' => 'number_addon',
1414
- 'addon' => 'px',
1415
- 'placeholder' => '48',
1416
- 'name' => 'ssba_bar_width',
1417
- 'label' => 'Width',
1418
- 'tooltip' => 'Set the width of the share bar buttons',
1419
- 'value' => isset($arr_settings['ssba_bar_width']) ? $arr_settings['ssba_bar_width'] : '',
1420
- );
1421
-
1422
- // share icon size.
1423
- $share_icon_size = array(
1424
- 'form_group' => false,
1425
- 'type' => 'number_addon',
1426
- 'addon' => 'px',
1427
- 'placeholder' => '24',
1428
- 'name' => 'ssba_bar_icon_size',
1429
- 'label' => 'Icon Size',
1430
- 'tooltip' => 'Set the icon size of the share bar buttons',
1431
- 'value' => isset($arr_settings['ssba_bar_icon_size']) ? $arr_settings['ssba_bar_icon_size'] : '',
1432
- );
1433
-
1434
- // share button margin.
1435
- $share_margin = array(
1436
- 'form_group' => false,
1437
- 'type' => 'number_addon',
1438
- 'addon' => 'px',
1439
- 'placeholder' => '12',
1440
- 'name' => 'ssba_bar_margin',
1441
- 'label' => 'Margin',
1442
- 'tooltip' => 'Set the margin of the share bar buttons',
1443
- 'value' => isset($arr_settings['ssba_bar_margin']) ? $arr_settings['ssba_bar_margin'] : '',
1444
- );
1445
-
1446
- // share button color override.
1447
- $share_button_color = array(
1448
- 'form_group' => false,
1449
- 'type' => 'colorpicker',
1450
- 'name' => 'ssba_bar_button_color',
1451
- 'label' => 'Button Color',
1452
- 'tooltip' => 'Choose the color for all share bar buttons',
1453
- 'value' => isset($arr_settings['ssba_bar_button_color']) ? $arr_settings['ssba_bar_button_color'] : '',
1454
- );
1455
-
1456
- // share button hover color override.
1457
- $share_hover_color = array(
1458
- 'form_group' => false,
1459
- 'type' => 'colorpicker',
1460
- 'name' => 'ssba_bar_button_hover_color',
1461
- 'label' => 'Hover Color',
1462
- 'tooltip' => 'Choose the color for all share bar buttons hover',
1463
- 'value' => isset($arr_settings['ssba_bar_button_hover_color']) ? $arr_settings['ssba_bar_button_hover_color'] : '',
1464
- );
1465
-
1466
- // share icon color override.
1467
- $share_icon_color = array(
1468
- 'form_group' => false,
1469
- 'type' => 'colorpicker',
1470
- 'name' => 'ssba_bar_icon_color',
1471
- 'label' => 'Icon Color',
1472
- 'tooltip' => 'Choose the color for all share bar button icons',
1473
- 'value' => isset($arr_settings['ssba_bar_icon_color']) ? $arr_settings['ssba_bar_icon_color'] : '',
1474
- );
1475
-
1476
- // share button color override.
1477
- $share_icon_hover_color = array(
1478
- 'form_group' => false,
1479
- 'type' => 'colorpicker',
1480
- 'name' => 'ssba_bar_icon_hover_color',
1481
- 'label' => 'Icon Hover Color',
1482
- 'tooltip' => 'Choose the color for all share bar button icons hover',
1483
- 'value' => isset($arr_settings['ssba_bar_icon_hover_color']) ? $arr_settings['ssba_bar_icon_hover_color'] : '',
1484
- );
1485
-
1486
- // Enable share bar.
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.',
1493
- 'value' => 'Y',
1494
- 'checked' => isset($arr_settings['ssba_bar_enabled']) && 'Y' === $arr_settings['ssba_bar_enabled'] ? 'checked' : null,
1495
- );
1496
-
1497
- // Share bar display.
1498
- $share_bar_display = array(
1499
- 'form_group' => false,
1500
- 'label' => 'Display on',
1501
- 'tooltip' => 'Disable to hide on desktop or mobile views',
1502
- 'value' => 'Y',
1503
- 'checkboxes' => $display_loc,
1504
- );
1505
-
1506
- // share button mobile breakpoint.
1507
- $mobile_breakpoint = array(
1508
- 'form_group' => false,
1509
- 'type' => 'number_addon',
1510
- 'addon' => 'px',
1511
- 'placeholder' => '780',
1512
- 'name' => 'ssba_mobile_breakpoint',
1513
- 'label' => 'Mobile Breakpoint',
1514
- 'tooltip' => 'Set the share bar mobile breakpoint when it centers on screen',
1515
- 'value' => isset($arr_settings['ssba_mobile_breakpoint']) ? $arr_settings['ssba_mobile_breakpoint'] : '',
1516
- );
1517
-
1518
- // Sharedcount api key.
1519
- $page_omit = array(
1520
- 'form_group' => false,
1521
- 'type' => 'text',
1522
- 'placeholder' => 'Enter page titles separated by commas...',
1523
- 'name' => 'ssba_omit_pages',
1524
- 'label' => 'Hide On These Pages',
1525
- 'tooltip' => 'Add one or more page titles separated by commas of pages you wish to hide these buttons on.',
1526
- 'value' => isset($arr_settings['ssba_omit_pages']) ? $arr_settings['ssba_omit_pages'] : '',
1527
- );
1528
-
1529
- // Sharedcount api key.
1530
- $page_omit_plus = array(
1531
- 'form_group' => false,
1532
- 'type' => 'text',
1533
- 'placeholder' => 'Enter page titles separated by commas...',
1534
- 'name' => 'ssba_omit_pages_plus',
1535
- 'label' => 'Hide On These Pages',
1536
- 'tooltip' => 'Add one or more page titles separated by commas of pages you wish to hide these buttons on.',
1537
- 'value' => isset($arr_settings['ssba_omit_pages_plus']) ? $arr_settings['ssba_omit_pages_plus'] : '',
1538
- );
1539
-
1540
- // Sharedcount api key.
1541
- $page_omit_bar = array(
1542
- 'form_group' => false,
1543
- 'type' => 'text',
1544
- 'placeholder' => 'Enter page titles separated by commas...',
1545
- 'name' => 'ssba_omit_pages_bar',
1546
- 'label' => 'Hide On These Pages',
1547
- 'tooltip' => 'Add one or more page titles separated by commas of pages you wish to hide these buttons on.',
1548
- 'value' => isset($arr_settings['ssba_omit_pages_bar']) ? $arr_settings['ssba_omit_pages_bar'] : '',
1549
- );
1550
-
1551
- // Notices.
1552
- $notice = get_option('ssba_dismiss_notice');
1553
- $buttons = get_option('ssba_buttons');
1554
- $buttons = !empty($buttons) ? $buttons : [];
1555
-
1556
- // All buttons.
1557
- $arr_buttons = array_values($buttons);
1558
- $selected_buttons = explode(',', $arr_settings['ssba_selected_buttons']);
1559
- $selected_plus_buttons = explode(',', $arr_settings['ssba_selected_plus_buttons']);
1560
- $selected_bar_buttons = explode(',', $arr_settings['ssba_selected_bar_buttons']);
1561
- $non_selected_buttons = array();
1562
-
1563
- // Custom button key.
1564
- $custom_buttons = $this->get_custom_button_key($arr_settings);
1565
-
1566
- foreach ($arr_buttons as $button_name) {
1567
- $new_name = str_replace('+', '',
1568
- str_replace(' ', '_', strtolower($button_name['full_name'])));
1569
- $new_arr_buttons[$new_name] = $button_name;
1570
- }
1571
-
1572
- foreach ($selected_buttons as $button) {
1573
- if (isset($new_arr_buttons[$button])) {
1574
- $selected_button_array[] = $new_arr_buttons[$button];
1575
- }
1576
- }
1577
-
1578
- // Plus buttons.
1579
- foreach ($selected_plus_buttons as $plus_button) {
1580
- if (isset($new_arr_buttons[$plus_button])) {
1581
- $selected_plus_button_array[] = $new_arr_buttons[$plus_button];
1582
- }
1583
- }
1584
-
1585
- // Bar buttons.
1586
- foreach ($selected_bar_buttons as $bar_button) {
1587
- if (isset($new_arr_buttons[$bar_button])) {
1588
- $selected_bar_button_array[] = $new_arr_buttons[$bar_button];
1589
- }
1590
- }
1591
-
1592
- foreach ($arr_buttons as $non_buttons) {
1593
- if (is_array($selected_button_array) && ! in_array($non_buttons, $selected_button_array, true)) {
1594
- $non_selected_buttons[] = $non_buttons;
1595
- }
1596
- }
1597
-
1598
- // Plus buttons.
1599
- foreach ($arr_buttons as $non_plus_buttons) {
1600
- if (is_array($selected_plus_button_array) && ! in_array($non_plus_buttons, $selected_plus_button_array,
1601
- true)) {
1602
- $non_plus_selected_buttons[] = $non_plus_buttons;
1603
- }
1604
- }
1605
-
1606
- // Bar Buttons.
1607
- foreach ($arr_buttons as $non_bar_buttons) {
1608
- if (is_array($selected_bar_button_array) && ! in_array($non_bar_buttons, $selected_bar_button_array,
1609
- true)) {
1610
- $non_bar_selected_buttons[] = $non_bar_buttons;
1611
- }
1612
- }
1613
-
1614
- if ( ! is_array($selected_button_array) && is_array($non_selected_buttons)) {
1615
- $arr_buttons = $non_selected_buttons;
1616
- } elseif ( ! is_array($non_selected_buttons) && is_array($selected_button_array)) {
1617
- $arr_buttons = $selected_button_array;
1618
- } elseif (is_array($selected_button_array) && is_array($non_selected_buttons)) {
1619
- $arr_buttons = array_merge($selected_button_array, $non_selected_buttons);
1620
- }
1621
-
1622
- // Plus buttons.
1623
- if ( ! is_array($selected_plus_button_array) && is_array($non_plus_selected_buttons)) {
1624
- $arr_plus_buttons = $non_plus_selected_buttons;
1625
- } elseif ( ! is_array($non_plus_selected_buttons) && is_array($selected_plus_button_array)) {
1626
- $arr_plus_buttons = $selected_plus_button_array;
1627
- } elseif (is_array($selected_plus_button_array) && is_array($non_plus_selected_buttons)) {
1628
- $arr_plus_buttons = array_merge($selected_plus_button_array, $non_plus_selected_buttons);
1629
- }
1630
-
1631
- // Bar buttons.
1632
- if ( ! is_array($selected_bar_button_array) && is_array($non_bar_selected_buttons)) {
1633
- $arr_bar_buttons = $non_bar_selected_buttons;
1634
- } elseif ( ! is_array($non_bar_selected_buttons) && is_array($selected_bar_button_array)) {
1635
- $arr_bar_buttons = $selected_bar_button_array;
1636
- } elseif (is_array($selected_bar_button_array) && is_array($non_bar_selected_buttons)) {
1637
- $arr_bar_buttons = array_merge($selected_bar_button_array, $non_bar_selected_buttons);
1638
- }
1639
-
1640
- // GDPR vendors.
1641
- $vendor_data = $this->getGdprVendors();
1642
- $vendors = isset($vendor_data['vendors']) ? $vendor_data['vendors'] : [];
1643
- $purposes = isset($vendor_data['purposes']) && is_array($vendor_data['purposes']) ? array_column($vendor_data['purposes'], 'name', 'id') : [];
1644
-
1645
- include_once "{$this->plugin->dir_path}/templates/admin-panel.php";
1646
- }
1647
-
1648
- /**
1649
- * Helper function to get gdpr vendors.
1650
- */
1651
- private function getGdprVendors()
1652
- {
1653
- $response = wp_remote_get('https://vendorlist.consensu.org/v2/vendor-list.json');
1654
-
1655
- return json_decode(wp_remote_retrieve_body($response), true);
1656
- }
1657
-
1658
- /**
1659
- * Get an html formatted of currently selected and ordered buttons.
1660
- *
1661
- * @param array $str_selected_ssba The selected buttons.
1662
- * @param array $arr_settings The current ssba settings.
1663
- *
1664
- * @return string
1665
- */
1666
- public function get_selected_ssba($str_selected_ssba, $arr_settings)
1667
- {
1668
- // Variables.
1669
- $html_selected_list = '';
1670
-
1671
- // Prepare array of buttons.
1672
- $arr_buttons = get_option('ssba_buttons', true);
1673
-
1674
- // If there are some selected buttons.
1675
- if ('' !== $str_selected_ssba && null !== $str_selected_ssba && false !== $str_selected_ssba) {
1676
- // Explode saved include list and add to a new array.
1677
- $arr_selected_ssba = explode(',', $str_selected_ssba);
1678
-
1679
- // Check if array is not empty.
1680
- if ('' !== $arr_selected_ssba) {
1681
- // For each included button.
1682
- foreach ($arr_selected_ssba as $str_selected) {
1683
- // If share this terms haven't been accepted and it's the
1684
- // facebook save button then make the button look disabled.
1685
- $disabled = 'Y' !== $arr_settings['accepted_sharethis_terms'] && 'facebook_save' === $str_selected ? 'style="background-color:#eaeaea;"' : null;
1686
- $button_full_name = isset($arr_buttons[$str_selected]['full_name']) ? $arr_buttons[$str_selected]['full_name'] : '';
1687
-
1688
- // Add a list item for each selected option.
1689
- $html_selected_list .= '<li class="ssbp-option-item" id="' . esc_attr($str_selected) . '"><a title="' . esc_attr($button_full_name) . '" class="ssbp-btn ssbp-' . esc_attr($str_selected) . '" ' . esc_attr($disabled) . '></a></li>';
1690
- }
1691
- }
1692
- }
1693
-
1694
- // Return html list options.
1695
- return $html_selected_list;
1696
- }
1697
-
1698
- /**
1699
- * Custom button key.
1700
- *
1701
- * @param array $arr_settings The current site settings.
1702
- */
1703
- public function get_custom_button_key($arr_settings)
1704
- {
1705
- $custom_array = array(
1706
- 'facebook' => isset($arr_settings['ssba_custom_facebook']) ? $arr_settings['ssba_custom_facebook'] : '',
1707
- 'twitter' => isset($arr_settings['ssba_custom_twitter']) ? $arr_settings['ssba_custom_twitter'] : '',
1708
- 'linkedin' => isset($arr_settings['ssba_custom_linkedin']) ? $arr_settings['ssba_custom_linkedin'] : '',
1709
- 'flattr' => isset($arr_settings['ssba_custom_flattr']) ? $arr_settings['ssba_custom_flattr'] : '',
1710
- 'pinterest' => isset($arr_settings['ssba_custom_pinterest']) ? $arr_settings['ssba_custom_pinterest'] : '',
1711
- 'print' => isset($arr_settings['ssba_custom_print']) ? $arr_settings['ssba_custom_print'] : '',
1712
- 'reddit' => isset($arr_settings['ssba_custom_reddit']) ? $arr_settings['ssba_custom_reddit'] : '',
1713
- 'stumbleupon' => isset($arr_settings['ssba_custom_stumbleupon']) ? $arr_settings['ssba_custom_stumbleupon'] : '',
1714
- 'tumblr' => isset($arr_settings['ssba_custom_tumblr']) ? $arr_settings['ssba_custom_tumblr'] : '',
1715
- 'vk' => isset($arr_settings['ssba_custom_vk']) ? $arr_settings['ssba_custom_vk'] : '',
1716
- 'whatsapp' => isset($arr_settings['ssba_custom_whatsapp']) ? $arr_settings['ssba_custom_whatsapp'] : '',
1717
- 'xing' => isset($arr_settings['ssba_custom_xing']) ? $arr_settings['ssba_custom_xing'] : '',
1718
- 'yummly' => isset($arr_settings['ssba_custom_yummly']) ? $arr_settings['ssba_custom_yummly'] : '',
1719
- );
1720
-
1721
- return $custom_array;
1722
- }
1723
-
1724
- /**
1725
- * Get available share buttons.
1726
- *
1727
- * @param array $str_selected_ssba The selected buttons.
1728
- * @param array $arr_settings The current ssba settings.
1729
- *
1730
- * @return string
1731
- */
1732
- public function get_available_ssba($str_selected_ssba, $arr_settings, $page = '')
1733
- {
1734
- // Variables.
1735
- $html_available_list = '';
1736
-
1737
- // Prepare array of buttons.
1738
- $arr_buttons = get_option('ssba_buttons', true);
1739
- $arr_buttons = !empty($arr_buttons) ? $arr_buttons : [];
1740
-
1741
- // Explode saved include list and add to a new array.
1742
- $arr_selected_ssba = explode(',', $str_selected_ssba);
1743
-
1744
- // Extract the available buttons.
1745
- $arr_available_ssba = array_diff(array_keys($arr_buttons), $arr_selected_ssba);
1746
-
1747
- // Check if array is not empty.
1748
- if ('' !== $arr_selected_ssba) {
1749
- // For each included button.
1750
- foreach ($arr_available_ssba as $str_available) {
1751
- // If share this terms haven't been accepted and it's the facebook save button then make the button look disabled.
1752
- $disabled = 'Y' !== $arr_settings['accepted_sharethis_terms'] && 'facebook_save' === $str_available ? 'style="background-color:#eaeaea;"' : null;
1753
-
1754
- if (self::showInClassic($page, $arr_buttons[$str_available]['full_name'])) {
1755
- // Add a list item for each available option.
1756
- $html_available_list .= '<li class="ssbp-option-item" id="' . esc_attr($str_available) . '"><a title="' . esc_attr($arr_buttons[$str_available]['full_name']) . '" class="ssbp-btn ssbp-' . esc_attr($str_available) . '" ' . esc_attr($disabled) . '></a></li>';
1757
- }
1758
- }
1759
- }
1760
-
1761
- // Return html list options.
1762
- return $html_available_list;
1763
- }
1764
-
1765
- /**
1766
- * Show in classic button list or not.
1767
- */
1768
- public static function showInClassic ($page, $button_name) {
1769
- if ('classic' !== $page) {
1770
- return true;
1771
- }
1772
-
1773
- if (false === in_array($button_name,
1774
- ['Facebook Save', 'Flipboard', 'Line', 'Skype', 'Snapchat', 'Telegram', 'Weibo'])) {
1775
- return true;
1776
- }
1777
-
1778
- return false;
1779
- }
1780
-
1781
- /**
1782
- * Get ssbp font family.
1783
- *
1784
- * @return string
1785
- */
1786
- public function get_font_family()
1787
- {
1788
- return "@font-face {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1789
  font-family: 'ssbp';
1790
  src:url('{$this->plugin->dir_url}fonts/ssbp.eot?xj3ol1');
1791
  src:url('{$this->plugin->dir_url}fonts/ssbp.eot?#iefixxj3ol1') format('embedded-opentype'),
@@ -1799,15 +1836,14 @@ class Admin_Panel
1799
  -webkit-font-smoothing: antialiased;
1800
  -moz-osx-font-smoothing: grayscale;
1801
  }";
1802
- }
1803
-
1804
- /**
1805
- * Register button widget.
1806
- *
1807
- * @action widgets_init
1808
- */
1809
- public function register_widget()
1810
- {
1811
- register_widget($this->widget_class);
1812
- }
1813
  }
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
+ class Admin_Panel {
16
+ /**
17
+ * Plugin instance.
18
+ *
19
+ * @var object
20
+ */
21
+ public $plugin;
22
+
23
+ /**
24
+ * Simple Share Buttons Adder instance.
25
+ *
26
+ * @var object
27
+ */
28
+ public $class_ssba;
29
+
30
+ /**
31
+ * Widget Class instance.
32
+ *
33
+ * @var object
34
+ */
35
+ public $widget_class;
36
+
37
+ /**
38
+ * Forms instance.
39
+ *
40
+ * @var object
41
+ */
42
+ public $forms;
43
+
44
+ /**
45
+ * Admin_Panel constructor.
46
+ *
47
+ * @param object $plugin Plugin instance.
48
+ * @param object $class_ssba Simple Share Buttons Adder instance.
49
+ * @param object $forms Forms instance.
50
+ * @param string $widget_class Widget class.
51
+ */
52
+ public function __construct( $plugin, $class_ssba, $forms, $widget_class ) {
53
+ $this->plugin = $plugin;
54
+ $this->class_ssba = $class_ssba;
55
+ $this->forms = $forms;
56
+ $this->widget_class = $widget_class;
57
+ }
58
+
59
+ /**
60
+ * Display the admin header.
61
+ */
62
+ public function admin_header() {
63
+ include_once "{$this->plugin->dir_path}/templates/admin-header.php";
64
+ }
65
+
66
+ /**
67
+ * Display the admin footer.
68
+ */
69
+ public function admin_footer() {
70
+ include_once "{$this->plugin->dir_path}/templates/admin-footer.php";
71
+ }
72
+
73
+ /**
74
+ * Enqueue the custom gutenberg block script.
75
+ *
76
+ * @action enqueue_block_editor_assets
77
+ */
78
+ public function enqueue_custom_blocks() {
79
+ wp_enqueue_script(
80
+ "{$this->plugin->assets_prefix}-blocks",
81
+ "{$this->plugin->dir_url}js/blocks.js",
82
+ array( 'wp-blocks', 'wp-editor', 'wp-element', 'wp-components' ),
83
+ time(),
84
+ true
85
+ );
86
+ }
87
+
88
+ /**
89
+ * Register new block category for share buttons.
90
+ *
91
+ * @param array[] $categories Array of categories for block types.
92
+ * @param \WP_Post $post Post being loaded.
93
+ *
94
+ * @filter block_categories, 999
95
+ */
96
+ public function simpleshare_block_category( $categories, $post ) {
97
+ return array_merge(
98
+ $categories,
99
+ array(
100
+ array(
101
+ 'slug' => 'simpleshare-blocks',
102
+ 'title' => __( 'SimpleShare Blocks', 'simple-share-buttons-adder' ),
103
+ ),
104
+ )
105
+ );
106
+ }
107
+
108
+
109
+ /**
110
+ * Build the Admin Panel html variables and include template.
111
+ *
112
+ * @param array $arr_settings The current ssba settings.
113
+ */
114
+ public function admin_panel( $arr_settings ) {
115
+ // Locations array.
116
+ $locs = array(
117
+ 'Homepage' => array(
118
+ 'value' => 'ssba_homepage',
119
+ 'checked' => isset( $arr_settings['ssba_homepage'] ) && 'Y' === $arr_settings['ssba_homepage'] ? true : false,
120
+ ),
121
+ 'Pages' => array(
122
+ 'value' => 'ssba_pages',
123
+ 'checked' => isset( $arr_settings['ssba_pages'] ) && 'Y' === $arr_settings['ssba_pages'] ? true : false,
124
+ ),
125
+ 'Posts' => array(
126
+ 'value' => 'ssba_posts',
127
+ 'checked' => isset( $arr_settings['ssba_posts'] ) && 'Y' === $arr_settings['ssba_posts'] ? true : false,
128
+ ),
129
+ 'Excerpts' => array(
130
+ 'value' => 'ssba_excerpts',
131
+ 'checked' => isset( $arr_settings['ssba_excerpts'] ) && 'Y' === $arr_settings['ssba_excerpts'] ? true : false,
132
+ ),
133
+ 'Categories/Archives' => array(
134
+ 'value' => 'ssba_cats_archs',
135
+ 'checked' => isset( $arr_settings['ssba_cats_archs'] ) && 'Y' === $arr_settings['ssba_cats_archs'] ? true : false,
136
+ ),
137
+ );
138
+
139
+ // Locations array.
140
+ $locs2 = array(
141
+ 'Homepage' => array(
142
+ 'value' => 'ssba_bar_homepage',
143
+ 'checked' => isset( $arr_settings['ssba_bar_homepage'] ) && 'Y' === $arr_settings['ssba_bar_homepage'] ? true : false,
144
+ ),
145
+ 'Pages' => array(
146
+ 'value' => 'ssba_bar_pages',
147
+ 'checked' => isset( $arr_settings['ssba_bar_pages'] ) && 'Y' === $arr_settings['ssba_bar_pages'] ? true : false,
148
+ ),
149
+ 'Posts' => array(
150
+ 'value' => 'ssba_bar_posts',
151
+ 'checked' => isset( $arr_settings['ssba_bar_posts'] ) && 'Y' === $arr_settings['ssba_bar_posts'] ? true : false,
152
+ ),
153
+ 'Categories/Archives' => array(
154
+ 'value' => 'ssba_bar_cats_archs',
155
+ 'checked' => isset( $arr_settings['ssba_bar_cats_archs'] ) && 'Y' === $arr_settings['ssba_bar_cats_archs'] ? true : false,
156
+ ),
157
+ );
158
+
159
+ // Locations array for plus.
160
+ $locs3 = array(
161
+ 'Homepage' => array(
162
+ 'value' => 'ssba_plus_homepage',
163
+ 'checked' => isset( $arr_settings['ssba_plus_homepage'] ) && 'Y' === $arr_settings['ssba_plus_homepage'] ? true : false,
164
+ ),
165
+ 'Pages' => array(
166
+ 'value' => 'ssba_plus_pages',
167
+ 'checked' => isset( $arr_settings['ssba_plus_pages'] ) && 'Y' === $arr_settings['ssba_plus_pages'] ? true : false,
168
+ ),
169
+ 'Posts' => array(
170
+ 'value' => 'ssba_plus_posts',
171
+ 'checked' => isset( $arr_settings['ssba_plus_posts'] ) && 'Y' === $arr_settings['ssba_plus_posts'] ? true : false,
172
+ ),
173
+ 'Excerpts' => array(
174
+ 'value' => 'ssba_plus_excerpts',
175
+ 'checked' => isset( $arr_settings['ssba_plus_excerpts'] ) && 'Y' === $arr_settings['ssba_plus_excerpts'] ? true : false,
176
+ ),
177
+ 'Categories/Archives' => array(
178
+ 'value' => 'ssba_plus_cats_archs',
179
+ 'checked' => isset( $arr_settings['ssba_plus_cats_archs'] ) && 'Y' === $arr_settings['ssba_plus_cats_archs'] ? true : false,
180
+ ),
181
+ );
182
+
183
+ // Display options.
184
+ $display_loc = array(
185
+ 'Desktop' => array(
186
+ 'value' => 'ssba_bar_desktop',
187
+ 'checked' => isset( $arr_settings['ssba_bar_desktop'] ) && 'Y' === $arr_settings['ssba_bar_desktop'] ? true : false,
188
+ ),
189
+ 'Mobile' => array(
190
+ 'value' => 'ssba_bar_mobile',
191
+ 'checked' => isset( $arr_settings['ssba_bar_mobile'] ) && 'Y' === $arr_settings['ssba_bar_mobile'] ? true : false,
192
+ ),
193
+ );
194
+
195
+ // Prepare array of buttons.
196
+ $arr_buttons = get_option( 'ssba_buttons', true );
197
+
198
+ // Locations.
199
+ $opts1 = array(
200
+ 'form_group' => false,
201
+ 'label' => 'Locations',
202
+ 'tooltip' => 'Enable the locations you wish for share buttons to appear',
203
+ 'value' => 'Y',
204
+ 'checkboxes' => $locs,
205
+ );
206
+
207
+ // Placement.
208
+ $opts2 = array(
209
+ 'form_group' => false,
210
+ 'type' => 'select',
211
+ 'name' => 'ssba_before_or_after',
212
+ 'label' => 'Placement',
213
+ 'tooltip' => 'Place share buttons before or after your content',
214
+ 'selected' => isset( $arr_settings['ssba_before_or_after'] ) ? $arr_settings['ssba_before_or_after'] : '',
215
+ 'options' => array(
216
+ 'After' => 'after',
217
+ 'Before' => 'before',
218
+ 'Both' => 'both',
219
+ ),
220
+ );
221
+
222
+ // Share text.
223
+ $opts3 = array(
224
+ 'form_group' => false,
225
+ 'type' => 'text',
226
+ 'placeholder' => 'Share this...',
227
+ 'name' => 'ssba_share_text',
228
+ 'label' => 'Call To Action',
229
+ 'tooltip' => 'Add some custom text by your share buttons',
230
+ 'value' => isset( $arr_settings['ssba_share_text'] ) ? $arr_settings['ssba_share_text'] : '',
231
+ );
232
+
233
+ // Share text for plus.
234
+ $opts3p = array(
235
+ 'form_group' => false,
236
+ 'type' => 'text',
237
+ 'placeholder' => 'Share this...',
238
+ 'name' => 'ssba_plus_share_text',
239
+ 'label' => 'Call To Action',
240
+ 'tooltip' => 'Add some custom text by your share buttons',
241
+ 'value' => isset( $arr_settings['ssba_plus_share_text'] ) ? $arr_settings['ssba_plus_share_text'] : '',
242
+ );
243
+
244
+ // Placement.
245
+ $opts4 = array(
246
+ 'form_group' => false,
247
+ 'type' => 'select',
248
+ 'name' => 'ssba_image_set',
249
+ 'label' => 'Theme',
250
+ 'tooltip' => 'Choose your favourite set of buttons, or set to custom to choose your own',
251
+ 'selected' => isset( $arr_settings['ssba_image_set'] ) ? $arr_settings['ssba_image_set'] : '',
252
+ 'options' => array(
253
+ 'Arbenta' => 'arbenta',
254
+ 'Custom' => 'custom',
255
+ 'Metal' => 'metal',
256
+ 'Pagepeel' => 'pagepeel',
257
+ 'Plain' => 'plain',
258
+ 'Retro' => 'retro',
259
+ 'Ribbons' => 'ribbons',
260
+ 'Simple' => 'simple',
261
+ 'Somacro' => 'somacro',
262
+ ),
263
+ );
264
+
265
+ // Button size.
266
+ $opts6 = array(
267
+ 'form_group' => false,
268
+ 'type' => 'number_addon',
269
+ 'addon' => 'px',
270
+ 'placeholder' => '35',
271
+ 'name' => 'ssba_size',
272
+ 'label' => 'Button Size',
273
+ 'tooltip' => 'Set the size of your buttons in pixels',
274
+ 'value' => isset( $arr_settings['ssba_size'] ) ? $arr_settings['ssba_size'] : '',
275
+ );
276
+
277
+ // Alignment.
278
+ $opts7 = array(
279
+ 'form_group' => false,
280
+ 'type' => 'select',
281
+ 'name' => 'ssba_align',
282
+ 'label' => 'Alignment',
283
+ 'tooltip' => 'Align your buttons the way you wish',
284
+ 'selected' => isset( $arr_settings['ssba_align'] ) ? $arr_settings['ssba_align'] : '',
285
+ 'options' => array(
286
+ 'Left' => 'left',
287
+ 'Center' => 'center',
288
+ 'Right' => 'right',
289
+ ),
290
+ );
291
+
292
+ // Alignment for Plus.
293
+ $opts7p = array(
294
+ 'form_group' => false,
295
+ 'type' => 'select',
296
+ 'name' => 'ssba_plus_align',
297
+ 'label' => 'Alignment',
298
+ 'tooltip' => 'Align your plus buttons the way you wish',
299
+ 'selected' => isset( $arr_settings['ssba_plus_align'] ) ? $arr_settings['ssba_plus_align'] : 'center',
300
+ 'options' => array(
301
+ 'Left' => 'left',
302
+ 'Center' => 'center',
303
+ 'Right' => 'right',
304
+ ),
305
+ );
306
+
307
+ // Padding.
308
+ $opts8 = array(
309
+ 'form_group' => false,
310
+ 'type' => 'number_addon',
311
+ 'addon' => 'px',
312
+ 'placeholder' => '10',
313
+ 'max' => '50',
314
+ 'name' => 'ssba_padding',
315
+ 'label' => 'Padding',
316
+ 'tooltip' => 'Apply some space around your images',
317
+ 'value' => isset( $arr_settings['ssba_padding'] ) ? $arr_settings['ssba_padding'] : '',
318
+ );
319
+
320
+ // Font color.
321
+ $opts9 = array(
322
+ 'form_group' => false,
323
+ 'type' => 'colorpicker',
324
+ 'name' => 'ssba_font_color',
325
+ 'label' => 'Font Color',
326
+ 'tooltip' => 'Choose the color of your share text',
327
+ 'value' => isset( $arr_settings['ssba_font_color'] ) ? $arr_settings['ssba_font_color'] : '',
328
+ );
329
+
330
+ // Font color for plus.
331
+ $opts9p = array(
332
+ 'form_group' => false,
333
+ 'type' => 'colorpicker',
334
+ 'name' => 'ssba_plus_font_color',
335
+ 'label' => 'Font Color',
336
+ 'tooltip' => 'Choose the color of your share text',
337
+ 'value' => isset( $arr_settings['ssba_plus_font_color'] ) ? $arr_settings['ssba_plus_font_color'] : '',
338
+ );
339
+
340
+ // Font family.
341
+ $opts10 = array(
342
+ 'form_group' => false,
343
+ 'type' => 'select',
344
+ 'name' => 'ssba_font_family',
345
+ 'label' => 'Font Family',
346
+ 'tooltip' => 'Choose a font available or inherit the font from your website',
347
+ 'selected' => isset( $arr_settings['ssba_font_family'] ) ? $arr_settings['ssba_font_family'] : '',
348
+ 'options' => array(
349
+ 'Reenie Beanie' => 'Reenie Beanie',
350
+ 'Indie Flower' => 'Indie Flower',
351
+ 'Inherit from my website' => '',
352
+ ),
353
+ );
354
+
355
+ // Font family for plus.
356
+ $opts10p = array(
357
+ 'form_group' => false,
358
+ 'type' => 'select',
359
+ 'name' => 'ssba_plus_font_family',
360
+ 'label' => 'Font Family',
361
+ 'tooltip' => 'Choose a font available or inherit the font from your website',
362
+ 'selected' => isset( $arr_settings['ssba_plus_font_family'] ) ? $arr_settings['ssba_plus_font_family'] : '',
363
+ 'options' => array(
364
+ 'Reenie Beanie' => 'Reenie Beanie',
365
+ 'Indie Flower' => 'Indie Flower',
366
+ 'Inherit from my website' => '',
367
+ ),
368
+ );
369
+
370
+ // Enqueue the styles so preview can update.
371
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-reenie" );
372
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-indie" );
373
+
374
+ // Font size.
375
+ $opts11 = array(
376
+ 'form_group' => false,
377
+ 'type' => 'number_addon',
378
+ 'addon' => 'px',
379
+ 'placeholder' => '20',
380
+ 'name' => 'ssba_font_size',
381
+ 'label' => 'Font Size',
382
+ 'tooltip' => 'Set the size of the share text in pixels',
383
+ 'value' => isset( $arr_settings['ssba_font_size'] ) ? $arr_settings['ssba_font_size'] : '',
384
+ );
385
+
386
+ // Font size for plus.
387
+ $opts11p = array(
388
+ 'form_group' => false,
389
+ 'type' => 'number_addon',
390
+ 'addon' => 'px',
391
+ 'placeholder' => '20',
392
+ 'name' => 'ssba_plus_font_size',
393
+ 'label' => 'Font Size',
394
+ 'tooltip' => 'Set the size of the share text in pixels',
395
+ 'value' => isset( $arr_settings['ssba_plus_font_size'] ) ? $arr_settings['ssba_plus_font_size'] : '',
396
+ );
397
+
398
+ // Font weight.
399
+ $opts12 = array(
400
+ 'form_group' => false,
401
+ 'type' => 'select',
402
+ 'name' => 'ssba_font_weight',
403
+ 'label' => 'Font Weight',
404
+ 'tooltip' => 'Set the weight of the share text',
405
+ 'selected' => isset( $arr_settings['ssba_font_weight'] ) ? $arr_settings['ssba_font_weight'] : '',
406
+ 'options' => array(
407
+ 'Normal' => 'normal',
408
+ 'Bold' => 'bold',
409
+ 'Light' => 'light',
410
+ ),
411
+ );
412
+
413
+ // Font weight for plus.
414
+ $opts12p = array(
415
+ 'form_group' => false,
416
+ 'type' => 'select',
417
+ 'name' => 'ssba_plus_font_weight',
418
+ 'label' => 'Font Weight',
419
+ 'tooltip' => 'Set the weight of the share text',
420
+ 'selected' => isset( $arr_settings['ssba_plus_font_weight'] ) ? $arr_settings['ssba_plus_font_weight'] : '',
421
+ 'options' => array(
422
+ 'Normal' => 'normal',
423
+ 'Bold' => 'bold',
424
+ 'Light' => 'light',
425
+ ),
426
+ );
427
+
428
+ // Text placement.
429
+ $opts13 = array(
430
+ 'form_group' => false,
431
+ 'type' => 'select',
432
+ 'name' => 'ssba_text_placement',
433
+ 'label' => 'Text placement',
434
+ 'tooltip' => 'Choose where you want your text to be displayed, in relation to the buttons',
435
+ 'selected' => isset( $arr_settings['ssba_text_placement'] ) ? $arr_settings['ssba_text_placement'] : '',
436
+ 'options' => array(
437
+ 'Above' => 'above',
438
+ 'Left' => 'left',
439
+ 'Right' => 'right',
440
+ 'Below' => 'below',
441
+ ),
442
+ );
443
+
444
+ // Text placement for plus.
445
+ $opts13p = array(
446
+ 'form_group' => false,
447
+ 'type' => 'select',
448
+ 'name' => 'ssba_plus_text_placement',
449
+ 'label' => 'Text placement',
450
+ 'tooltip' => 'Choose where you want your text to be displayed, in relation to the buttons',
451
+ 'selected' => isset( $arr_settings['ssba_plus_text_placement'] ) ? $arr_settings['ssba_plus_text_placement'] : '',
452
+ 'options' => array(
453
+ 'Above' => 'above',
454
+ 'Left' => 'left',
455
+ 'Right' => 'right',
456
+ 'Below' => 'below',
457
+ ),
458
+ );
459
+
460
+ // Container padding.
461
+ $opts14 = array(
462
+ 'form_group' => false,
463
+ 'type' => 'number_addon',
464
+ 'addon' => 'px',
465
+ 'placeholder' => '10',
466
+ 'name' => 'ssba_div_padding',
467
+ 'label' => 'Container Padding',
468
+ 'tooltip' => 'Add some padding to your share container',
469
+ 'value' => isset( $arr_settings['ssba_div_padding'] ) ? $arr_settings['ssba_div_padding'] : '',
470
+ );
471
+
472
+ // Div background color.
473
+ $opts15 = array(
474
+ 'form_group' => false,
475
+ 'type' => 'colorpicker',
476
+ 'name' => 'ssba_div_background',
477
+ 'label' => 'Container Background Color',
478
+ 'tooltip' => 'Choose the color of your share container',
479
+ 'value' => isset( $arr_settings['ssba_div_background'] ) ? $arr_settings['ssba_div_background'] : '',
480
+ );
481
+
482
+ // Div border color.
483
+ $opts16 = array(
484
+ 'form_group' => false,
485
+ 'type' => 'colorpicker',
486
+ 'name' => 'ssba_div_border',
487
+ 'label' => 'Container Border Color',
488
+ 'tooltip' => 'Choose the color of your share container border',
489
+ 'value' => isset( $arr_settings['ssba_div_border'] ) ? $arr_settings['ssba_div_border'] : '',
490
+ );
491
+
492
+ // Container border width.
493
+ $opts17 = array(
494
+ 'form_group' => false,
495
+ 'type' => 'number_addon',
496
+ 'addon' => 'px',
497
+ 'placeholder' => '1',
498
+ 'name' => 'ssba_border_width',
499
+ 'label' => 'Container Border Width',
500
+ 'tooltip' => 'Set the width of the share container border',
501
+ 'value' => isset( $arr_settings['ssba_border_width'] ) ? $arr_settings['ssba_border_width'] : '',
502
+ );
503
+
504
+ // Rounded container corners.
505
+ $opts18 = array(
506
+ 'form_group' => false,
507
+ 'type' => 'checkbox',
508
+ 'name' => 'ssba_div_rounded_corners',
509
+ 'label' => 'Rounded Container Corners',
510
+ 'tooltip' => 'Switch on to enable rounded corners for your share container',
511
+ 'value' => 'Y',
512
+ 'checked' => isset( $arr_settings['ssba_div_rounded_corners'] ) && 'Y' === $arr_settings['ssba_div_rounded_corners'] ? esc_attr( 'checked' ) : '',
513
+ );
514
+
515
+ // Share count.
516
+ $opts19 = array(
517
+ 'form_group' => false,
518
+ 'type' => 'checkbox',
519
+ 'name' => 'ssba_show_share_count',
520
+ 'label' => 'Share Count',
521
+ 'tooltip' => 'Check the box if you wish to enable share counts. Enabling this option will slow down the loading of any pages that use share buttons',
522
+ 'value' => 'Y',
523
+ 'checked' => isset( $arr_settings['ssba_show_share_count'] ) && 'Y' === $arr_settings['ssba_show_share_count'] ? esc_attr( 'checked' ) : null,
524
+ );
525
+
526
+ // Share count for plus.
527
+ $opts19p = array(
528
+ 'form_group' => false,
529
+ 'type' => 'checkbox',
530
+ 'name' => 'ssba_plus_show_share_count',
531
+ 'label' => 'Share Count',
532
+ 'tooltip' => 'Check the box if you wish to enable share counts. Enabling this option will slow down the loading of any pages that use share buttons',
533
+ 'value' => 'Y',
534
+ 'checked' => isset( $arr_settings['ssba_plus_show_share_count'] ) && 'Y' === $arr_settings['ssba_plus_show_share_count'] ? esc_attr( 'checked' ) : null,
535
+ );
536
+
537
+ // Share count for share bar.
538
+ $opts19s = array(
539
+ 'form_group' => false,
540
+ 'type' => 'checkbox',
541
+ 'name' => 'ssba_bar_show_share_count',
542
+ 'label' => 'Share Count',
543
+ 'tooltip' => 'Check the box if you wish to enable share counts. Enabling this option will slow down the loading of any pages that use share buttons',
544
+ 'value' => 'Y',
545
+ 'checked' => isset( $arr_settings['ssba_bar_show_share_count'] ) && 'Y' === $arr_settings['ssba_bar_show_share_count'] ? esc_attr( 'checked' ) : null,
546
+ );
547
+
548
+ // Show count once.
549
+ $opts20 = array(
550
+ 'form_group' => false,
551
+ 'type' => 'checkbox',
552
+ 'name' => 'ssba_share_count_once',
553
+ 'label' => 'Show Once',
554
+ 'tooltip' => 'This option is recommended, it deactivates share counts for categories and archives allowing them to load more quickly',
555
+ 'value' => 'Y',
556
+ 'checked' => isset( $arr_settings['ssba_share_count_once'] ) && 'Y' === $arr_settings['ssba_share_count_once'] ? esc_attr( 'checked' ) : null,
557
+ );
558
+
559
+ // Show count once for plus.
560
+ $opts20p = array(
561
+ 'form_group' => false,
562
+ 'type' => 'checkbox',
563
+ 'name' => 'ssba_plus_share_count_once',
564
+ 'label' => 'Show Once',
565
+ 'tooltip' => 'This option is recommended, it deactivates share counts for categories and archives allowing them to load more quickly',
566
+ 'value' => 'Y',
567
+ 'checked' => isset( $arr_settings['ssba_plus_share_count_once'] ) && 'Y' === $arr_settings['ssba_plus_share_count_once'] ? esc_attr( 'checked' ) : null,
568
+ );
569
+
570
+ // Show count once for share bar.
571
+ $opts20s = array(
572
+ 'form_group' => false,
573
+ 'type' => 'checkbox',
574
+ 'name' => 'ssba_bar_share_count_once',
575
+ 'label' => 'Show Once',
576
+ 'tooltip' => 'This option is recommended, it deactivates share counts for categories and archives allowing them to load more quickly',
577
+ 'value' => 'Y',
578
+ 'checked' => isset( $arr_settings['ssba_bar_share_count_once'] ) && 'Y' === $arr_settings['ssba_bar_share_count_once'] ? esc_attr( 'checked' ) : null,
579
+ );
580
+
581
+ // Share counters style.
582
+ $opts21 = array(
583
+ 'form_group' => false,
584
+ 'type' => 'select',
585
+ 'name' => 'ssba_share_count_style',
586
+ 'label' => 'Counters Style',
587
+ 'tooltip' => 'Pick a setting to style the share counters',
588
+ 'selected' => isset( $arr_settings['ssba_share_count_style'] ) ? $arr_settings['ssba_share_count_style'] : '',
589
+ 'options' => array(
590
+ 'Default' => 'default',
591
+ 'White' => 'white',
592
+ 'Blue' => 'blue',
593
+ ),
594
+ );
595
+
596
+ // Sharedcount enable.
597
+ $opts23 = array(
598
+ 'form_group' => false,
599
+ 'type' => 'checkbox',
600
+ 'name' => 'sharedcount_enabled',
601
+ 'label' => 'Enable sharedcount.com API',
602
+ 'tooltip' => 'Enable if you wish to enable the use of the sharedcount.com API',
603
+ 'value' => 'Y',
604
+ 'checked' => isset( $arr_settings['sharedcount_enabled'] ) && 'Y' === $arr_settings['sharedcount_enabled'] ? esc_attr( 'checked' ) : null,
605
+ );
606
+
607
+ // Sharedcount plan.
608
+ $opts24 = array(
609
+ 'form_group' => false,
610
+ 'type' => 'select',
611
+ 'name' => 'sharedcount_plan',
612
+ 'label' => 'sharedcount.com plan',
613
+ 'tooltip' => 'Select your sharedcount.com plan',
614
+ 'selected' => isset( $arr_settings['sharedcount_plan'] ) ? $arr_settings['sharedcount_plan'] : '',
615
+ 'options' => array(
616
+ 'Free' => 'free',
617
+ 'Plus' => 'plus',
618
+ 'Business' => 'business',
619
+ ),
620
+ );
621
+
622
+ // Sharedcount api key.
623
+ $opts25 = array(
624
+ 'form_group' => false,
625
+ 'type' => 'text',
626
+ 'placeholder' => '9b17c12712c691491ef95f46c51ce3917118fdf9',
627
+ 'name' => 'sharedcount_api_key',
628
+ 'label' => 'sharedcount.com API Key',
629
+ 'tooltip' => 'Add some text included in an email when people share that way',
630
+ 'value' => isset( $arr_settings['sharedcount_api_key'] ) ? $arr_settings['sharedcount_api_key'] : '',
631
+ );
632
+
633
+ // Sharedcount enable.
634
+ $opts23p = array(
635
+ 'form_group' => false,
636
+ 'type' => 'checkbox',
637
+ 'name' => 'plus_sharedcount_enabled',
638
+ 'label' => 'Enable sharedcount.com API',
639
+ 'tooltip' => 'Enable if you wish to enable the use of the sharedcount.com API',
640
+ 'value' => 'Y',
641
+ 'checked' => isset( $arr_settings['plus_sharedcount_enabled'] ) && 'Y' === $arr_settings['plus_sharedcount_enabled'] ? esc_attr( 'checked' ) : null,
642
+ );
643
+
644
+ // Sharedcount plan.
645
+ $opts24p = array(
646
+ 'form_group' => false,
647
+ 'type' => 'select',
648
+ 'name' => 'plus_sharedcount_plan',
649
+ 'label' => 'sharedcount.com plan',
650
+ 'tooltip' => 'Select your sharedcount.com plan',
651
+ 'selected' => isset( $arr_settings['plus_sharedcount_plan'] ) ? $arr_settings['plus_sharedcount_plan'] : '',
652
+ 'options' => array(
653
+ 'Free' => 'free',
654
+ 'Plus' => 'plus',
655
+ 'Business' => 'business',
656
+ ),
657
+ );
658
+
659
+ // Sharedcount api key.
660
+ $opts25p = array(
661
+ 'form_group' => false,
662
+ 'type' => 'text',
663
+ 'placeholder' => '9b17c12712c691491ef95f46c51ce3917118fdf9',
664
+ 'name' => 'plus_sharedcount_api_key',
665
+ 'label' => 'sharedcount.com API Key',
666
+ 'tooltip' => 'Add some text included in an email when people share that way',
667
+ 'value' => isset( $arr_settings['plus_sharedcount_api_key'] ) ? $arr_settings['plus_sharedcount_api_key'] : '',
668
+ );
669
+
670
+ // Sharedcount enable.
671
+ $opts23b = array(
672
+ 'form_group' => false,
673
+ 'type' => 'checkbox',
674
+ 'name' => 'bar_sharedcount_enabled',
675
+ 'label' => 'Enable sharedcount.com API',
676
+ 'tooltip' => 'Enable if you wish to enable the use of the sharedcount.com API',
677
+ 'value' => 'Y',
678
+ 'checked' => isset( $arr_settings['bar_sharedcount_enabled'] ) && 'Y' === $arr_settings['bar_sharedcount_enabled'] ? esc_attr( 'checked' ) : null,
679
+ );
680
+
681
+ // Sharedcount plan.
682
+ $opts24b = array(
683
+ 'form_group' => false,
684
+ 'type' => 'select',
685
+ 'name' => 'bar_sharedcount_plan',
686
+ 'label' => 'sharedcount.com plan',
687
+ 'tooltip' => 'Select your sharedcount.com plan',
688
+ 'selected' => isset( $arr_settings['bar_sharedcount_plan'] ) ? $arr_settings['bar_sharedcount_plan'] : '',
689
+ 'options' => array(
690
+ 'Free' => 'free',
691
+ 'Plus' => 'plus',
692
+ 'Business' => 'business',
693
+ ),
694
+ );
695
+
696
+ // Sharedcount api key.
697
+ $opts25b = array(
698
+ 'form_group' => false,
699
+ 'type' => 'text',
700
+ 'placeholder' => '9b17c12712c691491ef95f46c51ce3917118fdf9',
701
+ 'name' => 'bar_sharedcount_api_key',
702
+ 'label' => 'sharedcount.com API Key',
703
+ 'tooltip' => 'Add some text included in an email when people share that way',
704
+ 'value' => isset( $arr_settings['bar_sharedcount_api_key'] ) ? $arr_settings['bar_sharedcount_api_key'] : '',
705
+ );
706
+
707
+ // Link to ssb.
708
+ $opts26 = array(
709
+ 'form_group' => false,
710
+ 'type' => 'checkbox',
711
+ 'name' => 'ssba_link_to_ssb',
712
+ 'label' => 'Share Text Link',
713
+ 'tooltip' => 'Enabling this will set your share text as a link to simplesharebuttons.com to help others learn of the plugin',
714
+ 'value' => 'Y',
715
+ 'checked' => isset( $arr_settings['ssba_link_to_ssb'] ) && 'Y' === $arr_settings['ssba_link_to_ssb'] ? esc_attr( 'checked' ) : null,
716
+ );
717
+
718
+ // Link to ssb for plus.
719
+ $opts26p = array(
720
+ 'form_group' => false,
721
+ 'type' => 'checkbox',
722
+ 'name' => 'ssba_plus_link_to_ssb',
723
+ 'label' => 'Share Text Link',
724
+ 'tooltip' => 'Enabling this will set your share text as a link to simplesharebuttons.com to help others learn of the plugin',
725
+ 'value' => 'Y',
726
+ 'checked' => isset( $arr_settings['ssba_plus_link_to_ssb'] ) && 'Y' === $arr_settings['ssba_plus_link_to_ssb'] ? esc_attr( 'checked' ) : null,
727
+ );
728
+
729
+ // Content priority.
730
+ $opts27 = array(
731
+ 'form_group' => false,
732
+ 'type' => 'number',
733
+ 'placeholder' => '10',
734
+ 'name' => 'ssba_content_priority',
735
+ 'label' => 'Content Priority',
736
+ 'tooltip' => 'Set the priority for your share buttons within your content. 1-10, default is 10',
737
+ 'value' => isset( $arr_settings['ssba_content_priority'] ) ? $arr_settings['ssba_content_priority'] : '',
738
+ );
739
+
740
+ // Share in new window.
741
+ $opts28 = array(
742
+ 'form_group' => false,
743
+ 'type' => 'checkbox',
744
+ 'name' => 'ssba_share_new_window',
745
+ 'label' => 'Open links in a new window',
746
+ 'tooltip' => 'Disabling this will make links open in the same window',
747
+ 'value' => 'Y',
748
+ 'checked' => isset( $arr_settings['ssba_share_new_window'] ) && 'Y' === $arr_settings['ssba_share_new_window'] ? esc_attr( 'checked' ) : null,
749
+ );
750
+
751
+ // Share in new window for plus.
752
+ $opts28p = array(
753
+ 'form_group' => false,
754
+ 'type' => 'checkbox',
755
+ 'name' => 'ssba_plus_share_new_window',
756
+ 'label' => 'Open links in a new window',
757
+ 'tooltip' => 'Disabling this will make links open in the same window',
758
+ 'value' => 'Y',
759
+ 'checked' => isset( $arr_settings['ssba_plus_share_new_window'] ) && 'Y' === $arr_settings['ssba_plus_share_new_window'] ? esc_attr( 'checked' ) : null,
760
+ );
761
+
762
+ // Share in new window for share bar.
763
+ $opts28s = array(
764
+ 'form_group' => false,
765
+ 'type' => 'checkbox',
766
+ 'name' => 'ssba_bar_share_new_window',
767
+ 'label' => 'Open links in a new window',
768
+ 'tooltip' => 'Disabling this will make links open in the same window',
769
+ 'value' => 'Y',
770
+ 'checked' => isset( $arr_settings['ssba_bar_share_new_window'] ) && 'Y' === $arr_settings['ssba_bar_share_new_window'] ? esc_attr( 'checked' ) : null,
771
+ );
772
+
773
+ // Nofollow.
774
+ $opts29 = array(
775
+ 'form_group' => false,
776
+ 'type' => 'checkbox',
777
+ 'name' => 'ssba_rel_nofollow',
778
+ 'label' => 'Add rel="nofollow"',
779
+ 'tooltip' => 'Enable this to add nofollow to all share links',
780
+ 'value' => 'Y',
781
+ 'checked' => isset( $arr_settings['ssba_rel_nofollow'] ) && 'Y' === $arr_settings['ssba_rel_nofollow'] ? esc_attr( 'checked' ) : null,
782
+ );
783
+
784
+ // Nofollow for plus.
785
+ $opts29p = array(
786
+ 'form_group' => false,
787
+ 'type' => 'checkbox',
788
+ 'name' => 'ssba_plus_rel_nofollow',
789
+ 'label' => 'Add rel="nofollow"',
790
+ 'tooltip' => 'Enable this to add nofollow to all share links',
791
+ 'value' => 'Y',
792
+ 'checked' => isset( $arr_settings['ssba_plus_rel_nofollow'] ) && 'Y' === $arr_settings['ssba_plus_rel_nofollow'] ? esc_attr( 'checked' ) : null,
793
+ );
794
+
795
+ // Nofollow for share bar.
796
+ $opts29s = array(
797
+ 'form_group' => false,
798
+ 'type' => 'checkbox',
799
+ 'name' => 'ssba_bar_rel_nofollow',
800
+ 'label' => 'Add rel="nofollow"',
801
+ 'tooltip' => 'Enable this to add nofollow to all share links',
802
+ 'value' => 'Y',
803
+ 'checked' => isset( $arr_settings['ssba_bar_rel_nofollow'] ) && 'Y' === $arr_settings['ssba_bar_rel_nofollow'] ? esc_attr( 'checked' ) : null,
804
+ );
805
+
806
+ // Widget share text.
807
+ $opts30 = array(
808
+ 'form_group' => false,
809
+ 'type' => 'text',
810
+ 'placeholder' => 'Keeping sharing simple...',
811
+ 'name' => 'ssba_widget_text',
812
+ 'label' => 'Widget Share Text',
813
+ 'tooltip' => 'Add custom share text when used as a widget',
814
+ 'value' => isset( $arr_settings['ssba_widget_text'] ) ? $arr_settings['ssba_widget_text'] : '',
815
+ );
816
+
817
+ // Widget share text for plus.
818
+ $opts30p = array(
819
+ 'form_group' => false,
820
+ 'type' => 'text',
821
+ 'placeholder' => 'Keeping sharing simple...',
822
+ 'name' => 'ssba_plus_widget_text',
823
+ 'label' => 'Widget Share Text',
824
+ 'tooltip' => 'Add custom share text when used as a widget',
825
+ 'value' => isset( $arr_settings['ssba_plus_widget_text'] ) ? $arr_settings['ssba_plus_widget_text'] : '',
826
+ );
827
+
828
+ // Email share text.
829
+ $opts31 = array(
830
+ 'form_group' => false,
831
+ 'type' => 'text',
832
+ 'placeholder' => 'Share by email...',
833
+ 'name' => 'ssba_email_message',
834
+ 'label' => 'Email Text',
835
+ 'tooltip' => 'Add some text included in an email when people share that way',
836
+ 'value' => isset( $arr_settings['ssba_email_message'] ) ? $arr_settings['ssba_email_message'] : '',
837
+ );
838
+
839
+ // Email share text for plus.
840
+ $opts31p = array(
841
+ 'form_group' => false,
842
+ 'type' => 'text',
843
+ 'placeholder' => 'Share by email...',
844
+ 'name' => 'ssba_plus_email_message',
845
+ 'label' => 'Email Text',
846
+ 'tooltip' => 'Add some text included in an email when people share that way',
847
+ 'value' => isset( $arr_settings['ssba_plus_email_message'] ) ? $arr_settings['ssba_plus_email_message'] : '',
848
+ );
849
+
850
+ // Email share text for share bar.
851
+ $opts31s = array(
852
+ 'form_group' => false,
853
+ 'type' => 'text',
854
+ 'placeholder' => 'Share by email...',
855
+ 'name' => 'ssba_bar_email_message',
856
+ 'label' => 'Email Text',
857
+ 'tooltip' => 'Add some text included in an email when people share that way',
858
+ 'value' => isset( $arr_settings['ssba_bar_email_message'] ) ? $arr_settings['ssba_bar_email_message'] : '',
859
+ );
860
+
861
+ // Facebook app id.
862
+ $opts32 = array(
863
+ 'form_group' => false,
864
+ 'type' => 'text',
865
+ 'placeholder' => '123456789123',
866
+ 'name' => 'facebook_app_id',
867
+ 'label' => 'Facebook App ID',
868
+ 'tooltip' => 'Enter your Facebook App ID, e.g. 123456789123',
869
+ 'value' => isset( $arr_settings['facebook_app_id'] ) ? $arr_settings['facebook_app_id'] : '',
870
+ 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? esc_attr( 'disabled' ) : null,
871
+ );
872
+
873
+ // Facebook app id for plus.
874
+ $opts32p = array(
875
+ 'form_group' => false,
876
+ 'type' => 'text',
877
+ 'placeholder' => '123456789123',
878
+ 'name' => 'plus_facebook_app_id',
879
+ 'label' => 'Facebook App ID',
880
+ 'tooltip' => 'Enter your Facebook App ID, e.g. 123456789123',
881
+ 'value' => isset( $arr_settings['plus_facebook_app_id'] ) ? $arr_settings['plus_facebook_app_id'] : '',
882
+ 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? esc_attr( 'disabled' ) : null,
883
+ );
884
+
885
+ // Facebook app id for share bar.
886
+ $opts32s = array(
887
+ 'form_group' => false,
888
+ 'type' => 'text',
889
+ 'placeholder' => '123456789123',
890
+ 'name' => 'share_facebook_app_id',
891
+ 'label' => 'Facebook App ID',
892
+ 'tooltip' => 'Enter your Facebook App ID, e.g. 123456789123',
893
+ 'value' => isset( $arr_settings['bar_facebook_app_id'] ) ? $arr_settings['bar_facebook_app_id'] : '',
894
+ 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? esc_attr( 'disabled' ) : null,
895
+ );
896
+
897
+ // Facebook insights.
898
+ $opts33 = array(
899
+ 'form_group' => false,
900
+ 'type' => 'checkbox',
901
+ 'name' => 'facebook_insights',
902
+ 'label' => 'Facebook Insights',
903
+ 'tooltip' => 'Enable this feature to enable Facebook Insights',
904
+ 'value' => 'Y',
905
+ 'checked' => isset( $arr_settings['facebook_insights'] ) && 'Y' === $arr_settings['facebook_insights'] ? 'checked' : null,
906
+ 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? 'disabled' : null,
907
+ );
908
+
909
+ // Ignore sdk.
910
+ $ignore_sdk = array(
911
+ 'form_group' => false,
912
+ 'type' => 'checkbox',
913
+ 'name' => 'ignore_facebook_sdk',
914
+ 'label' => 'Ignore FB SDK',
915
+ 'tooltip' => 'Using you\'re own Facebook SDK? Ignore ours.',
916
+ 'value' => 'Y',
917
+ 'checked' => isset( $arr_settings['ignore_facebook_sdk'] ) && 'Y' === $arr_settings['ignore_facebook_sdk'] ? esc_attr( 'checked' ) : '',
918
+ );
919
+
920
+ // Facebook insights for plus.
921
+ $opts33p = array(
922
+ 'form_group' => false,
923
+ 'type' => 'checkbox',
924
+ 'name' => 'plus_facebook_insights',
925
+ 'label' => 'Facebook Insights',
926
+ 'tooltip' => 'Enable this feature to enable Facebook Insights',
927
+ 'value' => 'Y',
928
+ 'checked' => isset( $arr_settings['plus_facebook_insights'] ) && 'Y' === $arr_settings['plus_facebook_insights'] ? 'checked' : null,
929
+ 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? 'disabled' : null,
930
+ );
931
+
932
+ // Plus ignore sdk.
933
+ $plus_ignore_sdk = array(
934
+ 'form_group' => false,
935
+ 'type' => 'checkbox',
936
+ 'name' => 'plus_ignore_facebook_sdk',
937
+ 'label' => 'Ignore FB SDK',
938
+ 'tooltip' => 'Using you\'re own Facebook SDK? Ignore ours.',
939
+ 'value' => 'Y',
940
+ 'checked' => isset( $arr_settings['plus_ignore_facebook_sdk'] ) && 'Y' === $arr_settings['plus_ignore_facebook_sdk'] ? esc_attr( 'checked' ) : '',
941
+ );
942
+
943
+ // Facebook insights for share bar.
944
+ $opts33s = array(
945
+ 'form_group' => false,
946
+ 'type' => 'checkbox',
947
+ 'name' => 'share_facebook_insights',
948
+ 'label' => 'Facebook Insights',
949
+ 'tooltip' => 'Enable this feature to enable Facebook Insights',
950
+ 'value' => 'Y',
951
+ 'checked' => isset( $arr_settings['bar_facebook_insights'] ) && 'Y' === $arr_settings['bar_facebook_insights'] ? 'checked' : null,
952
+ 'disabled' => 'Y' !== $arr_settings['accepted_sharethis_terms'] ? 'disabled' : null,
953
+ );
954
+
955
+ // Twitter share text.
956
+ $opts34 = array(
957
+ 'form_group' => false,
958
+ 'type' => 'text',
959
+ 'placeholder' => 'Shared by Twitter...',
960
+ 'name' => 'ssba_twitter_text',
961
+ 'label' => 'Twitter Text',
962
+ 'tooltip' => 'Add some custom text for when people share via Twitter',
963
+ 'value' => isset( $arr_settings['ssba_twitter_text'] ) ? $arr_settings['ssba_twitter_text'] : '',
964
+ );
965
+
966
+ // Twitter share text for plus.
967
+ $opts34p = array(
968
+ 'form_group' => false,
969
+ 'type' => 'text',
970
+ 'placeholder' => 'Shared by Twitter...',
971
+ 'name' => 'ssba_plus_twitter_text',
972
+ 'label' => 'Twitter Text',
973
+ 'tooltip' => 'Add some custom text for when people share via Twitter',
974
+ 'value' => isset( $arr_settings['ssba_plus_twitter_text'] ) ? $arr_settings['ssba_plus_twitter_text'] : '',
975
+ );
976
+
977
+ // Twitter share text for share bar.
978
+ $opts34s = array(
979
+ 'form_group' => false,
980
+ 'type' => 'text',
981
+ 'placeholder' => 'Shared by Twitter...',
982
+ 'name' => 'ssba_bar_twitter_text',
983
+ 'label' => 'Twitter Text',
984
+ 'tooltip' => 'Add some custom text for when people share via Twitter',
985
+ 'value' => isset( $arr_settings['ssba_bar_twitter_text'] ) ? $arr_settings['ssba_bar_twitter_text'] : '',
986
+ );
987
+
988
+ // Flattr user id.
989
+ $opts35 = array(
990
+ 'form_group' => false,
991
+ 'type' => 'text',
992
+ 'placeholder' => 'davidsneal',
993
+ 'name' => 'ssba_flattr_user_id',
994
+ 'label' => 'Flattr User ID',
995
+ 'tooltip' => 'Enter your Flattr ID, e.g. davidsneal',
996
+ 'value' => isset( $arr_settings['ssba_flattr_user_id'] ) ? $arr_settings['ssba_flattr_user_id'] : '',
997
+ );
998
+
999
+ // Flattr user id for plus.
1000
+ $opts35p = array(
1001
+ 'form_group' => false,
1002
+ 'type' => 'text',
1003
+ 'placeholder' => 'davidsneal',
1004
+ 'name' => 'ssba_plus_flattr_user_id',
1005
+ 'label' => 'Flattr User ID',
1006
+ 'tooltip' => 'Enter your Flattr ID, e.g. davidsneal',
1007
+ 'value' => isset( $arr_settings['ssba_plus_flattr_user_id'] ) ? $arr_settings['ssba_plus_flattr_user_id'] : '',
1008
+ );
1009
+
1010
+ // Flattr user id for share bar.
1011
+ $opts35s = array(
1012
+ 'form_group' => false,
1013
+ 'type' => 'text',
1014
+ 'placeholder' => 'davidsneal',
1015
+ 'name' => 'ssba_bar_flattr_user_id',
1016
+ 'label' => 'Flattr User ID',
1017
+ 'tooltip' => 'Enter your Flattr ID, e.g. davidsneal',
1018
+ 'value' => isset( $arr_settings['ssba_bar_flattr_user_id'] ) ? $arr_settings['ssba_bar_flattr_user_id'] : '',
1019
+ );
1020
+
1021
+ // Flattr url.
1022
+ $opts36 = array(
1023
+ 'form_group' => false,
1024
+ 'type' => 'text',
1025
+ 'placeholder' => 'flattr.com/@username',
1026
+ 'name' => 'ssba_flattr_url',
1027
+ 'label' => 'Flattr URL',
1028
+ 'tooltip' => 'This option is perfect for dedicated sites, e.g. https://simplesharebuttons.com',
1029
+ 'value' => isset( $arr_settings['ssba_flattr_url'] ) ? $arr_settings['ssba_flattr_url'] : '',
1030
+ );
1031
+
1032
+ // Flattr url for plus.
1033
+ $opts36p = array(
1034
+ 'form_group' => false,
1035
+ 'type' => 'text',
1036
+ 'placeholder' => 'flattr.com/@username',
1037
+ 'name' => 'ssba_plus_flattr_url',
1038
+ 'label' => 'Flattr URL',
1039
+ 'tooltip' => 'This option is perfect for dedicated sites, e.g. https://simplesharebuttons.com',
1040
+ 'value' => isset( $arr_settings['ssba_plus_flattr_url'] ) ? $arr_settings['ssba_plus_flattr_url'] : '',
1041
+ );
1042
+
1043
+ // Flattr url for share bar.
1044
+ $opts36s = array(
1045
+ 'form_group' => false,
1046
+ 'type' => 'text',
1047
+ 'placeholder' => 'flattr.com/@username',
1048
+ 'name' => 'ssba_bar_flattr_url',
1049
+ 'label' => 'Flattr URL',
1050
+ 'tooltip' => 'This option is perfect for dedicated sites, e.g. https://simplesharebuttons.com',
1051
+ 'value' => isset( $arr_settings['ssba_bar_flattr_url'] ) ? $arr_settings['ssba_bar_flattr_url'] : '',
1052
+ );
1053
+
1054
+ // Buffer text.
1055
+ $opts37 = array(
1056
+ 'form_group' => false,
1057
+ 'type' => 'text',
1058
+ 'placeholder' => 'Shared by Buffer...',
1059
+ 'name' => 'ssba_buffer_text',
1060
+ 'label' => 'Custom Buffer Text',
1061
+ 'tooltip' => 'Add some custom text for when people share via Buffer',
1062
+ 'value' => isset( $arr_settings['ssba_buffer_text'] ) ? $arr_settings['ssba_buffer_text'] : '',
1063
+ );
1064
+
1065
+ // Buffer text for plus.
1066
+ $opts37p = array(
1067
+ 'form_group' => false,
1068
+ 'type' => 'text',
1069
+ 'placeholder' => 'Shared by Buffer...',
1070
+ 'name' => 'ssba_plus_buffer_text',
1071
+ 'label' => 'Custom Buffer Text',
1072
+ 'tooltip' => 'Add some custom text for when people share via Buffer',
1073
+ 'value' => isset( $arr_settings['ssba_plus_buffer_text'] ) ? $arr_settings['ssba_plus_buffer_text'] : '',
1074
+ );
1075
+
1076
+ // Buffer text for share bar.
1077
+ $opts37s = array(
1078
+ 'form_group' => false,
1079
+ 'type' => 'text',
1080
+ 'placeholder' => 'Shared by Buffer...',
1081
+ 'name' => 'ssba_bar_buffer_text',
1082
+ 'label' => 'Custom Buffer Text',
1083
+ 'tooltip' => 'Add some custom text for when people share via Buffer',
1084
+ 'value' => isset( $arr_settings['ssba_bar_buffer_text'] ) ? $arr_settings['ssba_bar_buffer_text'] : '',
1085
+ );
1086
+
1087
+ // Pin featured images.
1088
+ $opts38 = array(
1089
+ 'form_group' => false,
1090
+ 'type' => 'checkbox',
1091
+ 'name' => 'ssba_pinterest_featured',
1092
+ 'label' => 'Pin Featured Images',
1093
+ 'tooltip' => 'Force the use of featured images for posts/pages when pinning',
1094
+ 'value' => 'Y',
1095
+ 'checked' => isset( $arr_settings['ssba_pinterest_featured'] ) && 'Y' === $arr_settings['ssba_pinterest_featured'] ? 'checked' : null,
1096
+ );
1097
+
1098
+ // Pin featured images for plus.
1099
+ $opts38p = array(
1100
+ 'form_group' => false,
1101
+ 'type' => 'checkbox',
1102
+ 'name' => 'ssba_plus_pinterest_featured',
1103
+ 'label' => 'Pin Featured Images',
1104
+ 'tooltip' => 'Force the use of featured images for posts/pages when pinning',
1105
+ 'value' => 'Y',
1106
+ 'checked' => isset( $arr_settings['ssba_plus_pinterest_featured'] ) && 'Y' === $arr_settings['ssba_plus_pinterest_featured'] ? 'checked' : null,
1107
+ );
1108
+
1109
+ // Pin featured images for share bar.
1110
+ $opts38s = array(
1111
+ 'form_group' => false,
1112
+ 'type' => 'checkbox',
1113
+ 'name' => 'ssba_bar_pinterest_featured',
1114
+ 'label' => 'Pin Featured Images',
1115
+ 'tooltip' => 'Force the use of featured images for posts/pages when pinning',
1116
+ 'value' => 'Y',
1117
+ 'checked' => isset( $arr_settings['ssba_bar_pinterest_featured'] ) && 'Y' === $arr_settings['ssba_bar_pinterest_featured'] ? 'checked' : null,
1118
+ );
1119
+
1120
+ // Default pinterest image.
1121
+ $opts39 = array(
1122
+ 'form_group' => false,
1123
+ 'type' => 'image_upload',
1124
+ 'name' => 'ssba_default_pinterest',
1125
+ 'label' => 'Default Pinterest Image',
1126
+ 'tooltip' => 'Upload a default Pinterest image',
1127
+ 'value' => isset( $arr_settings['ssba_default_pinterest'] ) ? $arr_settings['ssba_default_pinterest'] : '',
1128
+ );
1129
+
1130
+ // Default pinterest image for plus.
1131
+ $opts39p = array(
1132
+ 'form_group' => false,
1133
+ 'type' => 'image_upload',
1134
+ 'name' => 'ssba_plus_default_pinterest',
1135
+ 'label' => 'Default Pinterest Image',
1136
+ 'tooltip' => 'Upload a default Pinterest image',
1137
+ 'value' => isset( $arr_settings['ssba_plus_default_pinterest'] ) ? $arr_settings['ssba_plus_default_pinterest'] : '',
1138
+ );
1139
+
1140
+ // Default pinterest image for share bar.
1141
+ $opts39s = array(
1142
+ 'form_group' => false,
1143
+ 'type' => 'image_upload',
1144
+ 'name' => 'ssba_bar_default_pinterest',
1145
+ 'label' => 'Default Pinterest Image',
1146
+ 'tooltip' => 'Upload a default Pinterest image',
1147
+ 'value' => isset( $arr_settings['ssba_bar_default_pinterest'] ) ? $arr_settings['ssba_bar_default_pinterest'] : '',
1148
+ );
1149
+
1150
+ // Additional css.
1151
+ $opts40 = array(
1152
+ 'form_group' => false,
1153
+ 'type' => 'textarea',
1154
+ 'rows' => '15',
1155
+ 'class' => 'code-font',
1156
+ 'name' => 'ssba_additional_css',
1157
+ 'label' => 'Additional CSS',
1158
+ 'tooltip' => 'Add your own additional CSS if you wish',
1159
+ 'value' => isset( $arr_settings['ssba_additional_css'] ) ? $arr_settings['ssba_additional_css'] : '',
1160
+ );
1161
+
1162
+ // Additional css for plus.
1163
+ $opts40p = array(
1164
+ 'form_group' => false,
1165
+ 'type' => 'textarea',
1166
+ 'rows' => '15',
1167
+ 'class' => 'code-font',
1168
+ 'name' => 'ssba_plus_additional_css',
1169
+ 'label' => 'Additional CSS',
1170
+ 'tooltip' => 'Add your own additional CSS if you wish',
1171
+ 'value' => isset( $arr_settings['ssba_plus_additional_css'] ) ? $arr_settings['ssba_plus_additional_css'] : '',
1172
+ );
1173
+
1174
+ // Additional css for share.
1175
+ $opts40s = array(
1176
+ 'form_group' => false,
1177
+ 'type' => 'textarea',
1178
+ 'rows' => '15',
1179
+ 'class' => 'code-font',
1180
+ 'name' => 'ssba_bar_additional_css',
1181
+ 'label' => 'Additional CSS',
1182
+ 'tooltip' => 'Add your own additional CSS if you wish',
1183
+ 'value' => isset( $arr_settings['ssba_bar_additional_css'] ) ? $arr_settings['ssba_bar_additional_css'] : '',
1184
+ );
1185
+
1186
+ // Enable custom css.
1187
+ $opts41 = array(
1188
+ 'form_group' => false,
1189
+ 'type' => 'checkbox',
1190
+ 'name' => 'ssba_custom_styles_enabled',
1191
+ 'label' => 'Enable Custom CSS',
1192
+ 'tooltip' => 'Switch on to disable all SSBA styles and use your own custom CSS',
1193
+ 'value' => 'Y',
1194
+ 'checked' => isset( $arr_settings['ssba_custom_styles_enabled'] ) && 'Y' === $arr_settings['ssba_custom_styles_enabled'] ? 'checked' : null,
1195
+ );
1196
+
1197
+ // Custom css.
1198
+ $opts42 = array(
1199
+ 'form_group' => false,
1200
+ 'type' => 'textarea',
1201
+ 'rows' => '15',
1202
+ 'class' => 'code-font',
1203
+ 'name' => 'ssba_custom_styles',
1204
+ 'label' => 'Custom CSS',
1205
+ 'tooltip' => 'Enter in your own custom CSS for your share buttons',
1206
+ 'value' => isset( $arr_settings['ssba_custom_styles'] ) ? $arr_settings['ssba_custom_styles'] : '',
1207
+ );
1208
+
1209
+ // Switch to new buttons.
1210
+ $opts43 = array(
1211
+ 'form_group' => false,
1212
+ 'type' => 'checkbox',
1213
+ 'name' => 'ssba_new_buttons',
1214
+ 'label' => 'Plus Share Buttons',
1215
+ 'tooltip' => 'If "On" new buttons replace the old on your site.',
1216
+ 'value' => 'Y',
1217
+ 'checked' => isset( $arr_settings['ssba_new_buttons'] ) && 'Y' === $arr_settings['ssba_new_buttons'] ? 'checked' : null,
1218
+ );
1219
+
1220
+ // Select style of new buttons.
1221
+ $opts44 = array(
1222
+ 'form_group' => false,
1223
+ 'type' => 'select',
1224
+ 'name' => 'ssba_plus_button_style',
1225
+ 'label' => 'Theme',
1226
+ 'tooltip' => 'Choose the style of the new buttons',
1227
+ 'selected' => isset( $arr_settings['ssba_plus_button_style'] ) ? $arr_settings['ssba_plus_button_style'] : '',
1228
+ 'options' => array(
1229
+ 'Round' => 1,
1230
+ 'Square' => 2,
1231
+ 'Logo Name' => 3,
1232
+ 'Rounded' => 4,
1233
+ '3D' => 5,
1234
+ 'Border Round' => 6,
1235
+ 'Border Logo Name' => 7,
1236
+ 'Black Border' => 8,
1237
+ 'Underline' => 9,
1238
+ 'Auto Square' => 10,
1239
+ 'Name' => 11,
1240
+ ),
1241
+ );
1242
+
1243
+ // Locations.
1244
+ $opts48 = array(
1245
+ 'form_group' => false,
1246
+ 'label' => 'Locations',
1247
+ 'tooltip' => 'Enable the locations you wish for plus buttons to appear',
1248
+ 'value' => 'Y',
1249
+ 'checkboxes' => $locs3,
1250
+ );
1251
+
1252
+ // Placement.
1253
+ $opts49 = array(
1254
+ 'form_group' => false,
1255
+ 'type' => 'select',
1256
+ 'name' => 'ssba_before_or_after_plus',
1257
+ 'label' => 'Placement',
1258
+ 'tooltip' => 'Place share buttons before or after your content',
1259
+ 'selected' => isset( $arr_settings['ssba_before_or_after_plus'] ) ? $arr_settings['ssba_before_or_after_plus'] : '',
1260
+ 'options' => array(
1261
+ 'After' => 'after',
1262
+ 'Before' => 'before',
1263
+ 'Both' => 'both',
1264
+ ),
1265
+ );
1266
+
1267
+ // Locations.
1268
+ $opts45 = array(
1269
+ 'form_group' => false,
1270
+ 'label' => 'Locations',
1271
+ 'tooltip' => 'Enable the locations you wish for share buttons to appear',
1272
+ 'value' => 'Y',
1273
+ 'checkboxes' => $locs2,
1274
+ );
1275
+
1276
+ // Select style of share bar.
1277
+ $opts46 = array(
1278
+ 'form_group' => false,
1279
+ 'type' => 'select',
1280
+ 'name' => 'ssba_bar_style',
1281
+ 'label' => 'Style',
1282
+ 'tooltip' => 'Choose the style of the share bar buttons',
1283
+ 'selected' => isset( $arr_settings['ssba_bar_style'] ) ? $arr_settings['ssba_bar_style'] : '',
1284
+ 'options' => array(
1285
+ 'Round' => 1,
1286
+ 'Square' => 2,
1287
+ 'Rounded' => 4,
1288
+ '3D' => 5,
1289
+ 'Border Round' => 6,
1290
+ 'Black Border' => 8,
1291
+ 'Underline' => 9,
1292
+ ),
1293
+ );
1294
+
1295
+ // Select position of share bar.
1296
+ $opts47 = array(
1297
+ 'form_group' => false,
1298
+ 'type' => 'select',
1299
+ 'name' => 'ssba_bar_position',
1300
+ 'label' => 'Alignment',
1301
+ 'tooltip' => 'Choose the share bar position',
1302
+ 'selected' => isset( $arr_settings['ssba_bar_position'] ) ? $arr_settings['ssba_bar_position'] : '',
1303
+ 'options' => array(
1304
+ 'Sticky Left' => 'left',
1305
+ 'Sticky Right' => 'right',
1306
+ ),
1307
+ );
1308
+
1309
+ // Plus buttons height.
1310
+ $plus_height = array(
1311
+ 'form_group' => false,
1312
+ 'type' => 'number_addon',
1313
+ 'addon' => 'px',
1314
+ 'placeholder' => '48',
1315
+ 'name' => 'ssba_plus_height',
1316
+ 'label' => 'Height',
1317
+ 'tooltip' => 'Set the height of the plus buttons',
1318
+ 'value' => isset( $arr_settings['ssba_plus_height'] ) ? $arr_settings['ssba_plus_height'] : '',
1319
+ );
1320
+
1321
+ // Plus buttons width.
1322
+ $plus_width = array(
1323
+ 'form_group' => false,
1324
+ 'type' => 'number_addon',
1325
+ 'addon' => 'px',
1326
+ 'placeholder' => '48',
1327
+ 'name' => 'ssba_plus_width',
1328
+ 'label' => 'Width',
1329
+ 'tooltip' => 'Set the width of the plus buttons',
1330
+ 'value' => isset( $arr_settings['ssba_plus_width'] ) ? $arr_settings['ssba_plus_width'] : '',
1331
+ );
1332
+
1333
+ // Plus icon size.
1334
+ $plus_icon_size = array(
1335
+ 'form_group' => false,
1336
+ 'type' => 'number_addon',
1337
+ 'addon' => 'px',
1338
+ 'placeholder' => '24',
1339
+ 'name' => 'ssba_plus_icon_size',
1340
+ 'label' => 'Icon Size',
1341
+ 'tooltip' => 'Set the icon size of the plus buttons',
1342
+ 'value' => isset( $arr_settings['ssba_plus_icon_size'] ) ? $arr_settings['ssba_plus_icon_size'] : '',
1343
+ );
1344
+
1345
+ // Plus button margin.
1346
+ $plus_margin = array(
1347
+ 'form_group' => false,
1348
+ 'type' => 'number_addon',
1349
+ 'addon' => 'px',
1350
+ 'placeholder' => '12',
1351
+ 'name' => 'ssba_plus_margin',
1352
+ 'label' => 'Margin',
1353
+ 'tooltip' => 'Set the margin of the plus buttons',
1354
+ 'value' => isset( $arr_settings['ssba_plus_margin'] ) ? $arr_settings['ssba_plus_margin'] : '',
1355
+ );
1356
+
1357
+ // Plus button color override.
1358
+ $plus_button_color = array(
1359
+ 'form_group' => false,
1360
+ 'type' => 'colorpicker',
1361
+ 'name' => 'ssba_plus_button_color',
1362
+ 'label' => 'Button Color',
1363
+ 'tooltip' => 'Choose the color for all plus buttons',
1364
+ 'value' => isset( $arr_settings['ssba_plus_button_color'] ) ? $arr_settings['ssba_plus_button_color'] : '',
1365
+ );
1366
+
1367
+ // Plus button hover color override.
1368
+ $plus_hover_color = array(
1369
+ 'form_group' => false,
1370
+ 'type' => 'colorpicker',
1371
+ 'name' => 'ssba_plus_button_hover_color',
1372
+ 'label' => 'Hover Color',
1373
+ 'tooltip' => 'Choose the color for all plus buttons hover',
1374
+ 'value' => isset( $arr_settings['ssba_plus_button_hover_color'] ) ? $arr_settings['ssba_plus_button_hover_color'] : '',
1375
+ );
1376
+
1377
+ // Plus icon color override.
1378
+ $plus_icon_color = array(
1379
+ 'form_group' => false,
1380
+ 'type' => 'colorpicker',
1381
+ 'name' => 'ssba_plus_icon_color',
1382
+ 'label' => 'Icon Color',
1383
+ 'tooltip' => 'Choose the color for all plus button icons',
1384
+ 'value' => isset( $arr_settings['ssba_plus_icon_color'] ) ? $arr_settings['ssba_plus_icon_color'] : '',
1385
+ );
1386
+
1387
+ // Plus button color override.
1388
+ $plus_icon_hover_color = array(
1389
+ 'form_group' => false,
1390
+ 'type' => 'colorpicker',
1391
+ 'name' => 'ssba_plus_icon_hover_color',
1392
+ 'label' => 'Icon Hover Color',
1393
+ 'tooltip' => 'Choose the color for all plus button icons hover',
1394
+ 'value' => isset( $arr_settings['ssba_plus_icon_hover_color'] ) ? $arr_settings['ssba_plus_icon_hover_color'] : '',
1395
+ );
1396
+
1397
+ // share buttons height.
1398
+ $share_height = array(
1399
+ 'form_group' => false,
1400
+ 'type' => 'number_addon',
1401
+ 'addon' => 'px',
1402
+ 'placeholder' => '48',
1403
+ 'name' => 'ssba_bar_height',
1404
+ 'label' => 'Height',
1405
+ 'tooltip' => 'Set the height of the share bar buttons',
1406
+ 'value' => isset( $arr_settings['ssba_bar_height'] ) ? $arr_settings['ssba_bar_height'] : '',
1407
+ );
1408
+
1409
+ // share buttons width.
1410
+ $share_width = array(
1411
+ 'form_group' => false,
1412
+ 'type' => 'number_addon',
1413
+ 'addon' => 'px',
1414
+ 'placeholder' => '48',
1415
+ 'name' => 'ssba_bar_width',
1416
+ 'label' => 'Width',
1417
+ 'tooltip' => 'Set the width of the share bar buttons',
1418
+ 'value' => isset( $arr_settings['ssba_bar_width'] ) ? $arr_settings['ssba_bar_width'] : '',
1419
+ );
1420
+
1421
+ // share icon size.
1422
+ $share_icon_size = array(
1423
+ 'form_group' => false,
1424
+ 'type' => 'number_addon',
1425
+ 'addon' => 'px',
1426
+ 'placeholder' => '24',
1427
+ 'name' => 'ssba_bar_icon_size',
1428
+ 'label' => 'Icon Size',
1429
+ 'tooltip' => 'Set the icon size of the share bar buttons',
1430
+ 'value' => isset( $arr_settings['ssba_bar_icon_size'] ) ? $arr_settings['ssba_bar_icon_size'] : '',
1431
+ );
1432
+
1433
+ // share button margin.
1434
+ $share_margin = array(
1435
+ 'form_group' => false,
1436
+ 'type' => 'number_addon',
1437
+ 'addon' => 'px',
1438
+ 'placeholder' => '12',
1439
+ 'name' => 'ssba_bar_margin',
1440
+ 'label' => 'Margin',
1441
+ 'tooltip' => 'Set the margin of the share bar buttons',
1442
+ 'value' => isset( $arr_settings['ssba_bar_margin'] ) ? $arr_settings['ssba_bar_margin'] : '',
1443
+ );
1444
+
1445
+ // share button color override.
1446
+ $share_button_color = array(
1447
+ 'form_group' => false,
1448
+ 'type' => 'colorpicker',
1449
+ 'name' => 'ssba_bar_button_color',
1450
+ 'label' => 'Button Color',
1451
+ 'tooltip' => 'Choose the color for all share bar buttons',
1452
+ 'value' => isset( $arr_settings['ssba_bar_button_color'] ) ? $arr_settings['ssba_bar_button_color'] : '',
1453
+ );
1454
+
1455
+ // share button hover color override.
1456
+ $share_hover_color = array(
1457
+ 'form_group' => false,
1458
+ 'type' => 'colorpicker',
1459
+ 'name' => 'ssba_bar_button_hover_color',
1460
+ 'label' => 'Hover Color',
1461
+ 'tooltip' => 'Choose the color for all share bar buttons hover',
1462
+ 'value' => isset( $arr_settings['ssba_bar_button_hover_color'] ) ? $arr_settings['ssba_bar_button_hover_color'] : '',
1463
+ );
1464
+
1465
+ // share icon color override.
1466
+ $share_icon_color = array(
1467
+ 'form_group' => false,
1468
+ 'type' => 'colorpicker',
1469
+ 'name' => 'ssba_bar_icon_color',
1470
+ 'label' => 'Icon Color',
1471
+ 'tooltip' => 'Choose the color for all share bar button icons',
1472
+ 'value' => isset( $arr_settings['ssba_bar_icon_color'] ) ? $arr_settings['ssba_bar_icon_color'] : '',
1473
+ );
1474
+
1475
+ // share button color override.
1476
+ $share_icon_hover_color = array(
1477
+ 'form_group' => false,
1478
+ 'type' => 'colorpicker',
1479
+ 'name' => 'ssba_bar_icon_hover_color',
1480
+ 'label' => 'Icon Hover Color',
1481
+ 'tooltip' => 'Choose the color for all share bar button icons hover',
1482
+ 'value' => isset( $arr_settings['ssba_bar_icon_hover_color'] ) ? $arr_settings['ssba_bar_icon_hover_color'] : '',
1483
+ );
1484
+
1485
+ // Enable share bar.
1486
+ $share_bar = array(
1487
+ 'form_group' => false,
1488
+ 'type' => 'checkbox',
1489
+ 'name' => 'ssba_bar_enabled',
1490
+ 'label' => 'Share Bar',
1491
+ 'tooltip' => 'If "On" share bar will appear on your site.',
1492
+ 'value' => 'Y',
1493
+ 'checked' => isset( $arr_settings['ssba_bar_enabled'] ) && 'Y' === $arr_settings['ssba_bar_enabled'] ? 'checked' : null,
1494
+ );
1495
+
1496
+ // Share bar display.
1497
+ $share_bar_display = array(
1498
+ 'form_group' => false,
1499
+ 'label' => 'Display on',
1500
+ 'tooltip' => 'Disable to hide on desktop or mobile views',
1501
+ 'value' => 'Y',
1502
+ 'checkboxes' => $display_loc,
1503
+ );
1504
+
1505
+ // share button mobile breakpoint.
1506
+ $mobile_breakpoint = array(
1507
+ 'form_group' => false,
1508
+ 'type' => 'number_addon',
1509
+ 'addon' => 'px',
1510
+ 'placeholder' => '780',
1511
+ 'name' => 'ssba_mobile_breakpoint',
1512
+ 'label' => 'Mobile Breakpoint',
1513
+ 'tooltip' => 'Set the share bar mobile breakpoint when it centers on screen',
1514
+ 'value' => isset( $arr_settings['ssba_mobile_breakpoint'] ) ? $arr_settings['ssba_mobile_breakpoint'] : '',
1515
+ );
1516
+
1517
+ // Sharedcount api key.
1518
+ $page_omit = array(
1519
+ 'form_group' => false,
1520
+ 'type' => 'text',
1521
+ 'placeholder' => 'Enter page titles separated by commas...',
1522
+ 'name' => 'ssba_omit_pages',
1523
+ 'label' => 'Hide On These Pages',
1524
+ 'tooltip' => 'Add one or more page titles separated by commas of pages you wish to hide these buttons on.',
1525
+ 'value' => isset( $arr_settings['ssba_omit_pages'] ) ? $arr_settings['ssba_omit_pages'] : '',
1526
+ );
1527
+
1528
+ // Sharedcount api key.
1529
+ $page_omit_plus = array(
1530
+ 'form_group' => false,
1531
+ 'type' => 'text',
1532
+ 'placeholder' => 'Enter page titles separated by commas...',
1533
+ 'name' => 'ssba_omit_pages_plus',
1534
+ 'label' => 'Hide On These Pages',
1535
+ 'tooltip' => 'Add one or more page titles separated by commas of pages you wish to hide these buttons on.',
1536
+ 'value' => isset( $arr_settings['ssba_omit_pages_plus'] ) ? $arr_settings['ssba_omit_pages_plus'] : '',
1537
+ );
1538
+
1539
+ // Sharedcount api key.
1540
+ $page_omit_bar = array(
1541
+ 'form_group' => false,
1542
+ 'type' => 'text',
1543
+ 'placeholder' => 'Enter page titles separated by commas...',
1544
+ 'name' => 'ssba_omit_pages_bar',
1545
+ 'label' => 'Hide On These Pages',
1546
+ 'tooltip' => 'Add one or more page titles separated by commas of pages you wish to hide these buttons on.',
1547
+ 'value' => isset( $arr_settings['ssba_omit_pages_bar'] ) ? $arr_settings['ssba_omit_pages_bar'] : '',
1548
+ );
1549
+
1550
+ // Notices.
1551
+ $notice = get_option( 'ssba_dismiss_notice' );
1552
+ $buttons = get_option( 'ssba_buttons' );
1553
+ $buttons = ! empty( $buttons ) ? $buttons : array();
1554
+
1555
+ // All buttons.
1556
+ $arr_buttons = array_values( $buttons );
1557
+ $selected_buttons = explode( ',', $arr_settings['ssba_selected_buttons'] );
1558
+ $selected_plus_buttons = explode( ',', $arr_settings['ssba_selected_plus_buttons'] );
1559
+ $selected_bar_buttons = explode( ',', $arr_settings['ssba_selected_bar_buttons'] );
1560
+ $non_selected_buttons = array();
1561
+
1562
+ // Empty beginnings.
1563
+ $selected_button_array = array();
1564
+ $selected_bar_button_array = array();
1565
+ $selected_plus_button_array = array();
1566
+ $non_plus_selected_buttons = array();
1567
+ $non_bar_selected_buttons = array();
1568
+
1569
+ // Custom button key.
1570
+ $custom_buttons = $this->get_custom_button_key( $arr_settings );
1571
+
1572
+ foreach ( $arr_buttons as $button_name ) {
1573
+ $new_name = str_replace(
1574
+ '+',
1575
+ '',
1576
+ str_replace( ' ', '_', strtolower( $button_name['full_name'] ) )
1577
+ );
1578
+ $new_arr_buttons[ $new_name ] = $button_name;
1579
+ }
1580
+
1581
+ foreach ( $selected_buttons as $button ) {
1582
+ if ( isset( $new_arr_buttons[ $button ] ) ) {
1583
+ $selected_button_array[] = $new_arr_buttons[ $button ];
1584
+ }
1585
+ }
1586
+
1587
+ // Plus buttons.
1588
+ foreach ( $selected_plus_buttons as $plus_button ) {
1589
+ if ( isset( $new_arr_buttons[ $plus_button ] ) ) {
1590
+ $selected_plus_button_array[] = $new_arr_buttons[ $plus_button ];
1591
+ }
1592
+ }
1593
+
1594
+ // Bar buttons.
1595
+ foreach ( $selected_bar_buttons as $bar_button ) {
1596
+ if ( isset( $new_arr_buttons[ $bar_button ] ) ) {
1597
+ $selected_bar_button_array[] = $new_arr_buttons[ $bar_button ];
1598
+ }
1599
+ }
1600
+
1601
+ foreach ( $arr_buttons as $non_buttons ) {
1602
+ if ( true === isset( $selected_button_array )
1603
+ && true === is_array( $selected_button_array )
1604
+ && false === in_array( $non_buttons, $selected_button_array, true ) ) {
1605
+ $non_selected_buttons[] = $non_buttons;
1606
+ }
1607
+ }
1608
+
1609
+ // Plus buttons.
1610
+ foreach ( $arr_buttons as $non_plus_buttons ) {
1611
+ if (
1612
+ true === isset( $selected_plus_button_array )
1613
+ && true === is_array( $selected_plus_button_array )
1614
+ && false === in_array( $non_plus_buttons, $selected_plus_button_array, true )
1615
+ ) {
1616
+ $non_plus_selected_buttons[] = $non_plus_buttons;
1617
+ }
1618
+ }
1619
+
1620
+ // Bar Buttons.
1621
+ foreach ( $arr_buttons as $non_bar_buttons ) {
1622
+ if ( true === isset( $selected_bar_button_array )
1623
+ && true === is_array( $selected_bar_button_array )
1624
+ && false === in_array(
1625
+ $non_bar_buttons,
1626
+ $selected_bar_button_array,
1627
+ true
1628
+ ) ) {
1629
+ $non_bar_selected_buttons[] = $non_bar_buttons;
1630
+ }
1631
+ }
1632
+
1633
+ if ( true === isset( $selected_button_array )
1634
+ && false === is_array( $selected_button_array )
1635
+ && true === is_array( $non_selected_buttons )
1636
+ ) {
1637
+ $arr_buttons = $non_selected_buttons;
1638
+ } elseif ( ! is_array( $non_selected_buttons ) && is_array( $selected_button_array ) ) {
1639
+ $arr_buttons = $selected_button_array;
1640
+ } elseif ( is_array( $selected_button_array ) && is_array( $non_selected_buttons ) ) {
1641
+ $arr_buttons = array_merge( $selected_button_array, $non_selected_buttons );
1642
+ }
1643
+
1644
+ // Plus buttons.
1645
+ if ( true === isset( $selected_plus_button_array )
1646
+ && false === is_array( $selected_plus_button_array )
1647
+ && true === is_array( $non_plus_selected_buttons )
1648
+ ) {
1649
+ $arr_plus_buttons = $non_plus_selected_buttons;
1650
+ } elseif ( ! is_array( $non_plus_selected_buttons ) && is_array( $selected_plus_button_array ) ) {
1651
+ $arr_plus_buttons = $selected_plus_button_array;
1652
+ } elseif ( is_array( $selected_plus_button_array ) && is_array( $non_plus_selected_buttons ) ) {
1653
+ $arr_plus_buttons = array_merge( $selected_plus_button_array, $non_plus_selected_buttons );
1654
+ }
1655
+
1656
+ // Bar buttons.
1657
+ if ( true === isset( $selected_bar_button_array )
1658
+ && false === is_array( $selected_bar_button_array )
1659
+ && true === is_array( $non_bar_selected_buttons )
1660
+ ) {
1661
+ $arr_bar_buttons = $non_bar_selected_buttons;
1662
+ } elseif ( ! is_array( $non_bar_selected_buttons ) && is_array( $selected_bar_button_array ) ) {
1663
+ $arr_bar_buttons = $selected_bar_button_array;
1664
+ } elseif ( is_array( $selected_bar_button_array ) && is_array( $non_bar_selected_buttons ) ) {
1665
+ $arr_bar_buttons = array_merge( $selected_bar_button_array, $non_bar_selected_buttons );
1666
+ }
1667
+
1668
+ // GDPR vendors.
1669
+ $vendor_data = $this->get_gdpr_vendors();
1670
+ $vendors = isset( $vendor_data['vendors'] ) ? $vendor_data['vendors'] : array();
1671
+ $purposes = isset( $vendor_data['purposes'] ) && is_array( $vendor_data['purposes'] ) ? array_column( $vendor_data['purposes'], 'name', 'id' ) : array();
1672
+
1673
+ include_once "{$this->plugin->dir_path}/templates/admin-panel.php";
1674
+ }
1675
+
1676
+ /**
1677
+ * Helper function to get gdpr vendors.
1678
+ */
1679
+ private function get_gdpr_vendors() {
1680
+ $response = wp_remote_get( 'https://vendorlist.consensu.org/v2/vendor-list.json' );
1681
+
1682
+ return json_decode( wp_remote_retrieve_body( $response ), true );
1683
+ }
1684
+
1685
+ /**
1686
+ * Get an html formatted of currently selected and ordered buttons.
1687
+ *
1688
+ * @param array $str_selected_ssba The selected buttons.
1689
+ * @param array $arr_settings The current ssba settings.
1690
+ *
1691
+ * @return string
1692
+ */
1693
+ public function get_selected_ssba( $str_selected_ssba, $arr_settings ) {
1694
+ // Variables.
1695
+ $html_selected_list = '';
1696
+
1697
+ // Prepare array of buttons.
1698
+ $arr_buttons = get_option( 'ssba_buttons', true );
1699
+
1700
+ // If there are some selected buttons.
1701
+ if ( '' !== $str_selected_ssba && null !== $str_selected_ssba && false !== $str_selected_ssba ) {
1702
+ // Explode saved include list and add to a new array.
1703
+ $arr_selected_ssba = explode( ',', $str_selected_ssba );
1704
+
1705
+ // Check if array is not empty.
1706
+ if ( '' !== $arr_selected_ssba ) {
1707
+ // For each included button.
1708
+ foreach ( $arr_selected_ssba as $str_selected ) {
1709
+ // If share this terms haven't been accepted and it's the
1710
+ // facebook save button then make the button look disabled.
1711
+ $disabled = 'Y' !== $arr_settings['accepted_sharethis_terms'] && 'facebook_save' === $str_selected ? 'style="background-color:#eaeaea;"' : null;
1712
+ $button_full_name = isset( $arr_buttons[ $str_selected ]['full_name'] ) ? $arr_buttons[ $str_selected ]['full_name'] : '';
1713
+
1714
+ // Add a list item for each selected option.
1715
+ $html_selected_list .= '<li class="ssbp-option-item" id="' . esc_attr( $str_selected ) . '"><a title="' . esc_attr( $button_full_name ) . '" class="ssbp-btn ssbp-' . esc_attr( $str_selected ) . '" ' . esc_attr( $disabled ) . '></a></li>';
1716
+ }
1717
+ }
1718
+ }
1719
+
1720
+ // Return html list options.
1721
+ return $html_selected_list;
1722
+ }
1723
+
1724
+ /**
1725
+ * Custom button key.
1726
+ *
1727
+ * @param array $arr_settings The current site settings.
1728
+ */
1729
+ public function get_custom_button_key( $arr_settings ) {
1730
+ $custom_array = array(
1731
+ 'facebook' => isset( $arr_settings['ssba_custom_facebook'] ) ? $arr_settings['ssba_custom_facebook'] : '',
1732
+ 'twitter' => isset( $arr_settings['ssba_custom_twitter'] ) ? $arr_settings['ssba_custom_twitter'] : '',
1733
+ 'linkedin' => isset( $arr_settings['ssba_custom_linkedin'] ) ? $arr_settings['ssba_custom_linkedin'] : '',
1734
+ 'flattr' => isset( $arr_settings['ssba_custom_flattr'] ) ? $arr_settings['ssba_custom_flattr'] : '',
1735
+ 'pinterest' => isset( $arr_settings['ssba_custom_pinterest'] ) ? $arr_settings['ssba_custom_pinterest'] : '',
1736
+ 'print' => isset( $arr_settings['ssba_custom_print'] ) ? $arr_settings['ssba_custom_print'] : '',
1737
+ 'reddit' => isset( $arr_settings['ssba_custom_reddit'] ) ? $arr_settings['ssba_custom_reddit'] : '',
1738
+ 'stumbleupon' => isset( $arr_settings['ssba_custom_stumbleupon'] ) ? $arr_settings['ssba_custom_stumbleupon'] : '',
1739
+ 'tumblr' => isset( $arr_settings['ssba_custom_tumblr'] ) ? $arr_settings['ssba_custom_tumblr'] : '',
1740
+ 'vk' => isset( $arr_settings['ssba_custom_vk'] ) ? $arr_settings['ssba_custom_vk'] : '',
1741
+ 'whatsapp' => isset( $arr_settings['ssba_custom_whatsapp'] ) ? $arr_settings['ssba_custom_whatsapp'] : '',
1742
+ 'xing' => isset( $arr_settings['ssba_custom_xing'] ) ? $arr_settings['ssba_custom_xing'] : '',
1743
+ 'yummly' => isset( $arr_settings['ssba_custom_yummly'] ) ? $arr_settings['ssba_custom_yummly'] : '',
1744
+ );
1745
+
1746
+ return $custom_array;
1747
+ }
1748
+
1749
+ /**
1750
+ * Get available share buttons.
1751
+ *
1752
+ * @param array $str_selected_ssba The selected buttons.
1753
+ * @param array $arr_settings The current ssba settings.
1754
+ * @param string $page Page string.
1755
+ *
1756
+ * @return string
1757
+ */
1758
+ public function get_available_ssba( $str_selected_ssba, $arr_settings, $page = '' ) {
1759
+ // Variables.
1760
+ $html_available_list = '';
1761
+
1762
+ // Prepare array of buttons.
1763
+ $arr_buttons = get_option( 'ssba_buttons', true );
1764
+ $arr_buttons = false === empty( $arr_buttons ) && true === is_array( $arr_buttons ) ? $arr_buttons : array();
1765
+
1766
+ // Explode saved include list and add to a new array.
1767
+ $arr_selected_ssba = explode( ',', $str_selected_ssba );
1768
+
1769
+ // Extract the available buttons.
1770
+ $arr_available_ssba = array_diff( array_keys( $arr_buttons ), $arr_selected_ssba );
1771
+
1772
+ // Check if array is not empty.
1773
+ if ( false === empty( $arr_selected_ssba ) ) {
1774
+ // For each included button.
1775
+ foreach ( $arr_available_ssba as $str_available ) {
1776
+ // If share this terms haven't been accepted and it's the facebook save button then make the button look disabled.
1777
+ $disabled = 'Y' !== $arr_settings['accepted_sharethis_terms'] && 'facebook_save' === $str_available ? 'style="background-color:#eaeaea;"' : null;
1778
+ if ( 'facebook_save' === $str_available && true === isset( $arr_settings['bar_call'] ) ) {
1779
+ $html_available_list .= ''; // Do nothing.
1780
+ } else {
1781
+ if ( self::show_in_classic( $page, $arr_buttons[ $str_available ]['full_name'] ) ) {
1782
+ // Add a list item for each available option.
1783
+ $html_available_list .= '<li class="ssbp-option-item" id="' . esc_attr( $str_available ) . '"><a title="' . esc_attr( $arr_buttons[ $str_available ]['full_name'] ) . '" class="ssbp-btn ssbp-' . esc_attr( $str_available ) . '" ' . esc_attr( $disabled ) . '></a></li>';
1784
+ }
1785
+ }
1786
+ }
1787
+ }
1788
+
1789
+ // Return html list options.
1790
+ return $html_available_list;
1791
+ }
1792
+
1793
+ /**
1794
+ * Show in classic button list or not.
1795
+ *
1796
+ * @param string $page Page.
1797
+ * @param string $button_name Button name.
1798
+ *
1799
+ * @return bool Show in classic?
1800
+ */
1801
+ public static function show_in_classic( $page, $button_name ) {
1802
+ if ( 'classic' !== $page ) {
1803
+ return true;
1804
+ }
1805
+
1806
+ if (
1807
+ false === in_array(
1808
+ $button_name,
1809
+ array( 'Line', 'Skype', 'Snapchat', 'Telegram', 'Weibo' ),
1810
+ true
1811
+ )
1812
+ ) {
1813
+ return true;
1814
+ }
1815
+
1816
+ return false;
1817
+ }
1818
+
1819
+ /**
1820
+ * Get ssbp font family.
1821
+ *
1822
+ * @return string
1823
+ */
1824
+ public function get_font_family() {
1825
+ return "@font-face {
1826
  font-family: 'ssbp';
1827
  src:url('{$this->plugin->dir_url}fonts/ssbp.eot?xj3ol1');
1828
  src:url('{$this->plugin->dir_url}fonts/ssbp.eot?#iefixxj3ol1') format('embedded-opentype'),
1836
  -webkit-font-smoothing: antialiased;
1837
  -moz-osx-font-smoothing: grayscale;
1838
  }";
1839
+ }
1840
+
1841
+ /**
1842
+ * Register button widget.
1843
+ *
1844
+ * @action widgets_init
1845
+ */
1846
+ public function register_widget() {
1847
+ register_widget( $this->widget_class );
1848
+ }
 
1849
  }
php/class-buttons.php CHANGED
@@ -12,2329 +12,2376 @@ namespace SimpleShareButtonsAdder;
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
- class Buttons
16
- {
17
-
18
- /**
19
- * Plugin instance.
20
- *
21
- * @var object
22
- */
23
- public $plugin;
24
-
25
- /**
26
- * Simple Share Buttons Adder instance.
27
- *
28
- * @var object
29
- */
30
- public $class_ssba;
31
-
32
- /**
33
- * Admin Panel Class.
34
- *
35
- * @var object
36
- */
37
- public $admin_panel;
38
-
39
- /**
40
- * Class constructor.
41
- *
42
- * @param object $plugin Plugin class.
43
- * @param object $class_ssba Simple Share Buttons Adder class.
44
- */
45
- public function __construct($plugin, $class_ssba, $admin_panel)
46
- {
47
- $this->plugin = $plugin;
48
- $this->class_ssba = $class_ssba;
49
- $this->admin_panel = $admin_panel;
50
- }
51
-
52
- /**
53
- * Enqueue font awesome.
54
- *
55
- * @action wp_enqueue_scripts
56
- */
57
- public function font_awesome()
58
- {
59
- wp_enqueue_style("{$this->plugin->assets_prefix}-font-awesome");
60
-
61
- $html_share_buttons_form = '';
62
-
63
- // Get settings.
64
- $arr_settings = $this->class_ssba->get_ssba_settings();
65
-
66
- // Get the font family needed.
67
- $html_share_buttons_form .= $this->admin_panel->get_font_family();
68
-
69
- // If left to right.
70
- if (is_rtl()) {
71
- // Move save button.
72
- $html_share_buttons_form .= '.ssba-btn-save{ left: 0!important;
73
  right: auto !important;
74
  border-radius: 0 5px 5px 0; }';
75
- }
76
-
77
- wp_add_inline_style("{$this->plugin->assets_prefix}-ssba", $html_share_buttons_form);
78
- }
79
-
80
- /**
81
- * Format the returned number.
82
- *
83
- * @param integer $int_number The number to format.
84
- *
85
- * @return string
86
- */
87
- public function ssba_format_number($int_number)
88
- {
89
- // If the number is greater than or equal to 1000.
90
- if ($int_number >= 1000) {
91
- // Divide by 1000 and add k.
92
- $int_number = round(($int_number / 1000), 1) . 'k';
93
- }
94
-
95
- // Return the number.
96
- return $int_number;
97
- }
98
-
99
- /**
100
- * Adds a filter around the content.
101
- *
102
- * @action wp_head, 99
103
- */
104
- public function ssba_add_button_filter()
105
- {
106
- $arr_settings = $this->class_ssba->get_ssba_settings();
107
-
108
- add_filter('the_content', array($this, 'show_share_buttons'), (int)$arr_settings['ssba_content_priority']);
109
-
110
- // If we wish to add to excerpts.
111
- if (isset($arr_settings['ssba_excerpts']) && 'Y' !== $arr_settings['ssba_excerpts']) {
112
- add_filter('the_excerpt', array($this, 'show_share_buttons'));
113
- }
114
- }
115
-
116
- /**
117
- * Call back for showing share buttons.
118
- *
119
- * @param string $content The current page or post content.
120
- * @param bool $boo_shortcode Whether to use shortcode or not.
121
- * @param array $atts Manual replacements for page url/title.
122
- *
123
- * @return string
124
- */
125
- public function show_share_buttons($content, $boo_shortcode = false, $atts = '')
126
- {
127
- global $post;
128
-
129
- // Variables.
130
- $html_content = $content;
131
- $str_share_text = '';
132
- $pattern = get_shortcode_regex();
133
-
134
- // Ssba_hide shortcode is in the post content and instance is not called by shortcode ssba.
135
- if (isset($post->post_content)
136
- &&
137
- preg_match_all('/' . $pattern . '/s', $post->post_content, $matches)
138
- &&
139
- array_key_exists(2, $matches)
140
- &&
141
- in_array('ssba_hide', $matches[2], true)
142
- &&
143
- ! $boo_shortcode
144
- ) {
145
- // Exit the function returning the content without the buttons.
146
- return $content;
147
- }
148
-
149
- // Get sbba settings.
150
- $arr_settings = $this->class_ssba->get_ssba_settings();
151
-
152
- $page_title = $post->post_title;
153
- $plus_omit_pages = ! empty($arr_settings['ssba_omit_pages_plus']) ? explode(',', $arr_settings['ssba_omit_pages_plus']) : '';
154
- $plus_omitted = is_array($plus_omit_pages) ? in_array($page_title, array_map('trim', $plus_omit_pages), true) : false;
155
- $omit_pages = ! empty($arr_settings['ssba_omit_pages']) ? explode(',', $arr_settings['ssba_omit_pages']) : '';
156
- $omitted = is_array($omit_pages) ? in_array($page_title, array_map('trim', $omit_pages), true) : false;
157
-
158
- if (('Y' === $arr_settings['ssba_new_buttons'] && $plus_omitted) || ('Y' !== $arr_settings['ssba_new_buttons'] && $omitted)) {
159
- return $content;
160
- }
161
-
162
- // Placement on pages/posts/categories/archives/homepage.
163
- if (( ! is_home() && ! is_front_page() && is_page() && ('Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_pages'] || ('Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_pages'])))
164
- ||
165
- (is_single() && ('Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_posts'] || ('Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_posts'])))
166
- ||
167
- (is_category() && ('Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_cats_archs'] || ('Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_cats_archs'])))
168
- ||
169
- (is_archive() && ('Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_cats_archs'] || ('Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_cats_archs'])))
170
- ||
171
- ((is_home() || is_front_page()) && ('Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_homepage'] || ('Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_homepage'])))
172
- ||
173
- $boo_shortcode
174
- ) {
175
- wp_enqueue_style("{$this->plugin->assets_prefix}-ssba");
176
-
177
- // If not shortcode.
178
- if (isset($atts['widget']) && 'Y' === $atts['widget'] && '' === $arr_settings['ssba_widget_text']) { // Use widget share text.
179
- $str_share_text = $arr_settings['ssba_widget_text'];
180
- } else { // Use normal share text.
181
- $str_share_text = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_share_text'] : $arr_settings['ssba_plus_share_text'];
182
- }
183
-
184
- // Text placement.
185
- $text_placement = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_text_placement'] : $arr_settings['ssba_plus_text_placement'];
186
-
187
- // Link or no.
188
- $text_link = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_link_to_ssb'] : $arr_settings['ssba_plus_link_to_ssb'];
189
-
190
- // Post id.
191
- $int_post_id = $post->ID;
192
-
193
- // Button Position.
194
- $button_position = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_before_or_after'] : $arr_settings['ssba_before_or_after_plus'];
195
-
196
- // Button alignment
197
- $alignment = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_align'] : $arr_settings['ssba_plus_align'];
198
-
199
- // Wrap id
200
- $wrap_id = 'Y' !== $arr_settings['ssba_new_buttons'] ? 'ssba-classic-2' : 'ssba-modern-2';
201
-
202
- // Ssba div.
203
- $html_share_buttons = '<!-- Simple Share Buttons Adder (' . esc_html(SSBA_VERSION) . ') simplesharebuttons.com --><div class="' . esc_attr($wrap_id) . ' ssba ssbp-wrap' . esc_attr(' ' . $arr_settings['ssba_plus_align']) . ' ssbp--theme-' . esc_attr($arr_settings['ssba_plus_button_style']) . '">';
204
-
205
- // Center if set so.
206
- $html_share_buttons .= '<div style="text-align:' . esc_attr($alignment) . '">';
207
-
208
- // Add custom text if set and set to placement above or left.
209
- if ('' !== $str_share_text && ('above' === $text_placement || 'left' === $text_placement)) {
210
- // Check if user has left share link box checked.
211
- if ('Y' === $text_link) {
212
- // Share text with link.
213
- $html_share_buttons .= '<a href="https://simplesharebuttons.com" target="_blank" class="ssba-share-text">' . esc_html($str_share_text) . '</a>';
214
- } else {
215
- // Share text.
216
- $html_share_buttons .= '<span class="ssba-share-text">' . esc_html($str_share_text) . '</span>';
217
- }
218
- // Add a line break if set to above.
219
- $html_share_buttons .= 'above' === $text_placement ? '<br/>' : '';
220
- }
221
-
222
- // If running standard.
223
- if ( ! $boo_shortcode) {
224
- // Use WordPress functions for page/post details.
225
- $url_current_page = get_permalink($post->ID);
226
- $str_page_title = get_the_title($post->ID);
227
- } else { // Using shortcode.
228
- // Set page URL and title as set by user or get if needed.
229
- $url_current_page = isset($atts['url']) ? esc_url($atts['url']) : $this->ssba_current_url($atts);
230
- $str_page_title = (isset($atts['title']) ? $atts['title'] : get_the_title());
231
- }
232
-
233
- // Strip any unwanted tags from the page title.
234
- $str_page_title = esc_attr(strip_tags($str_page_title));
235
-
236
- // The buttons.
237
- $html_share_buttons .= $this->get_share_buttons($arr_settings, $url_current_page, $str_page_title, $int_post_id);
238
-
239
- // Add custom text if set and set to placement right or below.
240
- if ('' !== $str_share_text && ('right' === $text_placement || 'below' === $text_placement)) {
241
- // Add a line break if set to above.
242
- $html_share_buttons .= 'below' === $text_placement ? '<br/>' : '';
243
-
244
- // Check if user has checked share link option.
245
- if ('Y' === $text_link) {
246
- // Share text with link.
247
- $html_share_buttons .= '<a href="https://simplesharebuttons.com" target="_blank" class="ssba-share-text">' . esc_html($str_share_text) . '</a>';
248
- } else { // Just display the share text.
249
- // Share text.
250
- $html_share_buttons .= '<span class="ssba-share-text">' . esc_html($str_share_text) . '</span>';
251
- }
252
- }
253
-
254
- // Close center if set.
255
- $html_share_buttons .= '</div></div>';
256
-
257
- // If not using shortcode.
258
- if ( ! $boo_shortcode) {
259
- // Switch for placement of ssba.
260
- switch ($button_position) {
261
- case 'before': // Before the content.
262
- $html_content = $html_share_buttons . $content;
263
- break;
264
- case 'after': // After the content.
265
- $html_content = $content . $html_share_buttons;
266
- break;
267
- case 'both': // Before and after the content.
268
- $html_content = $html_share_buttons . $content . $html_share_buttons;
269
- break;
270
- }
271
- } else { // If using shortcode.
272
- // Just return buttons.
273
- $html_content = $html_share_buttons;
274
- }
275
- }
276
-
277
- // Return content and share buttons.
278
- return $html_content;
279
- }
280
-
281
- /**
282
- * Function that shows the share bar if enabled.
283
- *
284
- * @action wp_head, 99
285
- */
286
- public function show_share_bar()
287
- {
288
- global $post, $wp;
289
-
290
- // Get sbba settings.
291
- $arr_settings = $this->class_ssba->get_ssba_settings();
292
- $page_title = isset($post->post_title) ? $post->post_title : '';
293
- $omit_pages = ! empty($arr_settings['ssba_omit_pages_bar']) ? explode(',',
294
- $arr_settings['ssba_omit_pages_bar']) : '';
295
- $omitted = is_array($omit_pages) ? in_array($page_title, array_map('trim', $omit_pages), true) : false;
296
-
297
- if (('Y' !== $arr_settings['ssba_bar_desktop'] && ! wp_is_mobile()) || ('Y' !== $arr_settings['ssba_bar_mobile'] && wp_is_mobile()) || 'Y' !== $arr_settings['ssba_bar_enabled'] || $omitted) {
298
- return;
299
- }
300
-
301
- // Get current url.
302
- $url_current_page = home_url(add_query_arg(array(), $wp->request));
303
-
304
- // Placement on pages/posts/categories/archives/homepage.
305
- if (
306
- ( ! is_home() && ! is_front_page() && is_page() && isset($arr_settings['ssba_bar_pages']) && 'Y' === $arr_settings['ssba_bar_pages'])
307
- ||
308
- (is_single() && isset($arr_settings['ssba_bar_posts']) && 'Y' === $arr_settings['ssba_bar_posts'])
309
- ||
310
- (is_category() && isset($arr_settings['ssba_bar_cats_archs']) && 'Y' === $arr_settings['ssba_bar_cats_archs'])
311
- ||
312
- (is_archive() && isset($arr_settings['ssba_bar_cats_archs']) && 'Y' === $arr_settings['ssba_bar_cats_archs'])
313
- ||
314
- ((is_home() || is_front_page()) && isset($arr_settings['ssba_bar_homepage']) && 'Y' === $arr_settings['ssba_bar_homepage'])
315
- ) {
316
-
317
- if ( ! wp_style_is("{$this->plugin->assets_prefix}-ssba", 'enqueued')) {
318
- wp_enqueue_style("{$this->plugin->assets_prefix}-ssba");
319
- }
320
-
321
- $html_share_buttons = '<div id="ssba-bar-2" class="' . esc_attr($arr_settings['ssba_bar_position']) . ' ssbp-wrap ssbp--theme-' . esc_attr($arr_settings['ssba_bar_style']) . '" >';
322
- $html_share_buttons .= '<div class="ssbp-container">';
323
- $html_share_buttons .= '<ul class="ssbp-bar-list">';
324
-
325
- // The buttons.
326
- $html_share_buttons .= $this->get_share_bar($arr_settings, $url_current_page, $post->post_title, $post->ID);
327
- $html_share_buttons .= '</div></ul>';
328
- $html_share_buttons .= '</div>';
329
-
330
- echo $html_share_buttons; // WPCS: XSS ok. Pinterest contains javascript cannot sanitize output.
331
- }
332
- }
333
-
334
- /**
335
- * Shortcode for adding buttons.
336
- *
337
- * @param array $atts The current shortcodes attributes.
338
- *
339
- * @shortcode ssba-buttons
340
- *
341
- * @return string
342
- */
343
- public function ssba_buttons($atts)
344
- {
345
- // Get buttons - NULL for $content, TRUE for shortcode flag.
346
- $html_share_buttons = $this->show_share_buttons(null, true, $atts);
347
-
348
- // Return buttons.
349
- return $html_share_buttons;
350
- }
351
-
352
- /**
353
- * Shortcode for adding buttons.
354
- *
355
- * @param array $atts The current shortcodes attributes.
356
- *
357
- * @shortcode ssba
358
- *
359
- * @return string
360
- */
361
- public function ssba_orig_buttons($atts)
362
- {
363
- // Get buttons - NULL for $content, TRUE for shortcode flag.
364
- $html_share_buttons = $this->show_share_buttons(null, true, $atts);
365
-
366
- // Return buttons.
367
- return $html_share_buttons;
368
- }
369
-
370
- /**
371
- * Shortcode for hiding buttons
372
- *
373
- * @param string $content The current page or posts content.
374
- *
375
- * @shortcode ssba_hide
376
- */
377
- public function ssba_hide($content)
378
- {
379
- // No need to do anything here!
380
- }
381
-
382
- /**
383
- * Get URL function.
384
- *
385
- * @param array $atts The supplied attributes.
386
- *
387
- * @return string
388
- */
389
- public function ssba_current_url($atts)
390
- {
391
- global $post;
392
-
393
- if (! isset($_SERVER['SERVER_NAME']) || ! isset($_SERVER['REQUEST_URI'])) {
394
- return;
395
- }
396
-
397
- // If multisite has been set to true.
398
- if (isset($atts['multisite']) && isset($_SERVER['QUERY_STRING'])) {
399
- global $wp;
400
-
401
- $url = add_query_arg(sanitize_text_field(wp_unslash($_SERVER['QUERY_STRING'])), '', home_url($wp->request)); // WPCS: CSRF ok.
402
-
403
- return esc_url($url);
404
- }
405
-
406
- // Add http.
407
- $url_current_page = 'http';
408
-
409
- // Add s to http if required.
410
- if (isset($_SERVER['HTTPS']) && 'on' === $_SERVER['HTTPS']) {
411
- $url_current_page .= 's';
412
- }
413
-
414
- // Add colon and forward slashes.
415
- $url_current_page .= '://' . sanitize_text_field(wp_unslash($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']));
416
-
417
- $url_current_page = '_' === $_SERVER['SERVER_NAME'] ? get_permalink($post->ID) : $url_current_page;
418
-
419
- // Return url.
420
- return esc_url($url_current_page);
421
- }
422
-
423
- /**
424
- * Get set share buttons.
425
- *
426
- * @param array $arr_settings The current ssba settings.
427
- * @param string $url_current_page The current pages url.
428
- * @param string $str_page_title The page title.
429
- * @param integer $int_post_id The post id.
430
- *
431
- * @return string
432
- */
433
- public function get_share_buttons($arr_settings, $url_current_page, $str_page_title, $int_post_id)
434
- {
435
- // Variables.
436
- $html_share_buttons = '';
437
-
438
- // Explode saved include list and add to a new array.
439
- $arr_selected_ssba = 'Y' === $arr_settings['ssba_new_buttons'] ? explode(',', $arr_settings['ssba_selected_plus_buttons']) : explode(',', $arr_settings['ssba_selected_buttons']);
440
-
441
- // Check if array is not empty.
442
- if (is_array($arr_selected_ssba) && '' !== $arr_selected_ssba[0]) {
443
- // Add post ID to settings array.
444
- $arr_settings['post_id'] = $int_post_id;
445
-
446
- // If show counters option is selected.
447
- if ('Y' === $arr_settings['ssba_show_share_count']) {
448
- // Set show flag to true.
449
- $boo_show_share_count = true;
450
-
451
- // If show counters once option is selected.
452
- if ('Y' === $arr_settings['ssba_share_count_once']) {
453
- // If not a page or post.
454
- if (! is_page() && ! is_single()) {
455
- // Let show flag to false.
456
- $boo_show_share_count = false;
457
- }
458
- }
459
- } else {
460
- // Set show flag to false.
461
- $boo_show_share_count = false;
462
- }
463
-
464
- if ('Y' === $arr_settings['ssba_new_buttons']) {
465
- $html_share_buttons .= '<ul class="ssbp-list">';
466
- }
467
-
468
- // For each included button.
469
- foreach ($arr_selected_ssba as $str_selected) {
470
- $str_get_button = 'ssba_' . $str_selected;
471
-
472
- // Add a list item for each selected option.
473
- $html_share_buttons .= $this->$str_get_button($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count);
474
- }
475
-
476
- if ('Y' === $arr_settings['ssba_new_buttons']) {
477
- $html_share_buttons .= '</ul>';
478
- }
479
- } // End if().
480
-
481
- // Return share buttons.
482
- return $html_share_buttons;
483
- }
484
-
485
- /**
486
- * Get facebook button.
487
- *
488
- * @param array $arr_settings The current ssba settings.
489
- * @param string $url_current_page The current page url.
490
- * @param string $str_page_title The page title.
491
- * @param bool $boo_show_share_count Show share count or not.
492
- *
493
- * @return string
494
- */
495
- public function ssba_facebook($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
496
- {
497
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
498
- $network = 'Facebook';
499
- $target =
500
- ('Y' === $arr_settings['ssba_plus_share_new_window']
501
- && 'Y' === $arr_settings['ssba_new_buttons']
502
- && ! isset($arr_settings['bar_call']
503
- ))
504
- ||
505
- ('Y' === $arr_settings['ssba_share_new_window']
506
- && 'Y' !== $arr_settings['ssba_new_buttons']
507
- && ! isset($arr_settings['bar_call']
508
- ))
509
- ||
510
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call'])) ? ' target="_blank" ' : '';
511
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-facebook ssbp-btn' : '';
512
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
513
- $html_share_buttons = '';
514
-
515
- // Add li if plus.
516
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
517
- $html_share_buttons .= '<li class="ssbp-li--facebook">';
518
- }
519
-
520
- // If the sharethis terms have been accepted.
521
- if ('Y' === $arr_settings['accepted_sharethis_terms'] && '' !== $arr_settings['facebook_app_id']) {
522
- // Facebook share link.
523
- $html_share_buttons .= '<a data-site="" data-facebook="mobile" class="ssba_facebook_share' . esc_attr($plus_class) . '" data-href="' . esc_attr($url_current_page) . '" href="https://www.facebook.com/dialog/share?app_id=' . esc_attr($arr_settings['facebook_app_id']) . '&display=popup&href=' . esc_attr($url_current_page) . '&redirect_uri=' . esc_url($url_current_page) . '" ' . esc_attr($target . $nofollow) . '>';
524
- } else {
525
- // Facebook share link.
526
- $html_share_buttons .= '<a data-site="" class="ssba_facebook_share' . esc_attr($plus_class) . '" href="http://www.facebook.com/sharer.php?u=' . esc_attr($url_current_page) . '" ' . $target . $nofollow . '>';
527
- }
528
-
529
- // If not using custom.
530
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
531
- // Show selected ssba image.
532
- $html_share_buttons .= '<img src="' . esc_url(plugins_url()) . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/facebook.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Facebook" class="ssba ssba-img" alt="Share on Facebook" />';
533
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
534
- // Show custom image.
535
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_facebook']) . '" title="Facebook" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" class="ssba ssba-img" alt="Share on Facebook" />';
536
- }
537
-
538
- // Close href.
539
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
540
-
541
- // Close href.
542
- $html_share_buttons .= '</a>';
543
-
544
- // If show share count is set to Y.
545
- if ((('Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'])
546
- ||
547
- ('Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'])
548
- ||
549
- ('Y' === $arr_settings['ssba_bar_show_share_count'] && isset($arr_settings['bar_call'])
550
- )
551
- && $boo_show_share_count
552
- )) {
553
- // Get and add facebook share count.
554
- $html_share_buttons .= '<span class="' . esc_attr($count_class) . '">' . esc_html($this->get_facebook_share_count($url_current_page, $arr_settings)) . '</span>';
555
- }
556
-
557
- // Add closing li if plus.
558
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
559
- $html_share_buttons .= '</li>';
560
- }
561
-
562
- // Return share buttons.
563
- return $html_share_buttons;
564
- }
565
-
566
- /**
567
- * Get set share buttons.
568
- *
569
- * @param array $arr_settings The current ssba settings.
570
- * @param string $url_current_page The current pages url.
571
- * @param string $str_page_title The page title.
572
- * @param integer $int_post_id The post id.
573
- *
574
- * @return string
575
- */
576
- public function get_share_bar($arr_settings, $url_current_page, $str_page_title, $int_post_id)
577
- {
578
- // Variables.
579
- $html_share_buttons = '';
580
-
581
- // Set bar call.
582
- $arr_settings = array_merge($arr_settings, array(
583
- 'bar_call' => 'Y',
584
- )
585
- );
586
-
587
- // Explode saved include list and add to a new array.
588
- $arr_selected_ssba = explode(',', $arr_settings['ssba_selected_bar_buttons']);
589
-
590
- // Check if array is not empty.
591
- if ('' !== $arr_settings['ssba_selected_bar_buttons']) {
592
- // Add post ID to settings array.
593
- $arr_settings['post_id'] = $int_post_id;
594
-
595
- // If show counters option is selected.
596
- if ('Y' === $arr_settings['ssba_bar_show_share_count']) {
597
- // Set show flag to true.
598
- $boo_show_share_count = true;
599
-
600
- // If show counters once option is selected.
601
- if (isset($arr_settings['ssba_bar_count_once']) && 'Y' === $arr_settings['ssba_bar_count_once']) {
602
- // If not a page or post.
603
- if (! is_page() && ! is_single()) {
604
- // Let show flag to false.
605
- $boo_show_share_count = false;
606
- }
607
- }
608
- } else {
609
- // Set show flag to false.
610
- $boo_show_share_count = false;
611
- }
612
-
613
- // For each included button.
614
- foreach ($arr_selected_ssba as $str_selected) {
615
- if ('' !== $str_selected) {
616
- $str_get_button = 'ssba_' . $str_selected;
617
-
618
- // Add a list item for each selected option.
619
- $html_share_buttons .= $this->$str_get_button($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count);
620
- }
621
- }
622
- }
623
-
624
- // Return share buttons.
625
- return $html_share_buttons;
626
- }
627
-
628
- /**
629
- * Get facebook button.
630
- *
631
- * @param array $arr_settings The current ssba settings.
632
- * @param string $url_current_page The current page url.
633
- * @param string $str_page_title The page title.
634
- * @param bool $boo_show_share_count Show share count or not.
635
- *
636
- * @return string
637
- */
638
- public function ssba_facebook_save($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
639
- {
640
- $html_share_buttons = '';
641
-
642
- // If the sharethis terms have been accepted.
643
- if ('Y' === $arr_settings['accepted_sharethis_terms'] && ! isset($arr_settings['bar_call'])) {
644
- // Add li if plus.
645
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
646
- $html_share_buttons .= '<li class="ssbp-li--fb-save">';
647
- }
648
-
649
- // Add facebook save button.
650
- $html_share_buttons .= '<span class="fb-save" style="display:inline-block" data-uri="' . esc_attr($url_current_page) . '"></span>';
651
-
652
- // Add li if plus.
653
- if ('Y' === $arr_settings['ssba_new_buttons'] || $arr_settings['bar_call']) {
654
- $html_share_buttons .= '</li>';
655
- }
656
- }
657
-
658
- return $html_share_buttons;
659
- }
660
-
661
- /**
662
- * Get facebook share count.
663
- *
664
- * @param string $url_current_page Current url.
665
- * @param array $arr_settings Current ssba settings.
666
- *
667
- * @return string
668
- */
669
- public function get_facebook_share_count($url_current_page, $arr_settings)
670
- {
671
- $cache_key = sprintf(
672
- 'facebook_sharecount_%s',
673
- wp_hash($url_current_page)
674
- );
675
-
676
- // Get the longer cached value from the Transient API.
677
- $long_cached_count = get_transient("ssba_{$cache_key}");
678
- if (false === $long_cached_count) {
679
- $long_cached_count = 0;
680
- }
681
-
682
- // If sharedcount.com is enabled.
683
- if ((('Y' === $arr_settings['sharedcount_enabled'] && 'Y' !== $arr_settings['ssba_new_buttons'])
684
- ||
685
- (isset($arr_settings['plus_sharedcount_enabled']) && 'Y' === $arr_settings['plus_sharedcount_enabled'] && 'Y' === $arr_settings['ssba_new_buttons'])
686
- ||
687
- (isset($arr_settings['bar_sharedcount_enabled']) && 'Y' === $arr_settings['bar_sharedcount_enabled'] && isset($arr_settings['bar_call'])
688
- )
689
- )) {
690
-
691
- $shared_plan = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['sharedcount_plan'] : '';
692
- $shared_plan = '' === $shared_plan && 'Y' === $arr_settings['ssba_new_buttons'] ? $arr_settings['plus_sharedcount_plan'] : '';
693
- $shared_plan = isset($arr_settings['bar_call']) ? $arr_settings['bar_sharedcount_plan'] : '';
694
-
695
- // Request from sharedcount.com.
696
- $sharedcount = wp_safe_remote_get('https://' . $shared_plan . '.sharedcount.com/url?url=' . $url_current_page . '&apikey=' . $arr_settings['sharedcount_api_key'],
697
- array(
698
- 'timeout' => 6,
699
- ));
700
-
701
- // If no error.
702
- if (is_wp_error($sharedcount)) {
703
- return $this->ssba_format_number($long_cached_count);
704
- }
705
-
706
- // Decode and return count.
707
- $shared_resp = json_decode($sharedcount['body'], true);
708
- $sharedcount = $long_cached_count;
709
-
710
- if (isset($shared_resp['Facebook']['share_count'])) {
711
- $sharedcount = (int)$shared_resp['Facebook']['share_count'];
712
- wp_cache_set($cache_key, $sharedcount, 'ssba', MINUTE_IN_SECONDS * 2);
713
- set_transient("ssba_{$cache_key}", $sharedcount, DAY_IN_SECONDS);
714
- }
715
-
716
- return $this->ssba_format_number($sharedcount);
717
- } else {
718
- // Get results from facebook.
719
- $html_facebook_share_details = wp_safe_remote_get('http://graph.facebook.com/' . $url_current_page, array(
720
- 'timeout' => 6,
721
- ));
722
-
723
- // If no error.
724
- if (is_wp_error($html_facebook_share_details)) {
725
- return $this->ssba_format_number($long_cached_count);
726
- }
727
-
728
- // Decode and return count.
729
- $arr_facebook_share_details = json_decode($html_facebook_share_details['body'], true);
730
- $int_facebook_share_count = $long_cached_count;
731
-
732
- if (isset($arr_facebook_share_details['share']['share_count'])) {
733
- $int_facebook_share_count = (int)$arr_facebook_share_details['share']['share_count'];
734
-
735
- wp_cache_set($cache_key, $int_facebook_share_count, 'ssba', MINUTE_IN_SECONDS * 2);
736
- set_transient("ssba_{$cache_key}", $int_facebook_share_count, DAY_IN_SECONDS);
737
- }
738
-
739
- return $this->ssba_format_number($int_facebook_share_count);
740
- } // End if().
741
- }
742
-
743
- /**
744
- * Get twitter button.
745
- *
746
- * @param array $arr_settings The current ssba settings.
747
- * @param string $url_current_page The current page url.
748
- * @param string $str_page_title The page title.
749
- * @param bool $boo_show_share_count Show share count or not.
750
- *
751
- * @return string
752
- */
753
- public function ssba_twitter($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
754
- {
755
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
756
- $network = 'Twitter';
757
- $target =
758
- ('Y' === $arr_settings['ssba_plus_share_new_window']
759
- && 'Y' === $arr_settings['ssba_new_buttons']
760
- && ! isset($arr_settings['bar_call']
761
- ))
762
- ||
763
- ('Y' === $arr_settings['ssba_share_new_window']
764
- && 'Y' !== $arr_settings['ssba_new_buttons']
765
- && ! isset($arr_settings['bar_call']
766
- ))
767
- ||
768
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call']
769
- )) ? ' target="_blank" ' : '';
770
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-twitter ssbp-btn' : '';
771
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
772
- $html_share_buttons = '';
773
-
774
- // Format the URL into friendly code.
775
- $twitter_share_text = rawurlencode(html_entity_decode($str_page_title . ' ' . $arr_settings['ssba_twitter_text'],
776
- ENT_COMPAT, 'UTF-8'));
777
-
778
- // Add li if plus.
779
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
780
- $html_share_buttons .= '<li class="ssbp-li--twitter">';
781
- }
782
-
783
- if ('Y' === $arr_settings['ssba_new_buttons'] && ! empty($arr_settings['ssba_plus_twitter_text'])) {
784
- $twitter_share_text = rawurlencode(html_entity_decode($str_page_title . ' ' . $arr_settings['ssba_plus_twitter_text'],
785
- ENT_COMPAT, 'UTF-8'));
786
- }
787
-
788
- if (isset($arr_settings['bar_call']) && ! empty($arr_settings['ssba_bar_twitter_text'])) {
789
- $twitter_share_text = rawurlencode(html_entity_decode($str_page_title . ' ' . $arr_settings['ssba_bar_twitter_text'],
790
- ENT_COMPAT, 'UTF-8'));
791
- }
792
-
793
- // Twitter share link.
794
- $html_share_buttons .= '<a data-site="" class="ssba_twitter_share' . esc_attr($plus_class) . '" href="http://twitter.com/share?url=' . esc_attr($url_current_page) . '&amp;text=' . esc_attr($twitter_share_text) . '" ' . esc_attr($target . $nofollow) . '>';
795
-
796
- // If image set is not custom.
797
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
798
- // Show ssba image.
799
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/twitter.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Twitter" class="ssba ssba-img" alt="Tweet about this on Twitter" />';
800
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
801
- // Show custom image.
802
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_twitter']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Twitter" class="ssba ssba-img" alt="Tweet about this on Twitter" />';
803
- }
804
-
805
- // Close href.
806
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
807
-
808
- // Close href.
809
- $html_share_buttons .= '</a>';
810
-
811
- // Add closing li if plus.
812
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
813
- $html_share_buttons .= '</li>';
814
- }
815
-
816
- // Return share buttons.
817
- return $html_share_buttons;
818
- }
819
-
820
- /**
821
- * Get google+ button.
822
- *
823
- * @param array $arr_settings The current ssba settings.
824
- * @param string $url_current_page The current page url.
825
- * @param string $str_page_title The page title.
826
- * @param bool $boo_show_share_count Show share count or not.
827
- *
828
- * @return string
829
- */
830
- public function ssba_google($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
831
- {
832
- return;
833
- }
834
-
835
- /**
836
- * Get google share count.
837
- *
838
- * @param string $url_current_page The current page url.
839
- *
840
- * @return string
841
- */
842
- public function get_google_share_count($url_current_page)
843
- {
844
- return;
845
- }
846
-
847
- /**
848
- * Get diggit button.
849
- *
850
- * @param array $arr_settings The current ssba settings.
851
- * @param string $url_current_page The current page url.
852
- * @param string $str_page_title The page title.
853
- * @param bool $boo_show_share_count Show share count or not.
854
- *
855
- * @return string
856
- */
857
- public function ssba_diggit($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
858
- {
859
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
860
- $network = 'Digg';
861
- $target =
862
- ('Y' === $arr_settings['ssba_plus_share_new_window']
863
- && 'Y' === $arr_settings['ssba_new_buttons']
864
- && ! isset($arr_settings['bar_call']
865
- ))
866
- ||
867
- ('Y' === $arr_settings['ssba_share_new_window']
868
- && 'Y' !== $arr_settings['ssba_new_buttons']
869
- && ! isset($arr_settings['bar_call']
870
- ))
871
- ||
872
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call']
873
- )) ? ' target="_blank" ' : '';
874
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-diggit ssbp-btn' : '';
875
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
876
- $html_share_buttons = '';
877
-
878
- // Add li if plus.
879
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
880
- $html_share_buttons .= '<li class="ssbp-li--diggit">';
881
- }
882
-
883
- // Diggit share link.
884
- $html_share_buttons .= '<a data-site="digg" class="ssba_diggit_share ssba_share_link' . esc_attr($plus_class) . '" href="http://www.digg.com/submit?url=' . esc_attr($url_current_page) . '" ' . esc_attr($target . $nofollow) . '>';
885
-
886
- // If image set is not custom.
887
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
888
- // Show ssba image.
889
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/diggit.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Digg" class="ssba ssba-img" alt="Digg this" />';
890
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
891
- // Show custom image.
892
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_diggit']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Digg" class="ssba ssba-img" alt="Digg this" />';
893
- }
894
-
895
- // Close href.
896
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
897
-
898
- // Close href.
899
- $html_share_buttons .= '</a>';
900
-
901
- // Add closing li if plus.
902
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
903
- $html_share_buttons .= '</li>';
904
- }
905
-
906
- // Return share buttons.
907
- return $html_share_buttons;
908
- }
909
-
910
- /**
911
- * Get line button.
912
- *
913
- * @param array $arr_settings The current ssba settings.
914
- * @param string $url_current_page The current page url.
915
- * @param string $str_page_title The page title.
916
- * @param bool $boo_show_share_count Show share count or not.
917
- *
918
- * @return string
919
- */
920
- public function ssba_line($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
921
- {
922
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
923
- $network = 'Line';
924
- $target =
925
- ('Y' === $arr_settings['ssba_plus_share_new_window']
926
- && 'Y' === $arr_settings['ssba_new_buttons']
927
- && ! isset($arr_settings['bar_call']))
928
- ||
929
- ('Y' === $arr_settings['ssba_share_new_window']
930
- && 'Y' !== $arr_settings['ssba_new_buttons']
931
- && ! isset($arr_settings['bar_call']))
932
- ||
933
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call'])) ? ' target="_blank" ' : '';
934
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-line ssbp-btn' : '';
935
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
936
- $html_share_buttons = '';
937
-
938
- // Add li if plus.
939
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
940
- $html_share_buttons .= '<li class="ssbp-li--line">';
941
- }
942
-
943
- // Line share link.
944
- $html_share_buttons .= '<a data-site="line" class="ssba_line_share ssba_share_link' . esc_attr($plus_class) . '" href="https://lineit.line.me/share/ui?url=' . esc_attr($url_current_page) . '" ' . esc_attr($target . $nofollow) . '>';
945
-
946
- // If image set is not custom.
947
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
948
- // Show ssba image.
949
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/line.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Line" class="ssba ssba-img" alt="Line" />';
950
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
951
- // Show custom image.
952
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_line']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Line" class="ssba ssba-img" alt="Line" />';
953
- }
954
-
955
- // Close href.
956
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
957
-
958
- // Close href.
959
- $html_share_buttons .= '</a>';
960
-
961
- // Add closing li if plus.
962
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
963
- $html_share_buttons .= '</li>';
964
- }
965
-
966
- // Return share buttons.
967
- return $html_share_buttons;
968
- }
969
-
970
- /**
971
- * Get skype button.
972
- *
973
- * @param array $arr_settings The current ssba settings.
974
- * @param string $url_current_page The current page url.
975
- * @param string $str_page_title The page title.
976
- * @param bool $boo_show_share_count Show share count or not.
977
- *
978
- * @return string
979
- */
980
- public function ssba_skype($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
981
- {
982
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
983
- $network = 'Line';
984
- $target =
985
- ('Y' === $arr_settings['ssba_plus_share_new_window']
986
- && 'Y' === $arr_settings['ssba_new_buttons']
987
- && ! isset($arr_settings['bar_call']))
988
- ||
989
- ('Y' === $arr_settings['ssba_share_new_window']
990
- && 'Y' !== $arr_settings['ssba_new_buttons']
991
- && ! isset($arr_settings['bar_call']))
992
- ||
993
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call'])) ? ' target="_blank" ' : '';
994
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-skype ssbp-btn' : '';
995
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
996
- $html_share_buttons = '';
997
-
998
- // Add li if plus.
999
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1000
- $html_share_buttons .= '<li class="ssbp-li--skype">';
1001
- }
1002
-
1003
- // Skype share link.
1004
- $html_share_buttons .= '<a data-site="skype" class="ssba_skype_share ssba_share_link' . esc_attr($plus_class) . '" href="https://web.skype.com/share?url=' . esc_attr($url_current_page) . '" ' . esc_attr($target . $nofollow) . '>';
1005
-
1006
- // If image set is not custom.
1007
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1008
- // Show ssba image.
1009
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/line.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Line" class="ssba ssba-img" alt="Skype" />';
1010
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1011
- // Show custom image.
1012
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_skype']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Skype" class="ssba ssba-img" alt="skype" />';
1013
- }
1014
-
1015
- // Close href.
1016
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1017
-
1018
- // Close href.
1019
- $html_share_buttons .= '</a>';
1020
-
1021
- // Add closing li if plus.
1022
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1023
- $html_share_buttons .= '</li>';
1024
- }
1025
-
1026
- // Return share buttons.
1027
- return $html_share_buttons;
1028
- }
1029
-
1030
- /**
1031
- * Get Flipboard button.
1032
- *
1033
- * @param array $arr_settings The current ssba settings.
1034
- * @param string $url_current_page The current page url.
1035
- * @param string $str_page_title The page title.
1036
- * @param bool $boo_show_share_count Show share count or not.
1037
- *
1038
- * @return string
1039
- */
1040
- public function ssba_flipboard($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1041
- {
1042
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1043
- $network = 'Flipboard';
1044
-
1045
- $target =
1046
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1047
- && 'Y' === $arr_settings['ssba_new_buttons']
1048
- && !isset($arr_settings['bar_call']))
1049
- ||
1050
- ('Y' === $arr_settings['ssba_share_new_window']
1051
- && 'Y' !== $arr_settings['ssba_new_buttons']
1052
- && !isset($arr_settings['bar_call']))
1053
- ||
1054
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call'])) ? ' target="_blank" ' : '';
1055
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-flipboard ssbp-btn' : '';
1056
- $html_share_buttons = '';
1057
-
1058
- // Add li if plus.
1059
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1060
- $html_share_buttons .= '<li class="ssbp-li--flipboard">';
1061
- }
1062
-
1063
- // Flipboard share link.
1064
- $html_share_buttons .= '<a data-site="flipboard" class="ssba_flipboard_share ssba_share_link' . esc_attr($plus_class) . '" href="https://share.flipboard.com/bookmarklet/popout?url=' . esc_attr($url_current_page) . '&title=' . esc_attr(urlencode($str_page_title)) . '" ' . esc_attr($target . $nofollow) . '>';
1065
-
1066
- // If image set is not custom.
1067
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && !isset($arr_settings['bar_call'])) {
1068
- // Show ssba image.
1069
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/line.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Line" class="ssba ssba-img" alt="Flipboard" />';
1070
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && !isset($arr_settings['bar_call'])) { // If using custom images.
1071
- // Show custom image.
1072
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_flipboard']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Flipboard" class="ssba ssba-img" alt="flipboard" />';
1073
- }
1074
-
1075
- // Close href.
1076
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1077
-
1078
- // Close href.
1079
- $html_share_buttons .= '</a>';
1080
-
1081
- // Add closing li if plus.
1082
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1083
- $html_share_buttons .= '</li>';
1084
- }
1085
-
1086
- // Return share buttons.
1087
- return $html_share_buttons;
1088
- }
1089
-
1090
- /**
1091
- * Get Telegram button.
1092
- *
1093
- * @param array $arr_settings The current ssba settings.
1094
- * @param string $url_current_page The current page url.
1095
- * @param string $str_page_title The page title.
1096
- * @param bool $boo_show_share_count Show share count or not.
1097
- *
1098
- * @return string
1099
- */
1100
- public function ssba_telegram($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1101
- {
1102
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1103
- $network = 'Telegram';
1104
-
1105
- $target =
1106
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1107
- && 'Y' === $arr_settings['ssba_new_buttons']
1108
- && !isset($arr_settings['bar_call']))
1109
- ||
1110
- ('Y' === $arr_settings['ssba_share_new_window']
1111
- && 'Y' !== $arr_settings['ssba_new_buttons']
1112
- && !isset($arr_settings['bar_call']))
1113
- ||
1114
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call'])) ? ' target="_blank" ' : '';
1115
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-telegram ssbp-btn' : '';
1116
- $html_share_buttons = '';
1117
-
1118
- // Add li if plus.
1119
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1120
- $html_share_buttons .= '<li class="ssbp-li--telegram">';
1121
- }
1122
-
1123
- // Telegram share link.
1124
- $html_share_buttons .= '<a data-site="telegram" class="ssba_telegram_share ssba_share_link' . esc_attr($plus_class) . '" href="https://telegram.me/share/url?url=' . esc_attr(urlencode($url_current_page)) . '&text=' . esc_attr(urlencode($str_page_title)) . '">';
1125
-
1126
- // If image set is not custom.
1127
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && !isset($arr_settings['bar_call'])) {
1128
- // Show ssba image.
1129
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/line.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Line" class="ssba ssba-img" alt="Telegram" />';
1130
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && !isset($arr_settings['bar_call'])) { // If using custom images.
1131
- // Show custom image.
1132
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_telegram']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Telegram" class="ssba ssba-img" alt="Telegram" />';
1133
- }
1134
-
1135
- // Close href.
1136
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1137
-
1138
- // Close href.
1139
- $html_share_buttons .= '</a>';
1140
-
1141
- // Add closing li if plus.
1142
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1143
- $html_share_buttons .= '</li>';
1144
- }
1145
-
1146
- // Return share buttons.
1147
- return $html_share_buttons;
1148
- }
1149
-
1150
-
1151
- /**
1152
- * Get Snapchat button.
1153
- *
1154
- * @param array $arr_settings The current ssba settings.
1155
- * @param string $url_current_page The current page url.
1156
- * @param string $str_page_title The page title.
1157
- * @param bool $boo_show_share_count Show share count or not.
1158
- *
1159
- * @return string
1160
- */
1161
- public function ssba_snapchat($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1162
- {
1163
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1164
- $network = 'Snapchat';
1165
-
1166
- $target =
1167
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1168
- && 'Y' === $arr_settings['ssba_new_buttons']
1169
- && !isset($arr_settings['bar_call']))
1170
- ||
1171
- ('Y' === $arr_settings['ssba_share_new_window']
1172
- && 'Y' !== $arr_settings['ssba_new_buttons']
1173
- && !isset($arr_settings['bar_call']))
1174
- ||
1175
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call'])) ? ' target="_blank" ' : '';
1176
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-snapchat ssbp-btn' : '';
1177
- $html_share_buttons = '';
1178
-
1179
- // Add li if plus.
1180
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1181
- $html_share_buttons .= '<li class="ssbp-li--snapchat">';
1182
- }
1183
-
1184
- // Snapchat share link.
1185
- $html_share_buttons .= '<a data-site="snapchat" class="ssba_snapchat_share ssba_share_link' . esc_attr($plus_class) . '" href="https://snapchat.com/scan?attachmentUrl=' . esc_attr($url_current_page) . '&utm_source=sharethis" ' . esc_attr($target . $nofollow) . '>';
1186
-
1187
- // If image set is not custom.
1188
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && !isset($arr_settings['bar_call'])) {
1189
- // Show ssba image.
1190
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/line.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Line" class="ssba ssba-img" alt="Snapchat" />';
1191
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && !isset($arr_settings['bar_call'])) { // If using custom images.
1192
- // Show custom image.
1193
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_snapchat']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Snapchat" class="ssba ssba-img" alt="Snapchat" />';
1194
- }
1195
-
1196
- // Close href.
1197
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1198
-
1199
- // Close href.
1200
- $html_share_buttons .= '</a>';
1201
-
1202
- // Add closing li if plus.
1203
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1204
- $html_share_buttons .= '</li>';
1205
- }
1206
-
1207
- // Return share buttons.
1208
- return $html_share_buttons;
1209
- }
1210
-
1211
- /**
1212
- * Get weibo button.
1213
- *
1214
- * @param array $arr_settings The current ssba settings.
1215
- * @param string $url_current_page The current page url.
1216
- * @param string $str_page_title The page title.
1217
- * @param bool $boo_show_share_count Show share count or not.
1218
- *
1219
- * @return string
1220
- */
1221
- public function ssba_weibo($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1222
- {
1223
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1224
- $network = 'Line';
1225
- $target =
1226
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1227
- && 'Y' === $arr_settings['ssba_new_buttons']
1228
- && ! isset($arr_settings['bar_call']))
1229
- ||
1230
- ('Y' === $arr_settings['ssba_share_new_window']
1231
- && 'Y' !== $arr_settings['ssba_new_buttons']
1232
- && ! isset($arr_settings['bar_call']))
1233
- ||
1234
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call'])) ? ' target="_blank" ' : '';
1235
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-weibo ssbp-btn' : '';
1236
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
1237
- $html_share_buttons = '';
1238
-
1239
- // Add li if plus.
1240
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1241
- $html_share_buttons .= '<li class="ssbp-li--weibo">';
1242
- }
1243
-
1244
- // Skype share link.
1245
- $html_share_buttons .= '<a data-site="weibo" class="ssba_weibo_share ssba_share_link' . esc_attr($plus_class) . '" href="http://v.t.sina.com.cn/share/share.php?url=' . esc_attr($url_current_page) . '" ' . esc_attr($target . $nofollow) . '>';
1246
-
1247
- // If image set is not custom.
1248
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1249
- // Show ssba image.
1250
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/weibo.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Weibo" class="ssba ssba-img" alt="Weibo" />';
1251
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1252
- // Show custom image.
1253
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_weibo']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Weibo" class="ssba ssba-img" alt="Weibo" />';
1254
- }
1255
-
1256
- // Close href.
1257
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1258
-
1259
- // Close href.
1260
- $html_share_buttons .= '</a>';
1261
-
1262
- // Add closing li if plus.
1263
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1264
- $html_share_buttons .= '</li>';
1265
- }
1266
-
1267
- // Return share buttons.
1268
- return $html_share_buttons;
1269
- }
1270
-
1271
- /**
1272
- * Get reddit.
1273
- *
1274
- * @param array $arr_settings The current ssba settings.
1275
- * @param string $url_current_page The current page url.
1276
- * @param string $str_page_title The page title.
1277
- * @param bool $boo_show_share_count Show share count or not.
1278
- *
1279
- * @return string
1280
- */
1281
- public function ssba_reddit($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1282
- {
1283
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1284
- $network = 'Reddit';
1285
- $target =
1286
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1287
- && 'Y' === $arr_settings['ssba_new_buttons']
1288
- && ! isset($arr_settings['bar_call']
1289
- ))
1290
- ||
1291
- ('Y' === $arr_settings['ssba_share_new_window']
1292
- && 'Y' !== $arr_settings['ssba_new_buttons']
1293
- && ! isset($arr_settings['bar_call']
1294
- ))
1295
- ||
1296
- ('Y' === $arr_settings['ssba_bar_share_new_window'] && isset($arr_settings['bar_call']
1297
- )) ? ' target="_blank" ' : '';
1298
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-reddit ssbp-btn' : '';
1299
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
1300
- $html_share_buttons = '';
1301
-
1302
- // Add li if plus.
1303
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1304
- $html_share_buttons .= '<li class="ssbp-li--reddit">';
1305
- }
1306
-
1307
- // Reddit share link.
1308
- $html_share_buttons .= '<a data-site="reddit" class="ssba_reddit_share' . esc_attr($plus_class) . '" href="http://reddit.com/submit?url=' . esc_attr($url_current_page) . '&amp;title=' . esc_attr($str_page_title) . '" ' . esc_attr($target . $nofollow) . '>';
1309
-
1310
- // If image set is not custom.
1311
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1312
-
1313
- // Show ssba image.
1314
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/reddit.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Reddit" class="ssba ssba-img" alt="Share on Reddit" />';
1315
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1316
- // Show custom image.
1317
- $html_share_buttons .= '<img src="' . esc_attr($arr_settings['ssba_custom_reddit']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Reddit" class="ssba ssba-img" alt="Share on Reddit" />';
1318
- }
1319
-
1320
- // Close href.
1321
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1322
-
1323
- // Close href.
1324
- $html_share_buttons .= '</a>';
1325
-
1326
- // If show share count is set to Y.
1327
- if ((('Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'])
1328
- ||
1329
- ('Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'])
1330
- ||
1331
- ('Y' === $arr_settings['ssba_bar_show_share_count'] && isset($arr_settings['bar_call'])
1332
- )
1333
- && $boo_show_share_count
1334
- )) {
1335
- // Get and display share count.
1336
- $html_share_buttons .= '<span class="' . esc_attr($count_class) . '">' . esc_html($this->get_reddit_share_count($url_current_page)) . '</span>';
1337
- }
1338
-
1339
- // Add closing li if plus.
1340
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1341
- $html_share_buttons .= '</li>';
1342
- }
1343
-
1344
- // Return share buttons.
1345
- return $html_share_buttons;
1346
- }
1347
-
1348
- /**
1349
- * Get reddit share count.
1350
- *
1351
- * @param string $url_current_page The current url.
1352
- *
1353
- * @return int|string
1354
- */
1355
- public function get_reddit_share_count($url_current_page)
1356
- {
1357
- // Get results from reddit and return the number of shares.
1358
- $html_reddit_share_details = wp_safe_remote_get('http://www.reddit.com/api/info.json?url=' . $url_current_page,
1359
- array(
1360
- 'timeout' => 6,
1361
- ));
1362
-
1363
- // Check there was an error.
1364
- if (is_wp_error($html_reddit_share_details)) {
1365
- return 0;
1366
- }
1367
-
1368
- // Decode and get share count.
1369
- $arr_reddit_result = json_decode($html_reddit_share_details['body'], true);
1370
- $int_reddit_share_count = isset($arr_reddit_result['data']['children']['0']['data']['score']) ? $arr_reddit_result['data']['children']['0']['data']['score'] : 0;
1371
-
1372
- return $int_reddit_share_count ? $this->ssba_format_number($int_reddit_share_count) : '0';
1373
- }
1374
-
1375
- /**
1376
- * Get linkedin button.
1377
- *
1378
- * @param array $arr_settings The current ssba settings.
1379
- * @param string $url_current_page The current page url.
1380
- * @param string $str_page_title The page title.
1381
- * @param bool $boo_show_share_count Show share count or not.
1382
- *
1383
- * @return string
1384
- */
1385
- public function ssba_linkedin($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1386
- {
1387
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1388
- $network = 'Linkedin';
1389
- $target =
1390
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1391
- && 'Y' === $arr_settings['ssba_new_buttons']
1392
- && ! isset($arr_settings['bar_call']
1393
- ))
1394
- ||
1395
- ('Y' === $arr_settings['ssba_share_new_window']
1396
- && 'Y' !== $arr_settings['ssba_new_buttons']
1397
- && ! isset($arr_settings['bar_call']
1398
- ))
1399
- ||
1400
- ('Y' === $arr_settings['ssba_bar_share_new_window']
1401
- && isset($arr_settings['bar_call']
1402
- )) ? ' target="_blank" ' : '';
1403
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-linkedin ssbp-btn' : '';
1404
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
1405
- $html_share_buttons = '';
1406
-
1407
- // Add li if plus.
1408
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1409
- $html_share_buttons .= '<li class="ssbp-li--linkedin">';
1410
- }
1411
-
1412
- // Linkedin share link.
1413
- $html_share_buttons .= '<a data-site="linkedin" class="ssba_linkedin_share ssba_share_link' . esc_attr($plus_class) . '" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=' . esc_attr($url_current_page) . '" ' . esc_attr($target . $nofollow) . '>';
1414
-
1415
- // If image set is not custom.
1416
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1417
- // Show ssba image.
1418
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/linkedin.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="LinkedIn" class="ssba ssba-img" alt="Share on LinkedIn" />';
1419
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1420
- // Show custom image.
1421
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_linkedin']) . '" alt="Share on LinkedIn" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="LinkedIn" class="ssba ssba-img" />';
1422
- }
1423
-
1424
- // Close href.
1425
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1426
-
1427
- // Close href.
1428
- $html_share_buttons .= '</a>';
1429
-
1430
- // Add closing li if plus.
1431
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1432
- $html_share_buttons .= '</li>';
1433
- }
1434
-
1435
- // Return share buttons.
1436
- return $html_share_buttons;
1437
- }
1438
-
1439
- /**
1440
- * Get linkedin share count. DEPRECATED
1441
- *
1442
- * @param string $url_current_page The current page url.
1443
- *
1444
- * @return int|string
1445
- */
1446
- public function get_linkedin_share_count($url_current_page)
1447
- {
1448
- // Get results from linkedin and return the number of shares.
1449
- $html_linkedin_share_details = wp_safe_remote_get('http://www.linkedin.com/countserv/count/share?url=' . $url_current_page,
1450
- array(
1451
- 'timeout' => 6,
1452
- ));
1453
-
1454
- // If there was an error.
1455
- if (is_wp_error($html_linkedin_share_details)) {
1456
- return 0;
1457
- }
1458
-
1459
- // Extract/decode share count.
1460
- $html_linkedin_share_details = str_replace('IN.Tags.Share.handleCount(', '', $html_linkedin_share_details);
1461
- $html_linkedin_share_details = str_replace(');', '', $html_linkedin_share_details);
1462
- $arr_linkedin_share_details = json_decode($html_linkedin_share_details['body'], true);
1463
- $int_linkedin_share_count = $arr_linkedin_share_details['count'];
1464
-
1465
- return $int_linkedin_share_count ? $this->ssba_format_number($int_linkedin_share_count) : '0';
1466
- }
1467
-
1468
- /**
1469
- * Get pinterest button.
1470
- *
1471
- * @param array $arr_settings The current ssba settings.
1472
- * @param string $url_current_page The current page url.
1473
- * @param string $str_page_title The page title.
1474
- * @param bool $boo_show_share_count Show share count or not.
1475
- *
1476
- * @return string
1477
- */
1478
- public function ssba_pinterest($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1479
- {
1480
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1481
- $network = 'Pinterest';
1482
- $target =
1483
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1484
- && 'Y' === $arr_settings['ssba_new_buttons']
1485
- && ! isset($arr_settings['bar_call']
1486
- ))
1487
- ||
1488
- ('Y' === $arr_settings['ssba_share_new_window']
1489
- && 'Y' !== $arr_settings['ssba_new_buttons']
1490
- && ! isset($arr_settings['bar_call']
1491
- ))
1492
- ||
1493
- ('Y' === $arr_settings['ssba_bar_share_new_window']
1494
- && isset($arr_settings['bar_call']
1495
- )) ? ' target="_blank" ' : '';
1496
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-pinterest ssbp-btn' : '';
1497
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
1498
- $html_share_buttons = '';
1499
-
1500
- // Add li if plus.
1501
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1502
- $html_share_buttons .= '<li class="ssbp-li--pinterest">';
1503
- }
1504
-
1505
- // If using featured images for Pinteres.
1506
- if ('Y' === $arr_settings['ssba_pinterest_featured']) {
1507
- // If this post has a featured image.
1508
- if (has_post_thumbnail($arr_settings['post_id'])) {
1509
- // Get the featured image.
1510
- $url_post_thumb = wp_get_attachment_image_src(get_post_thumbnail_id($arr_settings['post_id']), 'full');
1511
- $url_post_thumb = $url_post_thumb[0];
1512
- } else { // No featured image set.
1513
- // Use the pinterest default.
1514
- $url_post_thumb = $arr_settings['ssba_default_pinterest'];
1515
- }
1516
-
1517
- // Pinterest share link.
1518
- $html_share_buttons .= '<a data-site="pinterest-featured" href="http://pinterest.com/pin/create/bookmarklet/?is_video=false&url=' . esc_attr($url_current_page) . '&media=' . esc_attr($url_post_thumb) . '&description=' . esc_attr($str_page_title) . '" class="ssba_pinterest_share ssba_share_link' . esc_attr($plus_class) . '" ' . esc_attr($target . $nofollow) . '>';
1519
- } else { // Not using featured images for pinterest.
1520
- // Use the choice of pinnable images approach.
1521
- $html_share_buttons .= "<a data-site='pinterest' class='ssba_pinterest_share" . esc_attr($plus_class) . "' href='javascript:void((function()%7Bvar%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;//assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)%7D)());'>";
1522
- }
1523
-
1524
- // If image set is not custom.
1525
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1526
- // Show ssba image.
1527
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/pinterest.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Pinterest" class="ssba ssba-img" alt="Pin on Pinterest" />';
1528
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1529
- // Show custom image.
1530
- $html_share_buttons .= '<img style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Pinterest" class="ssba ssba-img" src="' . esc_url($arr_settings['ssba_custom_pinterest']) . '" alt="Pin on Pinterest" />';
1531
- }
1532
-
1533
- // Close href.
1534
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1535
-
1536
- // Close href.
1537
- $html_share_buttons .= '</a>';
1538
-
1539
- // If show share count is set to Y.
1540
- if ((('Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'])
1541
- ||
1542
- ('Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'])
1543
- ||
1544
- ('Y' === $arr_settings['ssba_bar_show_share_count'] && isset($arr_settings['bar_call'])
1545
- )
1546
- && $boo_show_share_count
1547
- )) {
1548
- $html_share_buttons .= '<span class="' . esc_attr($count_class) . '">' . esc_html($this->get_pinterest_share_count($url_current_page)) . '</span>';
1549
- }
1550
-
1551
- // Add closing li if plus.
1552
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1553
- $html_share_buttons .= '</li>';
1554
- }
1555
-
1556
- // Return share buttons.
1557
- return $html_share_buttons;
1558
- }
1559
-
1560
- /**
1561
- * Get pinterest share count.
1562
- *
1563
- * @param string $url_current_page The current page url.
1564
- *
1565
- * @return int|string
1566
- */
1567
- public function get_pinterest_share_count($url_current_page)
1568
- {
1569
- // Get results from pinterest.
1570
- $html_pinterest_share_details = wp_safe_remote_get('http://api.pinterest.com/v1/urls/count.json?url=' . $url_current_page,
1571
- array(
1572
- 'timeout' => 6,
1573
- ));
1574
-
1575
- // Check there was an error.
1576
- if (is_wp_error($html_pinterest_share_details)) {
1577
- return 0;
1578
- }
1579
-
1580
- // Decode data.
1581
- $html_pinterest_share_details = str_replace('receiveCount(', '', $html_pinterest_share_details);
1582
- $html_pinterest_share_details = str_replace(')', '', $html_pinterest_share_details);
1583
- $arr_pinterest_share_details = json_decode($html_pinterest_share_details['body'], true);
1584
- $int_pinterest_share_count = $arr_pinterest_share_details['count'];
1585
-
1586
- return $int_pinterest_share_count ? $this->ssba_format_number($int_pinterest_share_count) : '0';
1587
- }
1588
-
1589
- /**
1590
- * Get stumbleupon button.
1591
- *
1592
- * @param array $arr_settings The current ssba settings.
1593
- * @param string $url_current_page The current page url.
1594
- * @param string $str_page_title The page title.
1595
- * @param bool $boo_show_share_count Show share count or not.
1596
- *
1597
- * @return string
1598
- */
1599
- public function ssba_stumbleupon($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1600
- {
1601
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1602
- $network = 'StumbleUpon';
1603
- $target =
1604
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1605
- && 'Y' === $arr_settings['ssba_new_buttons']
1606
- && ! isset($arr_settings['bar_call']
1607
- ))
1608
- ||
1609
- ('Y' === $arr_settings['ssba_share_new_window']
1610
- && 'Y' !== $arr_settings['ssba_new_buttons']
1611
- && ! isset($arr_settings['bar_call']
1612
- ))
1613
- ||
1614
- ('Y' === $arr_settings['ssba_bar_share_new_window']
1615
- && isset($arr_settings['bar_call']
1616
- )) ? ' target="_blank" ' : '';
1617
- $url = 'http://www.stumbleupon.com/submit?url=' . esc_attr($url_current_page) . '&amp;title=' . esc_attr($str_page_title);
1618
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-stumbleupon ssbp-btn' : '';
1619
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
1620
- $html_share_buttons = '';
1621
-
1622
- // Add li if plus.
1623
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1624
- $html_share_buttons .= '<li class="ssbp-li--stumbleupon">';
1625
- }
1626
-
1627
- // Stumbleupon share link.
1628
- $html_share_buttons .= '<a data-site="stumbleupon" class="ssba_stumbleupon_share ssba_share_link' . esc_attr($plus_class) . '" href="' . esc_url($url) . '" ' . esc_attr($target . $nofollow) . '>';
1629
-
1630
- // If image set is not custom.
1631
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1632
- // Show ssba image.
1633
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/stumbleupon.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="StumbleUpon" class="ssba ssba-img" alt="Share on StumbleUpon" />';
1634
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1635
- // Show custom image.
1636
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_stumbleupon']) . '" alt="Share on StumbleUpon" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="StumbleUpon" class="ssba ssba-img" />';
1637
- }
1638
-
1639
- // Close href.
1640
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1641
-
1642
- // Close href.
1643
- $html_share_buttons .= '</a>';
1644
-
1645
- // If show share count is set to Y.
1646
- if ((('Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'])
1647
- ||
1648
- ('Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'])
1649
- ||
1650
- ('Y' === $arr_settings['ssba_bar_show_share_count'] && isset($arr_settings['bar_call'])
1651
- )
1652
- && $boo_show_share_count
1653
- )) {
1654
- $html_share_buttons .= '<span class="' . esc_attr($count_class) . '">' . esc_html($this->get_stumble_upon_share_count($url_current_page)) . '</span>';
1655
- }
1656
-
1657
- // Add closing li if plus.
1658
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1659
- $html_share_buttons .= '</li>';
1660
- }
1661
-
1662
- // Return share buttons.
1663
- return $html_share_buttons;
1664
- }
1665
-
1666
- /**
1667
- * Get stumbleupon share count.
1668
- *
1669
- * @param string $url_current_page The current url.
1670
- *
1671
- * @return int|string
1672
- */
1673
- public function get_stumble_upon_share_count($url_current_page)
1674
- {
1675
- // Get results from stumbleupon and return the number of shares.
1676
- $html_stumble_upon_share_details = wp_safe_remote_get('http://www.stumbleupon.com/services/1.01/badge.getinfo?url=' . $url_current_page,
1677
- array(
1678
- 'timeout' => 6,
1679
- ));
1680
-
1681
- // Check there was an error.
1682
- if (is_wp_error($html_stumble_upon_share_details)) {
1683
- return 0;
1684
- }
1685
-
1686
- // Decode data.
1687
- $arr_stumble_upon_result = json_decode($html_stumble_upon_share_details['body'], true);
1688
- $int_stumble_upon_share_count = isset($arr_stumble_upon_result['result']['views']) ? $arr_stumble_upon_result['result']['views'] : 0;
1689
-
1690
- return $int_stumble_upon_share_count ? $this->ssba_format_number($int_stumble_upon_share_count) : '0';
1691
- }
1692
-
1693
- /**
1694
- * Get email button.
1695
- *
1696
- * @param array $arr_settings The current ssba settings.
1697
- * @param string $url_current_page The current page url.
1698
- * @param string $str_page_title The page title.
1699
- * @param bool $boo_show_share_count Show share count or not.
1700
- *
1701
- * @return string
1702
- */
1703
- public function ssba_email($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1704
- {
1705
- // Replace ampersands as needed for email link.
1706
- $email_title = str_replace('&', '%26', $str_page_title);
1707
- $network = 'email';
1708
- $url = 'mailto:?subject=' . $email_title . '&amp;body=' . $arr_settings['ssba_email_message'] . ' ' . $url_current_page;
1709
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-email ssbp-btn' : '';
1710
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
1711
- $html_share_buttons = '';
1712
-
1713
- // Add li if plus.
1714
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1715
- $html_share_buttons .= '<li class="ssbp-li--email">';
1716
- }
1717
-
1718
- $url = 'Y' === $arr_settings['ssba_new_buttons'] ? 'mailto:?subject=' . $email_title . '&amp;body=' . $arr_settings['ssba_plus_email_message'] . ' ' . $url_current_page : $url;
1719
- $url = isset($arr_settings['bar_call']) ? 'mailto:?subject=' . $email_title . '&amp;body=' . $arr_settings['ssba_bar_email_message'] . ' ' . $url_current_page : $url;
1720
-
1721
-
1722
- // Email share link.
1723
- $html_share_buttons .= '<a data-site="email" class="ssba_email_share' . esc_attr($plus_class) . '" href="' . esc_url($url) . '">';
1724
-
1725
- // If image set is not custom.
1726
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1727
- // Show ssba image.
1728
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/email.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Email" class="ssba ssba-img" alt="Email this to someone" />';
1729
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1730
- // Show custom image.
1731
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_email']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Email" class="ssba ssba-img" alt="Email to someone" />';
1732
- }
1733
-
1734
- // Close href.
1735
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1736
-
1737
- // Close href.
1738
- $html_share_buttons .= '</a>';
1739
-
1740
- // Add closing li if plus.
1741
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1742
- $html_share_buttons .= '</li>';
1743
- }
1744
-
1745
- // Return share buttons.
1746
- return $html_share_buttons;
1747
- }
1748
-
1749
- /**
1750
- * Get flattr button.
1751
- *
1752
- * @param array $arr_settings The current ssba settings.
1753
- * @param string $url_current_page The current page url.
1754
- * @param string $str_page_title The page title.
1755
- * @param bool $boo_show_share_count Show share count or not.
1756
- *
1757
- * @return string
1758
- */
1759
- public function ssba_flattr($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1760
- {
1761
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1762
- $network = 'Flattr';
1763
- $target =
1764
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1765
- && 'Y' === $arr_settings['ssba_new_buttons']
1766
- && ! isset($arr_settings['bar_call']
1767
- ))
1768
- ||
1769
- ('Y' === $arr_settings['ssba_share_new_window']
1770
- && 'Y' !== $arr_settings['ssba_new_buttons']
1771
- && ! isset($arr_settings['bar_call']
1772
- ))
1773
- ||
1774
- ('Y' === $arr_settings['ssba_bar_share_new_window']
1775
- && isset($arr_settings['bar_call']
1776
- )) ? ' target="_blank" ' : '';
1777
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-flattr ssbp-btn' : '';
1778
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
1779
- $html_share_buttons = '';
1780
- $userid = ! empty($arr_settings['ssba_flattr_user_id']) ? $arr_settings['ssba_flattr_user_id'] : '';
1781
-
1782
- // Add li if plus.
1783
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1784
- $html_share_buttons .= '<li class="ssbp-li--flattr">';
1785
- }
1786
-
1787
- // Check for dedicated flattr URL.
1788
- if ('' !== $arr_settings['ssba_flattr_url']) {
1789
- // Update url that will be set to specified URL.
1790
- $url_current_page = $arr_settings['ssba_flattr_url'];
1791
- }
1792
-
1793
- if ('Y' === $arr_settings['ssba_new_buttons']) {
1794
- $userid = ! empty($arr_settings['ssba_plus_flattr_user_id']) ? $arr_settings['ssba_plus_flattr_user_id'] : $userid;
1795
- $url_current_page = ! empty($arr_settings['ssba_plus_flattr_url']) ? $arr_settings['ssba_plus_flattr_url'] : $url_current_page;
1796
- }
1797
-
1798
- if (isset($arr_settings['bar_call'])) {
1799
- $userid = ! empty($arr_settings['ssba_bar_flattr_user_id']) ? $arr_settings['ssba_bar_flattr_user_id'] : $userid;
1800
- $url_current_page = ! empty($arr_settings['ssba_bar_flattr_url']) ? $arr_settings['ssba_bar_flattr_url'] : $url_current_page;
1801
- }
1802
-
1803
- // Flattr share link.
1804
- $html_share_buttons .= '<a data-site="flattr" class="ssba_flattr_share' . esc_attr($plus_class) . '" href="https://flattr.com/submit/auto?user_id=' . esc_attr($userid) . '&amp;title=' . esc_attr($str_page_title) . '&amp;url=' . esc_attr($url_current_page) . '" ' . esc_attr($target . $nofollow) . '>';
1805
-
1806
- // If image set is not custom.
1807
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1808
- // Show ssba image.
1809
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/flattr.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Flattr" class="ssba ssba-img" alt="Flattr the author" />';
1810
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1811
- // Show custom image.
1812
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_flattr']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Flattr" class="ssba ssba-img" alt="Flattr the author" />';
1813
- }
1814
-
1815
- // Close href.
1816
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1817
-
1818
- // Close href.
1819
- $html_share_buttons .= '</a>';
1820
-
1821
- // Add closing li if plus.
1822
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1823
- $html_share_buttons .= '</li>';
1824
- }
1825
-
1826
- // Return share buttons.
1827
- return $html_share_buttons;
1828
- }
1829
-
1830
- /**
1831
- * Get buffer button.
1832
- *
1833
- * @param array $arr_settings The current ssba settings.
1834
- * @param string $url_current_page The current page url.
1835
- * @param string $str_page_title The page title.
1836
- * @param bool $boo_show_share_count Show share count or not.
1837
- *
1838
- * @return string
1839
- */
1840
- public function ssba_buffer($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1841
- {
1842
- $buffer = '' !== $arr_settings['ssba_buffer_text'] ? $arr_settings['ssba_buffer_text'] : '';
1843
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1844
- $network = 'Buffer';
1845
- $target =
1846
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1847
- && 'Y' === $arr_settings['ssba_new_buttons']
1848
- && ! isset($arr_settings['bar_call']
1849
- ))
1850
- ||
1851
- ('Y' === $arr_settings['ssba_share_new_window']
1852
- && 'Y' !== $arr_settings['ssba_new_buttons']
1853
- && ! isset($arr_settings['bar_call']
1854
- ))
1855
- ||
1856
- ('Y' === $arr_settings['ssba_bar_share_new_window']
1857
- && isset($arr_settings['bar_call']
1858
- )) ? ' target="_blank" ' : '';
1859
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-buffer ssbp-btn' : '';
1860
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
1861
- $html_share_buttons = '';
1862
-
1863
- // Add li if plus.
1864
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1865
- $html_share_buttons .= '<li class="ssbp-li--buffer">';
1866
- }
1867
-
1868
- // Buffer share link.
1869
- $html_share_buttons .= '<a data-site="buffer" class="ssba_buffer_share' . esc_attr($plus_class) . '" href="https://bufferapp.com/add?url=' . esc_attr($url_current_page) . '&amp;text=' . esc_attr($buffer) . ' ' . esc_attr($str_page_title) . '" ' . esc_attr($target . $nofollow) . '>';
1870
-
1871
- // If image set is not custom.
1872
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1873
- // Show ssba image.
1874
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/buffer.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Buffer" class="ssba ssba-img" alt="Buffer this page" />';
1875
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1876
- // Show custom image.
1877
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_buffer']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Buffer" class="ssba ssba-img" alt="Buffer this page" />';
1878
- }
1879
-
1880
- // Close href.
1881
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1882
-
1883
- // Close href.
1884
- $html_share_buttons .= '</a>';
1885
-
1886
- // Add closing li if plus.
1887
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1888
- $html_share_buttons .= '</li>';
1889
- }
1890
-
1891
- // Return share buttons.
1892
- return $html_share_buttons;
1893
- }
1894
-
1895
- /**
1896
- * Get tumblr button.
1897
- *
1898
- * @param array $arr_settings The current ssba settings.
1899
- * @param string $url_current_page The current page url.
1900
- * @param string $str_page_title The page title.
1901
- * @param bool $boo_show_share_count Show share count or not.
1902
- *
1903
- * @return string
1904
- */
1905
- public function ssba_tumblr($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
1906
- {
1907
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1908
- $network = 'Tumblr';
1909
- $target =
1910
- ('Y' === $arr_settings['ssba_plus_share_new_window']
1911
- && 'Y' === $arr_settings['ssba_new_buttons']
1912
- && ! isset($arr_settings['bar_call']
1913
- ))
1914
- ||
1915
- ('Y' === $arr_settings['ssba_share_new_window']
1916
- && 'Y' !== $arr_settings['ssba_new_buttons']
1917
- && ! isset($arr_settings['bar_call']
1918
- ))
1919
- ||
1920
- ('Y' === $arr_settings['ssba_bar_share_new_window']
1921
- && isset($arr_settings['bar_call']
1922
- )) ? ' target="_blank" ' : '';
1923
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-tumblr ssbp-btn' : '';
1924
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
1925
- $html_share_buttons = '';
1926
-
1927
- // Add li if plus.
1928
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1929
- $html_share_buttons .= '<li class="ssbp-li--tumblr">';
1930
- }
1931
-
1932
- // Tumblr share link.
1933
- $html_share_buttons .= '<a data-site="tumblr" class="ssba_tumblr_share' . esc_attr($plus_class) . '" href="http://www.tumblr.com/share/link?url=' . esc_attr($url_current_page) . '" ' . esc_attr($target . $nofollow) . '>';
1934
-
1935
- // If image set is not custom.
1936
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
1937
- // Show ssba image.
1938
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/tumblr.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="tumblr" class="ssba ssba-img" alt="Share on Tumblr" />';
1939
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
1940
- // Show custom image.
1941
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_tumblr']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="tumblr" class="ssba ssba-img" alt="share on Tumblr" />';
1942
- }
1943
-
1944
- // Close href.
1945
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1946
-
1947
- // Close href.
1948
- $html_share_buttons .= '</a>';
1949
-
1950
- // If show share count is set to Y.
1951
- if ((('Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'])
1952
- ||
1953
- ('Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'])
1954
- ||
1955
- ('Y' === $arr_settings['ssba_bar_show_share_count'] && isset($arr_settings['bar_call'])
1956
- )
1957
- && $boo_show_share_count
1958
- )) {
1959
- $html_share_buttons .= '<span class="' . $count_class . '">' . esc_html($this->get_tumblr_share_count($url_current_page)) . '</span>';
1960
- }
1961
-
1962
- // Add closing li if plus.
1963
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
1964
- $html_share_buttons .= '</li>';
1965
- }
1966
-
1967
- // Return share buttons.
1968
- return $html_share_buttons;
1969
- }
1970
-
1971
- /**
1972
- * Get tumblr share count.
1973
- *
1974
- * @param string $url_current_page The current url.
1975
- *
1976
- * @return int|string
1977
- */
1978
- public function get_tumblr_share_count($url_current_page)
1979
- {
1980
- // Get results from tumblr and return the number of shares.
1981
- $result = wp_safe_remote_get('http://api.tumblr.com/v2/share/stats?url=' . $url_current_page, array(
1982
- 'timeout' => 6,
1983
- ));
1984
-
1985
- // Check there was an error.
1986
- if (is_wp_error($result)) {
1987
- return 0;
1988
- }
1989
-
1990
- // Decode data.
1991
- $array = json_decode($result['body'], true);
1992
- $count = isset($array['response']['note_count']) ? $array['response']['note_count'] : 0;
1993
-
1994
- return ($count) ? $count : '0';
1995
- }
1996
-
1997
- /**
1998
- * Get print button.
1999
- *
2000
- * @param array $arr_settings The current ssba settings.
2001
- * @param string $url_current_page The current page url.
2002
- * @param string $str_page_title The page title.
2003
- * @param bool $boo_show_share_count Show share count or not.
2004
- *
2005
- * @return string
2006
- */
2007
- public function ssba_print($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
2008
- {
2009
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-print ssbp-btn' : '';
2010
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
2011
- $network = 'Print';
2012
- $html_share_buttons = '';
2013
-
2014
- // Add li if plus.
2015
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2016
- $html_share_buttons .= '<li class="ssbp-li--print">';
2017
- }
2018
-
2019
- $html_share_buttons .= '<a data-site="print" class="ssba_print ssba_share_link ' . esc_attr($plus_class) . '" href="#" onclick="window.print()">';
2020
-
2021
- // If image set is not custom.
2022
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
2023
- // Show ssba image.
2024
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/print.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Print" class="ssba ssba-img" alt="Print this page" />';
2025
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
2026
- // Show custom image.
2027
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_print']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Print" class="ssba ssba-img" alt="Print this page" />';
2028
- }
2029
-
2030
- // Close href.
2031
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2032
-
2033
- // Close href.
2034
- $html_share_buttons .= '</a>';
2035
-
2036
- // Add closing li if plus.
2037
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2038
- $html_share_buttons .= '</li>';
2039
- }
2040
-
2041
- // Return share buttons.
2042
- return $html_share_buttons;
2043
- }
2044
-
2045
- /**
2046
- * Get vk button.
2047
- *
2048
- * @param array $arr_settings The current ssba settings.
2049
- * @param string $url_current_page The current page url.
2050
- * @param string $str_page_title The page title.
2051
- * @param bool $boo_show_share_count Show share count or not.
2052
- *
2053
- * @return string
2054
- */
2055
- public function ssba_vk($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
2056
- {
2057
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
2058
- $network = 'VK';
2059
- $target =
2060
- ('Y' === $arr_settings['ssba_plus_share_new_window']
2061
- && 'Y' === $arr_settings['ssba_new_buttons']
2062
- && ! isset($arr_settings['bar_call']
2063
- ))
2064
- ||
2065
- ('Y' === $arr_settings['ssba_share_new_window']
2066
- && 'Y' !== $arr_settings['ssba_new_buttons']
2067
- && ! isset($arr_settings['bar_call']
2068
- ))
2069
- ||
2070
- ('Y' === $arr_settings['ssba_bar_share_new_window']
2071
- && isset($arr_settings['bar_call']
2072
- )) ? ' target="_blank" ' : '';
2073
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-vk ssbp-btn' : '';
2074
- $html_share_buttons = '';
2075
-
2076
- // Add li if plus.
2077
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2078
- $html_share_buttons .= '<li class="ssbp-li--vk">';
2079
- }
2080
-
2081
- // Vk share link.
2082
- $html_share_buttons .= '<a data-site="vk" class="ssba_vk_share ssba_share_link' . esc_attr($plus_class) . '" href="http://vkontakte.ru/share.php?url=' . esc_attr($url_current_page) . '" ' . esc_attr($target . $nofollow) . '>';
2083
-
2084
- // If image set is not custom.
2085
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
2086
- // Show ssba image.
2087
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/vk.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="VK" class="ssba ssba-img" alt="Share on VK" />';
2088
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
2089
- // Show custom image.
2090
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_vk']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="VK" class="ssba ssba-img" alt="Share on VK" />';
2091
- }
2092
-
2093
- // Close href.
2094
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2095
-
2096
- // Close href.
2097
- $html_share_buttons .= '</a>';
2098
-
2099
- // Add closing li if plus.
2100
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2101
- $html_share_buttons .= '</li>';
2102
- }
2103
-
2104
- // Return share buttons.
2105
- return $html_share_buttons;
2106
- }
2107
-
2108
- /**
2109
- * Get yummly button.
2110
- *
2111
- * @param array $arr_settings The current ssba settings.
2112
- * @param string $url_current_page The current page url.
2113
- * @param string $str_page_title The page title.
2114
- * @param bool $boo_show_share_count Show share count or not.
2115
- *
2116
- * @return string
2117
- */
2118
- public function ssba_yummly($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
2119
- {
2120
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
2121
- $network = 'Yummly';
2122
- $target =
2123
- ('Y' === $arr_settings['ssba_plus_share_new_window']
2124
- && 'Y' === $arr_settings['ssba_new_buttons']
2125
- && ! isset($arr_settings['bar_call']
2126
- ))
2127
- ||
2128
- ('Y' === $arr_settings['ssba_share_new_window']
2129
- && 'Y' !== $arr_settings['ssba_new_buttons']
2130
- && ! isset($arr_settings['bar_call']
2131
- ))
2132
- ||
2133
- ('Y' === $arr_settings['ssba_bar_share_new_window']
2134
- && isset($arr_settings['bar_call']
2135
- )) ? ' target="_blank" ' : '';
2136
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-yummly ssbp-btn' : '';
2137
- $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-each-share' : ' ssba_sharecount';
2138
- $html_share_buttons = '';
2139
-
2140
- // Add li if plus.
2141
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2142
- $html_share_buttons .= '<li class="ssbp-li--yummly">';
2143
- }
2144
-
2145
- // Yummly share link.
2146
- $html_share_buttons .= '<a data-site="yummly" class="ssba_yummly_share ssba_share_link' . esc_attr($plus_class) . '" href="http://www.yummly.com/urb/verify?url=' . esc_attr($url_current_page) . '&title=' . esc_attr(rawurlencode(html_entity_decode($str_page_title))) . '" ' . esc_attr($target . $nofollow) . '>';
2147
-
2148
- // If image set is not custom.
2149
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
2150
- // Show ssba image.
2151
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/yummly.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Yummly" class="ssba ssba-img" alt="Share on Yummly" />';
2152
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
2153
- // Show custom image.
2154
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_yummly']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Yummly" class="ssba ssba-img" alt="Share on Yummly" />';
2155
- }
2156
-
2157
- // Close href.
2158
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2159
-
2160
- // Close href.
2161
- $html_share_buttons .= '</a>';
2162
-
2163
- // If show share count is set to Y.
2164
- if ((('Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'])
2165
- ||
2166
- ('Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'])
2167
- ||
2168
- ('Y' === $arr_settings['ssba_bar_show_share_count'] && isset($arr_settings['bar_call'])
2169
- )
2170
- && $boo_show_share_count
2171
- )) {
2172
- $html_share_buttons .= '<span class="' . esc_attr($count_class) . '">' . esc_html($this->get_yummly_share_count($url_current_page)) . '</span>';
2173
- }
2174
-
2175
- // Add closing li if plus.
2176
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2177
- $html_share_buttons .= '</li>';
2178
- }
2179
-
2180
- // Return share buttons.
2181
- return $html_share_buttons;
2182
- }
2183
-
2184
- /**
2185
- * Get yummly share count.
2186
- *
2187
- * @param string $url_current_page the current page url.
2188
- *
2189
- * @return int|string
2190
- */
2191
- public function get_yummly_share_count($url_current_page)
2192
- {
2193
- // Get results from yummly and return the number of shares.
2194
- $result = wp_safe_remote_get('http://www.yummly.com/services/yum-count?url=' . $url_current_page, array(
2195
- 'timeout' => 6,
2196
- ));
2197
-
2198
- // Check there was an error.
2199
- if (is_wp_error($result)) {
2200
- return 0;
2201
- }
2202
-
2203
- // Decode data.
2204
- $array = json_decode($result['body'], true);
2205
- $count = isset($array['count']) ? $array['count'] : '0';
2206
-
2207
- // Return.
2208
- return $count;
2209
- }
2210
-
2211
- /**
2212
- * Get whatsapp button.
2213
- *
2214
- * @param array $arr_settings The current ssba settings.
2215
- * @param string $url_current_page The current page url.
2216
- * @param string $str_page_title The page title.
2217
- * @param bool $boo_show_share_count Show share count or not.
2218
- *
2219
- * @return string
2220
- */
2221
- public function ssba_whatsapp($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
2222
- {
2223
- if ( ! wp_is_mobile()) {
2224
- return;
2225
- }
2226
-
2227
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
2228
- $network = 'Whatsapp';
2229
- $target =
2230
- ('Y' === $arr_settings['ssba_plus_share_new_window']
2231
- && 'Y' === $arr_settings['ssba_new_buttons']
2232
- && ! isset($arr_settings['bar_call']
2233
- ))
2234
- ||
2235
- ('Y' === $arr_settings['ssba_share_new_window']
2236
- && 'Y' !== $arr_settings['ssba_new_buttons']
2237
- && ! isset($arr_settings['bar_call']
2238
- ))
2239
- ||
2240
- ('Y' === $arr_settings['ssba_bar_share_new_window']
2241
- && isset($arr_settings['bar_call']
2242
- )) ? ' target="_blank" ' : '';
2243
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-whatsapp ssbp-btn' : '';
2244
- $html_share_buttons = '';
2245
-
2246
- // Add li if plus.
2247
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2248
- $html_share_buttons .= '<li class="ssbp-li--whatsapp">';
2249
- }
2250
-
2251
- // Whatsapp share link.
2252
- $html_share_buttons .= '<a data-site="whatsapp" class="ssba_whatsapp_share ssba_share_link' . esc_attr($plus_class) . '" href="whatsapp://send?text=' . rawurlencode($url_current_page . ' ' . $str_page_title) . '" ' . esc_attr($target . $nofollow) . '>';
2253
-
2254
- // If image set is not custom.
2255
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
2256
- // Show ssba image.
2257
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/whatsapp.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Whatsapp" class="ssba ssba-img" alt="Share on Whatsapp" />';
2258
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
2259
- // Show custom image.
2260
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_whatsapp']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Whatsapp" class="ssba ssba-img" alt="Share on Whatsapp" />';
2261
- }
2262
-
2263
- // Close href.
2264
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2265
-
2266
- // Close href.
2267
- $html_share_buttons .= '</a>';
2268
-
2269
- // Add closing li if plus.
2270
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2271
- $html_share_buttons .= '</li>';
2272
- }
2273
-
2274
- // Return share buttons.
2275
- return $html_share_buttons;
2276
- }
2277
-
2278
- /**
2279
- * Get xing button.
2280
- *
2281
- * @param array $arr_settings The current ssba settings.
2282
- * @param string $url_current_page The current page url.
2283
- * @param string $str_page_title The page title.
2284
- * @param bool $boo_show_share_count Show share count or not.
2285
- *
2286
- * @return string
2287
- */
2288
- public function ssba_xing($arr_settings, $url_current_page, $str_page_title, $boo_show_share_count)
2289
- {
2290
- $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
2291
- $network = 'Xing';
2292
- $target =
2293
- ('Y' === $arr_settings['ssba_plus_share_new_window']
2294
- && 'Y' === $arr_settings['ssba_new_buttons']
2295
- && ! isset($arr_settings['bar_call']
2296
- ))
2297
- ||
2298
- ('Y' === $arr_settings['ssba_share_new_window']
2299
- && 'Y' !== $arr_settings['ssba_new_buttons']
2300
- && ! isset($arr_settings['bar_call']
2301
- ))
2302
- ||
2303
- ('Y' === $arr_settings['ssba_bar_share_new_window']
2304
- && isset($arr_settings['bar_call']
2305
- )) ? ' target="_blank" ' : '';
2306
- $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call']) ? ' ssbp-xing ssbp-btn' : '';
2307
- $html_share_buttons = '';
2308
-
2309
- // Add li if plus.
2310
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2311
- $html_share_buttons .= '<li class="ssbp-li--xing">';
2312
- }
2313
-
2314
- // Xing share link.
2315
- $html_share_buttons .= '<a data-site="xing" class="ssba_xing_share ssba_share_link' . esc_attr($plus_class) . '" href="https://www.xing.com/spi/shares/new?url=' . $url_current_page . '" ' . esc_attr($target . $nofollow) . '>';
2316
-
2317
- // If image set is not custom.
2318
- if ('custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) {
2319
- // Show ssba image.
2320
- $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr($arr_settings['ssba_image_set']) . '/xing.png" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Xing" class="ssba ssba-img" alt="Share on Xing" />';
2321
- } elseif ('Y' !== $arr_settings['ssba_new_buttons'] && ! isset($arr_settings['bar_call'])) { // If using custom images.
2322
- // Show custom image.
2323
- $html_share_buttons .= '<img src="' . esc_url($arr_settings['ssba_custom_xing']) . '" style="width: ' . esc_html($arr_settings['ssba_size']) . 'px;" title="Xing" class="ssba ssba-img" alt="Share on Xing" />';
2324
- }
2325
-
2326
- // Close href.
2327
- $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2328
-
2329
- // Close href.
2330
- $html_share_buttons .= '</a>';
2331
-
2332
- // Add closing li if plus.
2333
- if ('Y' === $arr_settings['ssba_new_buttons'] || isset($arr_settings['bar_call'])) {
2334
- $html_share_buttons .= '</li>';
2335
- }
2336
-
2337
- // Return share buttons.
2338
- return $html_share_buttons;
2339
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2340
  }
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
+ class Buttons {
16
+
17
+
18
+ /**
19
+ * Plugin instance.
20
+ *
21
+ * @var object
22
+ */
23
+ public $plugin;
24
+
25
+ /**
26
+ * Simple Share Buttons Adder instance.
27
+ *
28
+ * @var object
29
+ */
30
+ public $class_ssba;
31
+
32
+ /**
33
+ * Admin Panel Class.
34
+ *
35
+ * @var object
36
+ */
37
+ public $admin_panel;
38
+
39
+ /**
40
+ * Class constructor.
41
+ *
42
+ * @param object $plugin Plugin class.
43
+ * @param object $class_ssba Simple Share Buttons Adder class.
44
+ * @param object $admin_panel Admin panel.
45
+ */
46
+ public function __construct( $plugin, $class_ssba, $admin_panel ) {
47
+ $this->plugin = $plugin;
48
+ $this->class_ssba = $class_ssba;
49
+ $this->admin_panel = $admin_panel;
50
+ }
51
+
52
+ /**
53
+ * Enqueue font awesome.
54
+ *
55
+ * @action wp_enqueue_scripts
56
+ */
57
+ public function font_awesome() {
58
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-font-awesome" );
59
+
60
+ $html_share_buttons_form = '';
61
+
62
+ // Get settings.
63
+ $arr_settings = $this->class_ssba->get_ssba_settings();
64
+
65
+ // Get the font family needed.
66
+ $html_share_buttons_form .= $this->admin_panel->get_font_family();
67
+
68
+ // If left to right.
69
+ if ( is_rtl() ) {
70
+ // Move save button.
71
+ $html_share_buttons_form .= '.ssba-btn-save{ left: 0!important;
 
72
  right: auto !important;
73
  border-radius: 0 5px 5px 0; }';
74
+ }
75
+
76
+ wp_add_inline_style( "{$this->plugin->assets_prefix}-ssba", $html_share_buttons_form );
77
+ }
78
+
79
+ /**
80
+ * Format the returned number.
81
+ *
82
+ * @param integer $int_number The number to format.
83
+ *
84
+ * @return string
85
+ */
86
+ public function ssba_format_number( $int_number ) {
87
+ // If the number is greater than or equal to 1000.
88
+ if ( $int_number >= 1000 ) {
89
+ // Divide by 1000 and add k.
90
+ $int_number = round( ( $int_number / 1000 ), 1 ) . 'k';
91
+ }
92
+
93
+ // Return the number.
94
+ return $int_number;
95
+ }
96
+
97
+ /**
98
+ * Adds a filter around the content.
99
+ *
100
+ * @action wp_head, 99
101
+ */
102
+ public function ssba_add_button_filter() {
103
+ $arr_settings = $this->class_ssba->get_ssba_settings();
104
+
105
+ add_filter( 'the_content', array( $this, 'show_share_buttons' ), (int) $arr_settings['ssba_content_priority'] );
106
+
107
+ // If we wish to add to excerpts.
108
+ if ( isset( $arr_settings['ssba_excerpts'] ) && 'Y' !== $arr_settings['ssba_excerpts'] ) {
109
+ add_filter( 'the_excerpt', array( $this, 'show_share_buttons' ) );
110
+ }
111
+ }
112
+
113
+ /**
114
+ * Call back for showing share buttons.
115
+ *
116
+ * @param string $content The current page or post content.
117
+ * @param bool $boo_shortcode Whether to use shortcode or not.
118
+ * @param array $atts Manual replacements for page url/title.
119
+ *
120
+ * @return string
121
+ */
122
+ public function show_share_buttons( $content, $boo_shortcode = false, $atts = '' ) {
123
+ global $post;
124
+
125
+ // Variables.
126
+ $html_content = $content;
127
+ $str_share_text = '';
128
+ $pattern = get_shortcode_regex();
129
+
130
+ // Ssba_hide shortcode is in the post content and instance is not called by shortcode ssba.
131
+ if ( isset( $post->post_content )
132
+ &&
133
+ preg_match_all( '/' . $pattern . '/s', $post->post_content, $matches )
134
+ &&
135
+ array_key_exists( 2, $matches )
136
+ &&
137
+ in_array( 'ssba_hide', $matches[2], true )
138
+ &&
139
+ ! $boo_shortcode
140
+ ) {
141
+ // Exit the function returning the content without the buttons.
142
+ return $content;
143
+ }
144
+
145
+ // Get sbba settings.
146
+ $arr_settings = $this->class_ssba->get_ssba_settings();
147
+
148
+ $page_title = $post->post_title;
149
+ $plus_omit_pages = ! empty( $arr_settings['ssba_omit_pages_plus'] ) ? explode( ',', $arr_settings['ssba_omit_pages_plus'] ) : '';
150
+ $plus_omitted = is_array( $plus_omit_pages ) ? in_array( $page_title, array_map( 'trim', $plus_omit_pages ), true ) : false;
151
+ $omit_pages = ! empty( $arr_settings['ssba_omit_pages'] ) ? explode( ',', $arr_settings['ssba_omit_pages'] ) : '';
152
+ $omitted = is_array( $omit_pages ) ? in_array( $page_title, array_map( 'trim', $omit_pages ), true ) : false;
153
+
154
+ if ( ( 'Y' === $arr_settings['ssba_new_buttons'] && $plus_omitted ) || ( 'Y' !== $arr_settings['ssba_new_buttons'] && $omitted ) ) {
155
+ return $content;
156
+ }
157
+
158
+ // Placement on pages/posts/categories/archives/homepage.
159
+ if ( ( ! is_home() && ! is_front_page() && is_page() && ( 'Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_pages'] || ( 'Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_pages'] ) ) )
160
+ ||
161
+ ( is_single() && ( 'Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_posts'] || ( 'Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_posts'] ) ) )
162
+ ||
163
+ ( is_category() && ( 'Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_cats_archs'] || ( 'Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_cats_archs'] ) ) )
164
+ ||
165
+ ( is_archive() && ( 'Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_cats_archs'] || ( 'Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_cats_archs'] ) ) )
166
+ ||
167
+ ( ( is_home() || is_front_page() ) && ( 'Y' !== $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_homepage'] || ( 'Y' === $arr_settings['ssba_new_buttons'] && 'Y' === $arr_settings['ssba_plus_homepage'] ) ) )
168
+ ||
169
+ $boo_shortcode
170
+ ) {
171
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-ssba" );
172
+
173
+ // If not shortcode.
174
+ if ( isset( $atts['widget'] ) && 'Y' === $atts['widget'] && '' === $arr_settings['ssba_widget_text'] ) { // Use widget share text.
175
+ $str_share_text = $arr_settings['ssba_widget_text'];
176
+ } else { // Use normal share text.
177
+ $str_share_text = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_share_text'] : $arr_settings['ssba_plus_share_text'];
178
+ }
179
+
180
+ // Text placement.
181
+ $text_placement = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_text_placement'] : $arr_settings['ssba_plus_text_placement'];
182
+
183
+ // Link or no.
184
+ $text_link = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_link_to_ssb'] : $arr_settings['ssba_plus_link_to_ssb'];
185
+
186
+ // Post id.
187
+ $int_post_id = $post->ID;
188
+
189
+ // Button Position.
190
+ $button_position = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_before_or_after'] : $arr_settings['ssba_before_or_after_plus'];
191
+
192
+ // Button alignment.
193
+ $alignment = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['ssba_align'] : $arr_settings['ssba_plus_align'];
194
+
195
+ // Wrap id.
196
+ $wrap_id = 'Y' !== $arr_settings['ssba_new_buttons'] ? 'ssba-classic-2' : 'ssba-modern-2';
197
+
198
+ // Ssba div.
199
+ $html_share_buttons = '<!-- Simple Share Buttons Adder (' . esc_html( SSBA_VERSION ) . ') simplesharebuttons.com --><div class="' . esc_attr( $wrap_id ) . ' ssba ssbp-wrap' . esc_attr( ' ' . $arr_settings['ssba_plus_align'] ) . ' ssbp--theme-' . esc_attr( $arr_settings['ssba_plus_button_style'] ) . '">';
200
+
201
+ // Center if set so.
202
+ $html_share_buttons .= '<div style="text-align:' . esc_attr( $alignment ) . '">';
203
+
204
+ // Add custom text if set and set to placement above or left.
205
+ if ( '' !== $str_share_text && ( 'above' === $text_placement || 'left' === $text_placement ) ) {
206
+ // Check if user has left share link box checked.
207
+ if ( 'Y' === $text_link ) {
208
+ // Share text with link.
209
+ $html_share_buttons .= '<a href="https://simplesharebuttons.com" target="_blank" class="ssba-share-text">' . esc_html( $str_share_text ) . '</a>';
210
+ } else {
211
+ // Share text.
212
+ $html_share_buttons .= '<span class="ssba-share-text">' . esc_html( $str_share_text ) . '</span>';
213
+ }
214
+ // Add a line break if set to above.
215
+ $html_share_buttons .= 'above' === $text_placement ? '<br/>' : '';
216
+ }
217
+
218
+ // If running standard.
219
+ if ( ! $boo_shortcode ) {
220
+ // Use WordPress functions for page/post details.
221
+ $url_current_page = get_permalink( $post->ID );
222
+ $str_page_title = get_the_title( $post->ID );
223
+ } else { // Using shortcode.
224
+ // Set page URL and title as set by user or get if needed.
225
+ $url_current_page = isset( $atts['url'] ) ? esc_url( $atts['url'] ) : $this->ssba_current_url( $atts );
226
+ $str_page_title = ( isset( $atts['title'] ) ? $atts['title'] : get_the_title() );
227
+ }
228
+
229
+ // Strip any unwanted tags from the page title.
230
+ $str_page_title = esc_attr( wp_strip_all_tags( $str_page_title ) );
231
+
232
+ // The buttons.
233
+ $html_share_buttons .= $this->get_share_buttons( $arr_settings, $url_current_page, $str_page_title, $int_post_id );
234
+
235
+ // Add custom text if set and set to placement right or below.
236
+ if ( '' !== $str_share_text && ( 'right' === $text_placement || 'below' === $text_placement ) ) {
237
+ // Add a line break if set to above.
238
+ $html_share_buttons .= 'below' === $text_placement ? '<br/>' : '';
239
+
240
+ // Check if user has checked share link option.
241
+ if ( 'Y' === $text_link ) {
242
+ // Share text with link.
243
+ $html_share_buttons .= '<a href="https://simplesharebuttons.com" target="_blank" class="ssba-share-text">' . esc_html( $str_share_text ) . '</a>';
244
+ } else { // Just display the share text.
245
+ // Share text.
246
+ $html_share_buttons .= '<span class="ssba-share-text">' . esc_html( $str_share_text ) . '</span>';
247
+ }
248
+ }
249
+
250
+ // Close center if set.
251
+ $html_share_buttons .= '</div></div>';
252
+
253
+ // If not using shortcode.
254
+ if ( ! $boo_shortcode ) {
255
+ // Switch for placement of ssba.
256
+ switch ( $button_position ) {
257
+ case 'before': // Before the content.
258
+ $html_content = $html_share_buttons . $content;
259
+ break;
260
+ case 'after': // After the content.
261
+ $html_content = $content . $html_share_buttons;
262
+ break;
263
+ case 'both': // Before and after the content.
264
+ $html_content = $html_share_buttons . $content . $html_share_buttons;
265
+ break;
266
+ }
267
+ } else { // If using shortcode.
268
+ // Just return buttons.
269
+ $html_content = $html_share_buttons;
270
+ }
271
+ }
272
+
273
+ // Return content and share buttons.
274
+ return $html_content;
275
+ }
276
+
277
+ /**
278
+ * Function that shows the share bar if enabled.
279
+ *
280
+ * @action wp_head, 99
281
+ */
282
+ public function show_share_bar() {
283
+ global $post, $wp;
284
+
285
+ // Get sbba settings.
286
+ $arr_settings = $this->class_ssba->get_ssba_settings();
287
+ $page_title = isset( $post->post_title ) ? $post->post_title : '';
288
+ $omit_pages = ! empty( $arr_settings['ssba_omit_pages_bar'] ) ? explode(
289
+ ',',
290
+ $arr_settings['ssba_omit_pages_bar']
291
+ ) : '';
292
+ $omitted = is_array( $omit_pages ) ? in_array( $page_title, array_map( 'trim', $omit_pages ), true ) : false;
293
+
294
+ if ( ( 'Y' !== $arr_settings['ssba_bar_desktop'] && ! wp_is_mobile() ) || ( 'Y' !== $arr_settings['ssba_bar_mobile'] && wp_is_mobile() ) || 'Y' !== $arr_settings['ssba_bar_enabled'] || $omitted ) {
295
+ return;
296
+ }
297
+
298
+ // Get current url.
299
+ $url_current_page = home_url( add_query_arg( array(), $wp->request ) );
300
+
301
+ // Placement on pages/posts/categories/archives/homepage.
302
+ if (
303
+ ( ! is_home() && ! is_front_page() && is_page() && isset( $arr_settings['ssba_bar_pages'] ) && 'Y' === $arr_settings['ssba_bar_pages'] )
304
+ ||
305
+ ( is_single() && isset( $arr_settings['ssba_bar_posts'] ) && 'Y' === $arr_settings['ssba_bar_posts'] )
306
+ ||
307
+ ( is_category() && isset( $arr_settings['ssba_bar_cats_archs'] ) && 'Y' === $arr_settings['ssba_bar_cats_archs'] )
308
+ ||
309
+ ( is_archive() && isset( $arr_settings['ssba_bar_cats_archs'] ) && 'Y' === $arr_settings['ssba_bar_cats_archs'] )
310
+ ||
311
+ ( ( is_home() || is_front_page() ) && isset( $arr_settings['ssba_bar_homepage'] ) && 'Y' === $arr_settings['ssba_bar_homepage'] )
312
+ ) {
313
+
314
+ if ( ! wp_style_is( "{$this->plugin->assets_prefix}-ssba", 'enqueued' ) ) {
315
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-ssba" );
316
+ }
317
+
318
+ $html_share_buttons = '<div id="ssba-bar-2" class="' . esc_attr( $arr_settings['ssba_bar_position'] ) . ' ssbp-wrap ssbp--theme-' . esc_attr( $arr_settings['ssba_bar_style'] ) . '" >';
319
+ $html_share_buttons .= '<div class="ssbp-container">';
320
+ $html_share_buttons .= '<ul class="ssbp-bar-list">';
321
+
322
+ // The buttons.
323
+ $html_share_buttons .= $this->get_share_bar( $arr_settings, $url_current_page, $post->post_title, $post->ID );
324
+ $html_share_buttons .= '</div></ul>';
325
+ $html_share_buttons .= '</div>';
326
+
327
+ echo $html_share_buttons; // phpcs:ignore XSS ok. Pinterest contains javascript. Cannot sanitize output.
328
+ }
329
+ }
330
+
331
+ /**
332
+ * Shortcode for adding buttons.
333
+ *
334
+ * @param array $atts The current shortcodes attributes.
335
+ *
336
+ * @shortcode ssba-buttons
337
+ *
338
+ * @return string
339
+ */
340
+ public function ssba_buttons( $atts ) {
341
+ // Get buttons - NULL for $content, TRUE for shortcode flag.
342
+ $html_share_buttons = $this->show_share_buttons( null, true, $atts );
343
+
344
+ // Return buttons.
345
+ return $html_share_buttons;
346
+ }
347
+
348
+ /**
349
+ * Shortcode for adding buttons.
350
+ *
351
+ * @param array $atts The current shortcodes attributes.
352
+ *
353
+ * @shortcode ssba
354
+ *
355
+ * @return string
356
+ */
357
+ public function ssba_orig_buttons( $atts ) {
358
+ // Get buttons - NULL for $content, TRUE for shortcode flag.
359
+ $html_share_buttons = $this->show_share_buttons( null, true, $atts );
360
+
361
+ // Return buttons.
362
+ return $html_share_buttons;
363
+ }
364
+
365
+ /**
366
+ * Shortcode for hiding buttons
367
+ *
368
+ * @param string $content The current page or posts content.
369
+ *
370
+ * @shortcode ssba_hide
371
+ */
372
+ public function ssba_hide( $content ) {
373
+ // No need to do anything here!
374
+ }
375
+
376
+ /**
377
+ * Get URL function.
378
+ *
379
+ * @param array $atts The supplied attributes.
380
+ *
381
+ * @return string
382
+ */
383
+ public function ssba_current_url( $atts ) {
384
+ global $post;
385
+
386
+ if ( ! isset( $_SERVER['SERVER_NAME'] ) || ! isset( $_SERVER['REQUEST_URI'] ) ) {
387
+ return;
388
+ }
389
+
390
+ // If multisite has been set to true.
391
+ if ( isset( $atts['multisite'] ) && isset( $_SERVER['QUERY_STRING'] ) ) {
392
+ global $wp;
393
+
394
+ $url = add_query_arg( sanitize_text_field( wp_unslash( $_SERVER['QUERY_STRING'] ) ), '', home_url( $wp->request ) ); // WPCS: CSRF ok.
395
+
396
+ return esc_url( $url );
397
+ }
398
+
399
+ // Add http.
400
+ $url_current_page = 'http';
401
+
402
+ // Add s to http if required.
403
+ if ( isset( $_SERVER['HTTPS'] ) && 'on' === $_SERVER['HTTPS'] ) {
404
+ $url_current_page .= 's';
405
+ }
406
+
407
+ // Add colon and forward slashes.
408
+ $url_current_page .= '://' . sanitize_text_field( wp_unslash( $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] ) );
409
+
410
+ $url_current_page = '_' === $_SERVER['SERVER_NAME'] ? get_permalink( $post->ID ) : $url_current_page;
411
+
412
+ // Return url.
413
+ return esc_url( $url_current_page );
414
+ }
415
+
416
+ /**
417
+ * Get set share buttons.
418
+ *
419
+ * @param array $arr_settings The current ssba settings.
420
+ * @param string $url_current_page The current pages url.
421
+ * @param string $str_page_title The page title.
422
+ * @param integer $int_post_id The post id.
423
+ *
424
+ * @return string
425
+ */
426
+ public function get_share_buttons( $arr_settings, $url_current_page, $str_page_title, $int_post_id ) {
427
+ // Variables.
428
+ $html_share_buttons = '';
429
+
430
+ // Explode saved include list and add to a new array.
431
+ $arr_selected_ssba = 'Y' === $arr_settings['ssba_new_buttons'] ? explode( ',', $arr_settings['ssba_selected_plus_buttons'] ) : explode( ',', $arr_settings['ssba_selected_buttons'] );
432
+
433
+ // Check if array is not empty.
434
+ if ( is_array( $arr_selected_ssba ) && '' !== $arr_selected_ssba[0] ) {
435
+ // Add post ID to settings array.
436
+ $arr_settings['post_id'] = $int_post_id;
437
+
438
+ // If show counters option is selected.
439
+ if ( 'Y' === $arr_settings['ssba_show_share_count'] ) {
440
+ // Set show flag to true.
441
+ $boo_show_share_count = true;
442
+
443
+ // If show counters once option is selected.
444
+ if ( 'Y' === $arr_settings['ssba_share_count_once'] ) {
445
+ // If not a page or post.
446
+ if ( ! is_page() && ! is_single() ) {
447
+ // Let show flag to false.
448
+ $boo_show_share_count = false;
449
+ }
450
+ }
451
+ } else {
452
+ // Set show flag to false.
453
+ $boo_show_share_count = false;
454
+ }
455
+
456
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] ) {
457
+ $html_share_buttons .= '<ul class="ssbp-list">';
458
+ }
459
+
460
+ // For each included button.
461
+ foreach ( $arr_selected_ssba as $str_selected ) {
462
+ $str_get_button = 'ssba_' . $str_selected;
463
+
464
+ // Add a list item for each selected option.
465
+ $html_share_buttons .= $this->$str_get_button( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count );
466
+ }
467
+
468
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] ) {
469
+ $html_share_buttons .= '</ul>';
470
+ }
471
+ }
472
+
473
+ // Return share buttons.
474
+ return $html_share_buttons;
475
+ }
476
+
477
+ /**
478
+ * Get facebook button.
479
+ *
480
+ * @param array $arr_settings The current ssba settings.
481
+ * @param string $url_current_page The current page url.
482
+ * @param string $str_page_title The page title.
483
+ * @param bool $boo_show_share_count Show share count or not.
484
+ *
485
+ * @return string
486
+ */
487
+ public function ssba_facebook( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
488
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
489
+ $network = 'Facebook';
490
+ $target =
491
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
492
+ && 'Y' === $arr_settings['ssba_new_buttons']
493
+ && false === isset(
494
+ $arr_settings['bar_call']
495
+ ) )
496
+ ||
497
+ ( 'Y' === $arr_settings['ssba_share_new_window']
498
+ && 'Y' !== $arr_settings['ssba_new_buttons']
499
+ && false === isset(
500
+ $arr_settings['bar_call']
501
+ ) )
502
+ ||
503
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset( $arr_settings['bar_call'] ) ) ? ' target="_blank" ' : '';
504
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-facebook ssbp-btn' : '';
505
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
506
+ $html_share_buttons = '';
507
+
508
+ // Add li if plus.
509
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
510
+ $html_share_buttons .= '<li class="ssbp-li--facebook">';
511
+ }
512
+
513
+ // If the sharethis terms have been accepted.
514
+ if ( 'Y' === $arr_settings['accepted_sharethis_terms'] && '' !== $arr_settings['facebook_app_id'] ) {
515
+ // Facebook share link.
516
+ $html_share_buttons .= '<a data-site="" data-facebook="mobile" class="ssba_facebook_share' . esc_attr( $plus_class ) . '" data-href="' . esc_attr( $url_current_page ) . '" href="https://www.facebook.com/dialog/share?app_id=' . esc_attr( $arr_settings['facebook_app_id'] ) . '&display=popup&href=' . esc_attr( $url_current_page ) . '&redirect_uri=' . esc_url( $url_current_page ) . '" ' . esc_attr( $target . $nofollow ) . '>';
517
+ } else {
518
+ // Facebook share link.
519
+ $html_share_buttons .= '<a data-site="" class="ssba_facebook_share' . esc_attr( $plus_class ) . '" href="http://www.facebook.com/sharer.php?u=' . esc_attr( $url_current_page ) . '" ' . $target . $nofollow . '>';
520
+ }
521
+
522
+ // If not using custom.
523
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
524
+ // Show selected ssba image.
525
+ $html_share_buttons .= '<img src="' . esc_url( plugins_url() ) . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/facebook.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Facebook" class="ssba ssba-img" alt="Share on Facebook" />';
526
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
527
+ // Show custom image.
528
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_facebook'] ) . '" title="Facebook" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" class="ssba ssba-img" alt="Share on Facebook" />';
529
+ }
530
+
531
+ // Close href.
532
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
533
+
534
+ // Close href.
535
+ $html_share_buttons .= '</a>';
536
+
537
+ // If show share count is set to Y.
538
+ if ( ( ( 'Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'] )
539
+ ||
540
+ ( 'Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'] )
541
+ ||
542
+ ( 'Y' === $arr_settings['ssba_bar_show_share_count'] && isset( $arr_settings['bar_call'] )
543
+ )
544
+ && $boo_show_share_count
545
+ ) ) {
546
+ // Get and add facebook share count.
547
+ $html_share_buttons .= '<span class="' . esc_attr( $count_class ) . '">' . esc_html( $this->get_facebook_share_count( $url_current_page, $arr_settings ) ) . '</span>';
548
+ }
549
+
550
+ // Add closing li if plus.
551
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
552
+ $html_share_buttons .= '</li>';
553
+ }
554
+
555
+ // Return share buttons.
556
+ return $html_share_buttons;
557
+ }
558
+
559
+ /**
560
+ * Get set share buttons.
561
+ *
562
+ * @param array $arr_settings The current ssba settings.
563
+ * @param string $url_current_page The current pages url.
564
+ * @param string $str_page_title The page title.
565
+ * @param integer $int_post_id The post id.
566
+ *
567
+ * @return string
568
+ */
569
+ public function get_share_bar( $arr_settings, $url_current_page, $str_page_title, $int_post_id ) {
570
+ // Variables.
571
+ $html_share_buttons = '';
572
+
573
+ // Set bar call.
574
+ $arr_settings = array_merge(
575
+ $arr_settings,
576
+ array(
577
+ 'bar_call' => 'Y',
578
+ )
579
+ );
580
+
581
+ // Explode saved include list and add to a new array.
582
+ $arr_selected_ssba = explode( ',', $arr_settings['ssba_selected_bar_buttons'] );
583
+
584
+ // Check if array is not empty.
585
+ if ( '' !== $arr_settings['ssba_selected_bar_buttons'] ) {
586
+ // Add post ID to settings array.
587
+ $arr_settings['post_id'] = $int_post_id;
588
+
589
+ // If show counters option is selected.
590
+ if ( 'Y' === $arr_settings['ssba_bar_show_share_count'] ) {
591
+ // Set show flag to true.
592
+ $boo_show_share_count = true;
593
+
594
+ // If show counters once option is selected.
595
+ if ( isset( $arr_settings['ssba_bar_count_once'] ) && 'Y' === $arr_settings['ssba_bar_count_once'] ) {
596
+ // If not a page or post.
597
+ if ( ! is_page() && ! is_single() ) {
598
+ // Let show flag to false.
599
+ $boo_show_share_count = false;
600
+ }
601
+ }
602
+ } else {
603
+ // Set show flag to false.
604
+ $boo_show_share_count = false;
605
+ }
606
+
607
+ // For each included button.
608
+ foreach ( $arr_selected_ssba as $str_selected ) {
609
+ if ( '' !== $str_selected ) {
610
+ $str_get_button = 'ssba_' . $str_selected;
611
+
612
+ // Add a list item for each selected option.
613
+ $html_share_buttons .= $this->$str_get_button( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count );
614
+ }
615
+ }
616
+ }
617
+
618
+ // Return share buttons.
619
+ return $html_share_buttons;
620
+ }
621
+
622
+ /**
623
+ * Get facebook button.
624
+ *
625
+ * @param array $arr_settings The current ssba settings.
626
+ * @param string $url_current_page The current page url.
627
+ * @param string $str_page_title The page title.
628
+ * @param bool $boo_show_share_count Show share count or not.
629
+ *
630
+ * @return string
631
+ */
632
+ public function ssba_facebook_save( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
633
+ $html_share_buttons = '';
634
+
635
+ // If the sharethis terms have been accepted.
636
+ if ( 'Y' === $arr_settings['accepted_sharethis_terms'] && ! isset( $arr_settings['bar_call'] ) ) {
637
+ // Add li if plus.
638
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
639
+ $html_share_buttons .= '<li class="ssbp-li--fb-save">';
640
+ }
641
+
642
+ // Add facebook save button.
643
+ $html_share_buttons .= '<span class="fb-save" style="display:inline-block" data-uri="' . esc_attr( $url_current_page ) . '"></span>';
644
+
645
+ // Add li if plus.
646
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || $arr_settings['bar_call'] ) {
647
+ $html_share_buttons .= '</li>';
648
+ }
649
+ }
650
+
651
+ return $html_share_buttons;
652
+ }
653
+
654
+ /**
655
+ * Get facebook share count.
656
+ *
657
+ * @param string $url_current_page Current url.
658
+ * @param array $arr_settings Current ssba settings.
659
+ *
660
+ * @return string
661
+ */
662
+ public function get_facebook_share_count( $url_current_page, $arr_settings ) {
663
+ $cache_key = sprintf(
664
+ 'facebook_sharecount_%s',
665
+ wp_hash( $url_current_page )
666
+ );
667
+
668
+ // Get the longer cached value from the Transient API.
669
+ $long_cached_count = get_transient( "ssba_{$cache_key}" );
670
+ if ( false === $long_cached_count ) {
671
+ $long_cached_count = 0;
672
+ }
673
+
674
+ // If sharedcount.com is enabled.
675
+ if ( ( ( 'Y' === $arr_settings['sharedcount_enabled'] && 'Y' !== $arr_settings['ssba_new_buttons'] )
676
+ ||
677
+ ( isset( $arr_settings['plus_sharedcount_enabled'] ) && 'Y' === $arr_settings['plus_sharedcount_enabled'] && 'Y' === $arr_settings['ssba_new_buttons'] )
678
+ ||
679
+ ( isset( $arr_settings['bar_sharedcount_enabled'] ) && 'Y' === $arr_settings['bar_sharedcount_enabled'] && isset( $arr_settings['bar_call'] )
680
+ )
681
+ ) ) {
682
+
683
+ $shared_plan = 'Y' !== $arr_settings['ssba_new_buttons'] ? $arr_settings['sharedcount_plan'] : '';
684
+ $shared_plan = '' === $shared_plan && 'Y' === $arr_settings['ssba_new_buttons'] ? $arr_settings['plus_sharedcount_plan'] : '';
685
+ $shared_plan = isset( $arr_settings['bar_call'] ) ? $arr_settings['bar_sharedcount_plan'] : '';
686
+
687
+ // Request from sharedcount.com.
688
+ $sharedcount = wp_safe_remote_get(
689
+ 'https://' . $shared_plan . '.sharedcount.com/url?url=' . $url_current_page . '&apikey=' . $arr_settings['sharedcount_api_key'],
690
+ array(
691
+ 'timeout' => 6,
692
+ )
693
+ );
694
+
695
+ // If no error.
696
+ if ( is_wp_error( $sharedcount ) ) {
697
+ return $this->ssba_format_number( $long_cached_count );
698
+ }
699
+
700
+ // Decode and return count.
701
+ $shared_resp = json_decode( $sharedcount['body'], true );
702
+ $sharedcount = $long_cached_count;
703
+
704
+ if ( isset( $shared_resp['Facebook']['share_count'] ) ) {
705
+ $sharedcount = (int) $shared_resp['Facebook']['share_count'];
706
+ wp_cache_set( $cache_key, $sharedcount, 'ssba', MINUTE_IN_SECONDS * 2 );
707
+ set_transient( "ssba_{$cache_key}", $sharedcount, DAY_IN_SECONDS );
708
+ }
709
+
710
+ return $this->ssba_format_number( $sharedcount );
711
+ } else {
712
+ // Get results from facebook.
713
+ $html_facebook_share_details = wp_safe_remote_get(
714
+ 'http://graph.facebook.com/' . $url_current_page,
715
+ array(
716
+ 'timeout' => 6,
717
+ )
718
+ );
719
+
720
+ // If no error.
721
+ if ( is_wp_error( $html_facebook_share_details ) ) {
722
+ return $this->ssba_format_number( $long_cached_count );
723
+ }
724
+
725
+ // Decode and return count.
726
+ $arr_facebook_share_details = json_decode( $html_facebook_share_details['body'], true );
727
+ $int_facebook_share_count = $long_cached_count;
728
+
729
+ if ( isset( $arr_facebook_share_details['share']['share_count'] ) ) {
730
+ $int_facebook_share_count = (int) $arr_facebook_share_details['share']['share_count'];
731
+
732
+ wp_cache_set( $cache_key, $int_facebook_share_count, 'ssba', MINUTE_IN_SECONDS * 2 );
733
+ set_transient( "ssba_{$cache_key}", $int_facebook_share_count, DAY_IN_SECONDS );
734
+ }
735
+
736
+ return $this->ssba_format_number( $int_facebook_share_count );
737
+ }
738
+ }
739
+
740
+ /**
741
+ * Get twitter button.
742
+ *
743
+ * @param array $arr_settings The current ssba settings.
744
+ * @param string $url_current_page The current page url.
745
+ * @param string $str_page_title The page title.
746
+ * @param bool $boo_show_share_count Show share count or not.
747
+ *
748
+ * @return string
749
+ */
750
+ public function ssba_twitter( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
751
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
752
+ $network = 'Twitter';
753
+ $target =
754
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
755
+ && 'Y' === $arr_settings['ssba_new_buttons']
756
+ && ! isset(
757
+ $arr_settings['bar_call']
758
+ ) )
759
+ ||
760
+ ( 'Y' === $arr_settings['ssba_share_new_window']
761
+ && 'Y' !== $arr_settings['ssba_new_buttons']
762
+ && ! isset(
763
+ $arr_settings['bar_call']
764
+ ) )
765
+ ||
766
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset(
767
+ $arr_settings['bar_call']
768
+ ) ) ? ' target="_blank" ' : '';
769
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-twitter ssbp-btn' : '';
770
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
771
+ $html_share_buttons = '';
772
+
773
+ // Format the URL into friendly code.
774
+ $twitter_share_text = rawurlencode(
775
+ html_entity_decode(
776
+ $str_page_title . ' ' . $arr_settings['ssba_twitter_text'],
777
+ ENT_COMPAT,
778
+ 'UTF-8'
779
+ )
780
+ );
781
+
782
+ // Add li if plus.
783
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
784
+ $html_share_buttons .= '<li class="ssbp-li--twitter">';
785
+ }
786
+
787
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] && ! empty( $arr_settings['ssba_plus_twitter_text'] ) ) {
788
+ $twitter_share_text = rawurlencode(
789
+ html_entity_decode(
790
+ $str_page_title . ' ' . $arr_settings['ssba_plus_twitter_text'],
791
+ ENT_COMPAT,
792
+ 'UTF-8'
793
+ )
794
+ );
795
+ }
796
+
797
+ if ( isset( $arr_settings['bar_call'] ) && ! empty( $arr_settings['ssba_bar_twitter_text'] ) ) {
798
+ $twitter_share_text = rawurlencode(
799
+ html_entity_decode(
800
+ $str_page_title . ' ' . $arr_settings['ssba_bar_twitter_text'],
801
+ ENT_COMPAT,
802
+ 'UTF-8'
803
+ )
804
+ );
805
+ }
806
+
807
+ // Twitter share link.
808
+ $html_share_buttons .= '<a data-site="" class="ssba_twitter_share' . esc_attr( $plus_class ) . '" href="http://twitter.com/share?url=' . esc_attr( $url_current_page ) . '&amp;text=' . esc_attr( $twitter_share_text ) . '" ' . esc_attr( $target . $nofollow ) . '>';
809
+
810
+ // If image set is not custom.
811
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
812
+ // Show ssba image.
813
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/twitter.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Twitter" class="ssba ssba-img" alt="Tweet about this on Twitter" />';
814
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
815
+ // Show custom image.
816
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_twitter'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Twitter" class="ssba ssba-img" alt="Tweet about this on Twitter" />';
817
+ }
818
+
819
+ // Close href.
820
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
821
+
822
+ // Close href.
823
+ $html_share_buttons .= '</a>';
824
+
825
+ // Add closing li if plus.
826
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
827
+ $html_share_buttons .= '</li>';
828
+ }
829
+
830
+ // Return share buttons.
831
+ return $html_share_buttons;
832
+ }
833
+
834
+ /**
835
+ * Get google+ button.
836
+ *
837
+ * @param array $arr_settings The current ssba settings.
838
+ * @param string $url_current_page The current page url.
839
+ * @param string $str_page_title The page title.
840
+ * @param bool $boo_show_share_count Show share count or not.
841
+ *
842
+ * @return string
843
+ */
844
+ public function ssba_google( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
845
+ return '';
846
+ }
847
+
848
+ /**
849
+ * Get google share count.
850
+ *
851
+ * @param string $url_current_page The current page url.
852
+ *
853
+ * @return string
854
+ */
855
+ public function get_google_share_count( $url_current_page ) {
856
+ return '';
857
+ }
858
+
859
+ /**
860
+ * Get diggit button.
861
+ *
862
+ * @param array $arr_settings The current ssba settings.
863
+ * @param string $url_current_page The current page url.
864
+ * @param string $str_page_title The page title.
865
+ * @param bool $boo_show_share_count Show share count or not.
866
+ *
867
+ * @return string
868
+ */
869
+ public function ssba_diggit( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
870
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
871
+ $network = 'Digg';
872
+ $target =
873
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
874
+ && 'Y' === $arr_settings['ssba_new_buttons']
875
+ && ! isset(
876
+ $arr_settings['bar_call']
877
+ ) )
878
+ ||
879
+ ( 'Y' === $arr_settings['ssba_share_new_window']
880
+ && 'Y' !== $arr_settings['ssba_new_buttons']
881
+ && ! isset(
882
+ $arr_settings['bar_call']
883
+ ) )
884
+ ||
885
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset(
886
+ $arr_settings['bar_call']
887
+ ) ) ? ' target="_blank" ' : '';
888
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-diggit ssbp-btn' : '';
889
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
890
+ $html_share_buttons = '';
891
+
892
+ // Add li if plus.
893
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
894
+ $html_share_buttons .= '<li class="ssbp-li--diggit">';
895
+ }
896
+
897
+ // Diggit share link.
898
+ $html_share_buttons .= '<a data-site="digg" class="ssba_diggit_share ssba_share_link' . esc_attr( $plus_class ) . '" href="http://www.digg.com/submit?url=' . esc_attr( $url_current_page ) . '" ' . esc_attr( $target . $nofollow ) . '>';
899
+
900
+ // If image set is not custom.
901
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
902
+ // Show ssba image.
903
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/diggit.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Digg" class="ssba ssba-img" alt="Digg this" />';
904
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
905
+ // Show custom image.
906
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_diggit'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Digg" class="ssba ssba-img" alt="Digg this" />';
907
+ }
908
+
909
+ // Close href.
910
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
911
+
912
+ // Close href.
913
+ $html_share_buttons .= '</a>';
914
+
915
+ // Add closing li if plus.
916
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
917
+ $html_share_buttons .= '</li>';
918
+ }
919
+
920
+ // Return share buttons.
921
+ return $html_share_buttons;
922
+ }
923
+
924
+ /**
925
+ * Get line button.
926
+ *
927
+ * @param array $arr_settings The current ssba settings.
928
+ * @param string $url_current_page The current page url.
929
+ * @param string $str_page_title The page title.
930
+ * @param bool $boo_show_share_count Show share count or not.
931
+ *
932
+ * @return string
933
+ */
934
+ public function ssba_line( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
935
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
936
+ $network = 'Line';
937
+ $target =
938
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
939
+ && 'Y' === $arr_settings['ssba_new_buttons']
940
+ && ! isset( $arr_settings['bar_call'] ) )
941
+ ||
942
+ ( 'Y' === $arr_settings['ssba_share_new_window']
943
+ && 'Y' !== $arr_settings['ssba_new_buttons']
944
+ && ! isset( $arr_settings['bar_call'] ) )
945
+ ||
946
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset( $arr_settings['bar_call'] ) ) ? ' target="_blank" ' : '';
947
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-line ssbp-btn' : '';
948
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
949
+ $html_share_buttons = '';
950
+
951
+ // Add li if plus.
952
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
953
+ $html_share_buttons .= '<li class="ssbp-li--line">';
954
+ }
955
+
956
+ // Line share link.
957
+ $html_share_buttons .= '<a data-site="line" class="ssba_line_share ssba_share_link' . esc_attr( $plus_class ) . '" href="https://lineit.line.me/share/ui?url=' . esc_attr( $url_current_page ) . '" ' . esc_attr( $target . $nofollow ) . '>';
958
+
959
+ // If image set is not custom.
960
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
961
+ // Show ssba image.
962
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/line.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Line" class="ssba ssba-img" alt="Line" />';
963
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
964
+ // Show custom image.
965
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_line'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Line" class="ssba ssba-img" alt="Line" />';
966
+ }
967
+
968
+ // Close href.
969
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
970
+
971
+ // Close href.
972
+ $html_share_buttons .= '</a>';
973
+
974
+ // Add closing li if plus.
975
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
976
+ $html_share_buttons .= '</li>';
977
+ }
978
+
979
+ // Return share buttons.
980
+ return $html_share_buttons;
981
+ }
982
+
983
+ /**
984
+ * Get skype button.
985
+ *
986
+ * @param array $arr_settings The current ssba settings.
987
+ * @param string $url_current_page The current page url.
988
+ * @param string $str_page_title The page title.
989
+ * @param bool $boo_show_share_count Show share count or not.
990
+ *
991
+ * @return string
992
+ */
993
+ public function ssba_skype( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
994
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
995
+ $network = 'Line';
996
+ $target =
997
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
998
+ && 'Y' === $arr_settings['ssba_new_buttons']
999
+ && false === isset( $arr_settings['bar_call'] ) )
1000
+ ||
1001
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1002
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1003
+ && false === isset( $arr_settings['bar_call'] ) )
1004
+ ||
1005
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset( $arr_settings['bar_call'] ) ) ? ' target="_blank" ' : '';
1006
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-skype ssbp-btn' : '';
1007
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1008
+ $html_share_buttons = '';
1009
+
1010
+ // Add li if plus.
1011
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1012
+ $html_share_buttons .= '<li class="ssbp-li--skype">';
1013
+ }
1014
+
1015
+ // Skype share link.
1016
+ $html_share_buttons .= '<a data-site="skype" class="ssba_skype_share ssba_share_link' . esc_attr( $plus_class ) . '" href="https://web.skype.com/share?url=' . esc_attr( $url_current_page ) . '" ' . esc_attr( $target . $nofollow ) . '>';
1017
+
1018
+ // If image set is not custom.
1019
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1020
+ // Show ssba image.
1021
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/line.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Line" class="ssba ssba-img" alt="Skype" />';
1022
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1023
+ // Show custom image.
1024
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_skype'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Skype" class="ssba ssba-img" alt="skype" />';
1025
+ }
1026
+
1027
+ // Close href.
1028
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1029
+
1030
+ // Close href.
1031
+ $html_share_buttons .= '</a>';
1032
+
1033
+ // Add closing li if plus.
1034
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1035
+ $html_share_buttons .= '</li>';
1036
+ }
1037
+
1038
+ // Return share buttons.
1039
+ return $html_share_buttons;
1040
+ }
1041
+
1042
+ /**
1043
+ * Get Flipboard button.
1044
+ *
1045
+ * @param array $arr_settings The current ssba settings.
1046
+ * @param string $url_current_page The current page url.
1047
+ * @param string $str_page_title The page title.
1048
+ * @param bool $boo_show_share_count Show share count or not.
1049
+ *
1050
+ * @return string
1051
+ */
1052
+ public function ssba_flipboard( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1053
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1054
+ $network = 'Flipboard';
1055
+
1056
+ $target =
1057
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1058
+ && 'Y' === $arr_settings['ssba_new_buttons']
1059
+ && false === isset( $arr_settings['bar_call'] ) )
1060
+ ||
1061
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1062
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1063
+ && false === isset( $arr_settings['bar_call'] ) )
1064
+ ||
1065
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset( $arr_settings['bar_call'] ) ) ? ' target="_blank" ' : '';
1066
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-flipboard ssbp-btn' : '';
1067
+ $html_share_buttons = '';
1068
+
1069
+ // Add li if plus.
1070
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1071
+ $html_share_buttons .= '<li class="ssbp-li--flipboard">';
1072
+ }
1073
+
1074
+ // Flipboard share link.
1075
+ $html_share_buttons .= '<a data-site="flipboard" class="ssba_flipboard_share ssba_share_link'
1076
+ . esc_attr( $plus_class )
1077
+ . '" href="https://share.flipboard.com/bookmarklet/popout?url='
1078
+ . esc_attr( $url_current_page )
1079
+ . '&title='
1080
+ . esc_attr( rawurlencode( $str_page_title ) ) . '" '
1081
+ . esc_attr( $target . $nofollow )
1082
+ . '>';
1083
+
1084
+ // If image set is not custom.
1085
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1086
+ // Show ssba image.
1087
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/line.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Line" class="ssba ssba-img" alt="Flipboard" />';
1088
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1089
+ // Show custom image.
1090
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_flipboard'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Flipboard" class="ssba ssba-img" alt="flipboard" />';
1091
+ }
1092
+
1093
+ // Close href.
1094
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1095
+
1096
+ // Close href.
1097
+ $html_share_buttons .= '</a>';
1098
+
1099
+ // Add closing li if plus.
1100
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1101
+ $html_share_buttons .= '</li>';
1102
+ }
1103
+
1104
+ // Return share buttons.
1105
+ return $html_share_buttons;
1106
+ }
1107
+
1108
+ /**
1109
+ * Get Telegram button.
1110
+ *
1111
+ * @param array $arr_settings The current ssba settings.
1112
+ * @param string $url_current_page The current page url.
1113
+ * @param string $str_page_title The page title.
1114
+ * @param bool $boo_show_share_count Show share count or not.
1115
+ *
1116
+ * @return string
1117
+ */
1118
+ public function ssba_telegram( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1119
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1120
+ $network = 'Telegram';
1121
+
1122
+ $target =
1123
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1124
+ && 'Y' === $arr_settings['ssba_new_buttons']
1125
+ && false === isset( $arr_settings['bar_call'] ) )
1126
+ ||
1127
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1128
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1129
+ && false === isset( $arr_settings['bar_call'] ) )
1130
+ ||
1131
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset( $arr_settings['bar_call'] ) ) ? ' target="_blank" ' : '';
1132
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-telegram ssbp-btn' : '';
1133
+ $html_share_buttons = '';
1134
+
1135
+ // Add li if plus.
1136
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1137
+ $html_share_buttons .= '<li class="ssbp-li--telegram">';
1138
+ }
1139
+
1140
+ // Telegram share link.
1141
+ $html_share_buttons .= '<a data-site="telegram" class="ssba_telegram_share ssba_share_link'
1142
+ . esc_attr( $plus_class )
1143
+ . '" href="https://telegram.me/share/url?url='
1144
+ . esc_attr( rawurlencode( $url_current_page ) )
1145
+ . '&text='
1146
+ . esc_attr( rawurlencode( $str_page_title ) ) . '">';
1147
+
1148
+ // If image set is not custom.
1149
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1150
+ // Show ssba image.
1151
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/line.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Line" class="ssba ssba-img" alt="Telegram" />';
1152
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1153
+ // Show custom image.
1154
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_telegram'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Telegram" class="ssba ssba-img" alt="Telegram" />';
1155
+ }
1156
+
1157
+ // Close href.
1158
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1159
+
1160
+ // Close href.
1161
+ $html_share_buttons .= '</a>';
1162
+
1163
+ // Add closing li if plus.
1164
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1165
+ $html_share_buttons .= '</li>';
1166
+ }
1167
+
1168
+ // Return share buttons.
1169
+ return $html_share_buttons;
1170
+ }
1171
+
1172
+
1173
+ /**
1174
+ * Get Snapchat button.
1175
+ *
1176
+ * @param array $arr_settings The current ssba settings.
1177
+ * @param string $url_current_page The current page url.
1178
+ * @param string $str_page_title The page title.
1179
+ * @param bool $boo_show_share_count Show share count or not.
1180
+ *
1181
+ * @return string
1182
+ */
1183
+ public function ssba_snapchat( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1184
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1185
+ $network = 'Snapchat';
1186
+
1187
+ $target =
1188
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1189
+ && 'Y' === $arr_settings['ssba_new_buttons']
1190
+ && false === isset( $arr_settings['bar_call'] ) )
1191
+ ||
1192
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1193
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1194
+ && false === isset( $arr_settings['bar_call'] ) )
1195
+ ||
1196
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset( $arr_settings['bar_call'] ) ) ? ' target="_blank" ' : '';
1197
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-snapchat ssbp-btn' : '';
1198
+ $html_share_buttons = '';
1199
+
1200
+ // Add li if plus.
1201
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1202
+ $html_share_buttons .= '<li class="ssbp-li--snapchat">';
1203
+ }
1204
+
1205
+ // Snapchat share link.
1206
+ $html_share_buttons .= '<a data-site="snapchat" class="ssba_snapchat_share ssba_share_link' . esc_attr( $plus_class ) . '" href="https://snapchat.com/scan?attachmentUrl=' . esc_attr( $url_current_page ) . '&utm_source=sharethis" ' . esc_attr( $target . $nofollow ) . '>';
1207
+
1208
+ // If image set is not custom.
1209
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1210
+ // Show ssba image.
1211
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/line.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Line" class="ssba ssba-img" alt="Snapchat" />';
1212
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1213
+ // Show custom image.
1214
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_snapchat'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Snapchat" class="ssba ssba-img" alt="Snapchat" />';
1215
+ }
1216
+
1217
+ // Close href.
1218
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1219
+
1220
+ // Close href.
1221
+ $html_share_buttons .= '</a>';
1222
+
1223
+ // Add closing li if plus.
1224
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1225
+ $html_share_buttons .= '</li>';
1226
+ }
1227
+
1228
+ // Return share buttons.
1229
+ return $html_share_buttons;
1230
+ }
1231
+
1232
+ /**
1233
+ * Get weibo button.
1234
+ *
1235
+ * @param array $arr_settings The current ssba settings.
1236
+ * @param string $url_current_page The current page url.
1237
+ * @param string $str_page_title The page title.
1238
+ * @param bool $boo_show_share_count Show share count or not.
1239
+ *
1240
+ * @return string
1241
+ */
1242
+ public function ssba_weibo( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1243
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1244
+ $network = 'Line';
1245
+ $target =
1246
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1247
+ && 'Y' === $arr_settings['ssba_new_buttons']
1248
+ && false === isset( $arr_settings['bar_call'] ) )
1249
+ ||
1250
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1251
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1252
+ && false === isset( $arr_settings['bar_call'] ) )
1253
+ ||
1254
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset( $arr_settings['bar_call'] ) ) ? ' target="_blank" ' : '';
1255
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-weibo ssbp-btn' : '';
1256
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1257
+ $html_share_buttons = '';
1258
+
1259
+ // Add li if plus.
1260
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1261
+ $html_share_buttons .= '<li class="ssbp-li--weibo">';
1262
+ }
1263
+
1264
+ // Skype share link.
1265
+ $html_share_buttons .= '<a data-site="weibo" class="ssba_weibo_share ssba_share_link' . esc_attr( $plus_class ) . '" href="http://v.t.sina.com.cn/share/share.php?url=' . esc_attr( $url_current_page ) . '" ' . esc_attr( $target . $nofollow ) . '>';
1266
+
1267
+ // If image set is not custom.
1268
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1269
+ // Show ssba image.
1270
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/weibo.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Weibo" class="ssba ssba-img" alt="Weibo" />';
1271
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1272
+ // Show custom image.
1273
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_weibo'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Weibo" class="ssba ssba-img" alt="Weibo" />';
1274
+ }
1275
+
1276
+ // Close href.
1277
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1278
+
1279
+ // Close href.
1280
+ $html_share_buttons .= '</a>';
1281
+
1282
+ // Add closing li if plus.
1283
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1284
+ $html_share_buttons .= '</li>';
1285
+ }
1286
+
1287
+ // Return share buttons.
1288
+ return $html_share_buttons;
1289
+ }
1290
+
1291
+ /**
1292
+ * Get reddit.
1293
+ *
1294
+ * @param array $arr_settings The current ssba settings.
1295
+ * @param string $url_current_page The current page url.
1296
+ * @param string $str_page_title The page title.
1297
+ * @param bool $boo_show_share_count Show share count or not.
1298
+ *
1299
+ * @return string
1300
+ */
1301
+ public function ssba_reddit( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1302
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1303
+ $network = 'Reddit';
1304
+ $target =
1305
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1306
+ && 'Y' === $arr_settings['ssba_new_buttons']
1307
+ && false === isset(
1308
+ $arr_settings['bar_call']
1309
+ ) )
1310
+ ||
1311
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1312
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1313
+ && false === isset(
1314
+ $arr_settings['bar_call']
1315
+ ) )
1316
+ ||
1317
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window'] && isset(
1318
+ $arr_settings['bar_call']
1319
+ ) ) ? ' target="_blank" ' : '';
1320
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-reddit ssbp-btn' : '';
1321
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1322
+ $html_share_buttons = '';
1323
+
1324
+ // Add li if plus.
1325
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1326
+ $html_share_buttons .= '<li class="ssbp-li--reddit">';
1327
+ }
1328
+
1329
+ // Reddit share link.
1330
+ $html_share_buttons .= '<a data-site="reddit" class="ssba_reddit_share' . esc_attr( $plus_class ) . '" href="http://reddit.com/submit?url=' . esc_attr( $url_current_page ) . '&amp;title=' . esc_attr( $str_page_title ) . '" ' . esc_attr( $target . $nofollow ) . '>';
1331
+
1332
+ // If image set is not custom.
1333
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1334
+
1335
+ // Show ssba image.
1336
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/reddit.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Reddit" class="ssba ssba-img" alt="Share on Reddit" />';
1337
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1338
+ // Show custom image.
1339
+ $html_share_buttons .= '<img src="' . esc_attr( $arr_settings['ssba_custom_reddit'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Reddit" class="ssba ssba-img" alt="Share on Reddit" />';
1340
+ }
1341
+
1342
+ // Close href.
1343
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1344
+
1345
+ // Close href.
1346
+ $html_share_buttons .= '</a>';
1347
+
1348
+ // If show share count is set to Y.
1349
+ if ( ( ( 'Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'] )
1350
+ ||
1351
+ ( 'Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'] )
1352
+ ||
1353
+ ( 'Y' === $arr_settings['ssba_bar_show_share_count'] && isset( $arr_settings['bar_call'] )
1354
+ )
1355
+ && $boo_show_share_count
1356
+ ) ) {
1357
+ // Get and display share count.
1358
+ $html_share_buttons .= '<span class="' . esc_attr( $count_class ) . '">' . esc_html( $this->get_reddit_share_count( $url_current_page ) ) . '</span>';
1359
+ }
1360
+
1361
+ // Add closing li if plus.
1362
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1363
+ $html_share_buttons .= '</li>';
1364
+ }
1365
+
1366
+ // Return share buttons.
1367
+ return $html_share_buttons;
1368
+ }
1369
+
1370
+ /**
1371
+ * Get reddit share count.
1372
+ *
1373
+ * @param string $url_current_page The current url.
1374
+ *
1375
+ * @return int|string
1376
+ */
1377
+ public function get_reddit_share_count( $url_current_page ) {
1378
+ // Get results from reddit and return the number of shares.
1379
+ $html_reddit_share_details = wp_safe_remote_get(
1380
+ 'http://www.reddit.com/api/info.json?url=' . $url_current_page,
1381
+ array(
1382
+ 'timeout' => 6,
1383
+ )
1384
+ );
1385
+
1386
+ // Check there was an error.
1387
+ if ( is_wp_error( $html_reddit_share_details ) ) {
1388
+ return 0;
1389
+ }
1390
+
1391
+ // Decode and get share count.
1392
+ $arr_reddit_result = json_decode( $html_reddit_share_details['body'], true );
1393
+ $int_reddit_share_count = isset( $arr_reddit_result['data']['children']['0']['data']['score'] ) ? $arr_reddit_result['data']['children']['0']['data']['score'] : 0;
1394
+
1395
+ return $int_reddit_share_count ? $this->ssba_format_number( $int_reddit_share_count ) : '0';
1396
+ }
1397
+
1398
+ /**
1399
+ * Get linkedin button.
1400
+ *
1401
+ * @param array $arr_settings The current ssba settings.
1402
+ * @param string $url_current_page The current page url.
1403
+ * @param string $str_page_title The page title.
1404
+ * @param bool $boo_show_share_count Show share count or not.
1405
+ *
1406
+ * @return string
1407
+ */
1408
+ public function ssba_linkedin( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1409
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1410
+ $network = 'Linkedin';
1411
+ $target =
1412
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1413
+ && 'Y' === $arr_settings['ssba_new_buttons']
1414
+ && ! isset(
1415
+ $arr_settings['bar_call']
1416
+ ) )
1417
+ ||
1418
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1419
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1420
+ && ! isset(
1421
+ $arr_settings['bar_call']
1422
+ ) )
1423
+ ||
1424
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
1425
+ && isset(
1426
+ $arr_settings['bar_call']
1427
+ ) ) ? ' target="_blank" ' : '';
1428
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-linkedin ssbp-btn' : '';
1429
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1430
+ $html_share_buttons = '';
1431
+
1432
+ // Add li if plus.
1433
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1434
+ $html_share_buttons .= '<li class="ssbp-li--linkedin">';
1435
+ }
1436
+
1437
+ // Linkedin share link.
1438
+ $html_share_buttons .= '<a data-site="linkedin" class="ssba_linkedin_share ssba_share_link' . esc_attr( $plus_class ) . '" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=' . esc_attr( $url_current_page ) . '" ' . esc_attr( $target . $nofollow ) . '>';
1439
+
1440
+ // If image set is not custom.
1441
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1442
+ // Show ssba image.
1443
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/linkedin.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="LinkedIn" class="ssba ssba-img" alt="Share on LinkedIn" />';
1444
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1445
+ // Show custom image.
1446
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_linkedin'] ) . '" alt="Share on LinkedIn" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="LinkedIn" class="ssba ssba-img" />';
1447
+ }
1448
+
1449
+ // Close href.
1450
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1451
+
1452
+ // Close href.
1453
+ $html_share_buttons .= '</a>';
1454
+
1455
+ // Add closing li if plus.
1456
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1457
+ $html_share_buttons .= '</li>';
1458
+ }
1459
+
1460
+ // Return share buttons.
1461
+ return $html_share_buttons;
1462
+ }
1463
+
1464
+ /**
1465
+ * Get linkedin share count. DEPRECATED
1466
+ *
1467
+ * @param string $url_current_page The current page url.
1468
+ *
1469
+ * @return int|string
1470
+ */
1471
+ public function get_linkedin_share_count( $url_current_page ) {
1472
+ // Get results from linkedin and return the number of shares.
1473
+ $html_linkedin_share_details = wp_safe_remote_get(
1474
+ 'http://www.linkedin.com/countserv/count/share?url=' . $url_current_page,
1475
+ array(
1476
+ 'timeout' => 6,
1477
+ )
1478
+ );
1479
+
1480
+ // If there was an error.
1481
+ if ( is_wp_error( $html_linkedin_share_details ) ) {
1482
+ return 0;
1483
+ }
1484
+
1485
+ // Extract/decode share count.
1486
+ $html_linkedin_share_details = str_replace( 'IN.Tags.Share.handleCount(', '', $html_linkedin_share_details );
1487
+ $html_linkedin_share_details = str_replace( ');', '', $html_linkedin_share_details );
1488
+ $arr_linkedin_share_details = json_decode( $html_linkedin_share_details['body'], true );
1489
+ $int_linkedin_share_count = $arr_linkedin_share_details['count'];
1490
+
1491
+ return $int_linkedin_share_count ? $this->ssba_format_number( $int_linkedin_share_count ) : '0';
1492
+ }
1493
+
1494
+ /**
1495
+ * Get pinterest button.
1496
+ *
1497
+ * @param array $arr_settings The current ssba settings.
1498
+ * @param string $url_current_page The current page url.
1499
+ * @param string $str_page_title The page title.
1500
+ * @param bool $boo_show_share_count Show share count or not.
1501
+ *
1502
+ * @return string
1503
+ */
1504
+ public function ssba_pinterest( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1505
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1506
+ $network = 'Pinterest';
1507
+ $target =
1508
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1509
+ && 'Y' === $arr_settings['ssba_new_buttons']
1510
+ && false === isset(
1511
+ $arr_settings['bar_call']
1512
+ ) )
1513
+ ||
1514
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1515
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1516
+ && false === isset(
1517
+ $arr_settings['bar_call']
1518
+ ) )
1519
+ ||
1520
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
1521
+ && true === isset(
1522
+ $arr_settings['bar_call']
1523
+ ) ) ? ' target="_blank" ' : '';
1524
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-pinterest ssbp-btn' : '';
1525
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1526
+ $html_share_buttons = '';
1527
+
1528
+ // Add li if plus.
1529
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1530
+ $html_share_buttons .= '<li class="ssbp-li--pinterest">';
1531
+ }
1532
+
1533
+ // If using featured images for Pinteres.
1534
+ if ( 'Y' === $arr_settings['ssba_pinterest_featured'] ) {
1535
+ // If this post has a featured image.
1536
+ if ( has_post_thumbnail( $arr_settings['post_id'] ) ) {
1537
+ // Get the featured image.
1538
+ $url_post_thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $arr_settings['post_id'] ), 'full' );
1539
+ $url_post_thumb = $url_post_thumb[0];
1540
+ } else { // No featured image set.
1541
+ // Use the pinterest default.
1542
+ $url_post_thumb = $arr_settings['ssba_default_pinterest'];
1543
+ }
1544
+
1545
+ // Pinterest share link.
1546
+ $html_share_buttons .= '<a data-site="pinterest-featured" href="http://pinterest.com/pin/create/bookmarklet/?is_video=false&url=' . esc_attr( $url_current_page ) . '&media=' . esc_attr( $url_post_thumb ) . '&description=' . esc_attr( $str_page_title ) . '" class="ssba_pinterest_share ssba_share_link' . esc_attr( $plus_class ) . '" ' . esc_attr( $target . $nofollow ) . '>';
1547
+ } else { // Not using featured images for pinterest.
1548
+ // Use the choice of pinnable images approach.
1549
+ $html_share_buttons .= "<a data-site='pinterest' class='ssba_pinterest_share" . esc_attr( $plus_class ) . "' href='javascript:void((function()%7Bvar%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;//assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)%7D)());'>";
1550
+ }
1551
+
1552
+ // If image set is not custom.
1553
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1554
+ // Show ssba image.
1555
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/pinterest.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Pinterest" class="ssba ssba-img" alt="Pin on Pinterest" />';
1556
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1557
+ // Show custom image.
1558
+ $html_share_buttons .= '<img style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Pinterest" class="ssba ssba-img" src="' . esc_url( $arr_settings['ssba_custom_pinterest'] ) . '" alt="Pin on Pinterest" />';
1559
+ }
1560
+
1561
+ // Close href.
1562
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1563
+
1564
+ // Close href.
1565
+ $html_share_buttons .= '</a>';
1566
+
1567
+ // If show share count is set to Y.
1568
+ if ( ( ( 'Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'] )
1569
+ ||
1570
+ ( 'Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'] )
1571
+ ||
1572
+ ( 'Y' === $arr_settings['ssba_bar_show_share_count'] && isset( $arr_settings['bar_call'] )
1573
+ )
1574
+ && $boo_show_share_count
1575
+ ) ) {
1576
+ $html_share_buttons .= '<span class="' . esc_attr( $count_class ) . '">' . esc_html( $this->get_pinterest_share_count( $url_current_page ) ) . '</span>';
1577
+ }
1578
+
1579
+ // Add closing li if plus.
1580
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1581
+ $html_share_buttons .= '</li>';
1582
+ }
1583
+
1584
+ // Return share buttons.
1585
+ return $html_share_buttons;
1586
+ }
1587
+
1588
+ /**
1589
+ * Get pinterest share count.
1590
+ *
1591
+ * @param string $url_current_page The current page url.
1592
+ *
1593
+ * @return int|string
1594
+ */
1595
+ public function get_pinterest_share_count( $url_current_page ) {
1596
+ // Get results from pinterest.
1597
+ $html_pinterest_share_details = wp_safe_remote_get(
1598
+ 'http://api.pinterest.com/v1/urls/count.json?url=' . $url_current_page,
1599
+ array(
1600
+ 'timeout' => 6,
1601
+ )
1602
+ );
1603
+
1604
+ // Check there was an error.
1605
+ if ( is_wp_error( $html_pinterest_share_details ) ) {
1606
+ return 0;
1607
+ }
1608
+
1609
+ // Decode data.
1610
+ $html_pinterest_share_details = str_replace( 'receiveCount(', '', $html_pinterest_share_details );
1611
+ $html_pinterest_share_details = str_replace( ')', '', $html_pinterest_share_details );
1612
+ $arr_pinterest_share_details = json_decode( $html_pinterest_share_details['body'], true );
1613
+ $int_pinterest_share_count = $arr_pinterest_share_details['count'];
1614
+
1615
+ return $int_pinterest_share_count ? $this->ssba_format_number( $int_pinterest_share_count ) : '0';
1616
+ }
1617
+
1618
+ /**
1619
+ * Get stumbleupon button.
1620
+ *
1621
+ * @param array $arr_settings The current ssba settings.
1622
+ * @param string $url_current_page The current page url.
1623
+ * @param string $str_page_title The page title.
1624
+ * @param bool $boo_show_share_count Show share count or not.
1625
+ *
1626
+ * @return string
1627
+ */
1628
+ public function ssba_stumbleupon( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1629
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1630
+ $network = 'StumbleUpon';
1631
+ $target =
1632
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1633
+ && 'Y' === $arr_settings['ssba_new_buttons']
1634
+ && false === isset(
1635
+ $arr_settings['bar_call']
1636
+ ) )
1637
+ ||
1638
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1639
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1640
+ && false === isset(
1641
+ $arr_settings['bar_call']
1642
+ ) )
1643
+ ||
1644
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
1645
+ && isset(
1646
+ $arr_settings['bar_call']
1647
+ ) ) ? ' target="_blank" ' : '';
1648
+ $url = 'http://www.stumbleupon.com/submit?url=' . esc_attr( $url_current_page ) . '&amp;title=' . esc_attr( $str_page_title );
1649
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-stumbleupon ssbp-btn' : '';
1650
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1651
+ $html_share_buttons = '';
1652
+
1653
+ // Add li if plus.
1654
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1655
+ $html_share_buttons .= '<li class="ssbp-li--stumbleupon">';
1656
+ }
1657
+
1658
+ // Stumbleupon share link.
1659
+ $html_share_buttons .= '<a data-site="stumbleupon" class="ssba_stumbleupon_share ssba_share_link' . esc_attr( $plus_class ) . '" href="' . esc_url( $url ) . '" ' . esc_attr( $target . $nofollow ) . '>';
1660
+
1661
+ // If image set is not custom.
1662
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1663
+ // Show ssba image.
1664
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/stumbleupon.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="StumbleUpon" class="ssba ssba-img" alt="Share on StumbleUpon" />';
1665
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1666
+ // Show custom image.
1667
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_stumbleupon'] ) . '" alt="Share on StumbleUpon" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="StumbleUpon" class="ssba ssba-img" />';
1668
+ }
1669
+
1670
+ // Close href.
1671
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1672
+
1673
+ // Close href.
1674
+ $html_share_buttons .= '</a>';
1675
+
1676
+ // If show share count is set to Y.
1677
+ if ( ( ( 'Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'] )
1678
+ ||
1679
+ ( 'Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'] )
1680
+ ||
1681
+ ( 'Y' === $arr_settings['ssba_bar_show_share_count'] && isset( $arr_settings['bar_call'] )
1682
+ )
1683
+ && $boo_show_share_count
1684
+ ) ) {
1685
+ $html_share_buttons .= '<span class="' . esc_attr( $count_class ) . '">' . esc_html( $this->get_stumble_upon_share_count( $url_current_page ) ) . '</span>';
1686
+ }
1687
+
1688
+ // Add closing li if plus.
1689
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1690
+ $html_share_buttons .= '</li>';
1691
+ }
1692
+
1693
+ // Return share buttons.
1694
+ return $html_share_buttons;
1695
+ }
1696
+
1697
+ /**
1698
+ * Get stumbleupon share count.
1699
+ *
1700
+ * @param string $url_current_page The current url.
1701
+ *
1702
+ * @return int|string
1703
+ */
1704
+ public function get_stumble_upon_share_count( $url_current_page ) {
1705
+ // Get results from stumbleupon and return the number of shares.
1706
+ $html_stumble_upon_share_details = wp_safe_remote_get(
1707
+ 'http://www.stumbleupon.com/services/1.01/badge.getinfo?url=' . $url_current_page,
1708
+ array(
1709
+ 'timeout' => 6,
1710
+ )
1711
+ );
1712
+
1713
+ // Check there was an error.
1714
+ if ( is_wp_error( $html_stumble_upon_share_details ) ) {
1715
+ return 0;
1716
+ }
1717
+
1718
+ // Decode data.
1719
+ $arr_stumble_upon_result = json_decode( $html_stumble_upon_share_details['body'], true );
1720
+ $int_stumble_upon_share_count = isset( $arr_stumble_upon_result['result']['views'] ) ? $arr_stumble_upon_result['result']['views'] : 0;
1721
+
1722
+ return $int_stumble_upon_share_count ? $this->ssba_format_number( $int_stumble_upon_share_count ) : '0';
1723
+ }
1724
+
1725
+ /**
1726
+ * Get email button.
1727
+ *
1728
+ * @param array $arr_settings The current ssba settings.
1729
+ * @param string $url_current_page The current page url.
1730
+ * @param string $str_page_title The page title.
1731
+ * @param bool $boo_show_share_count Show share count or not.
1732
+ *
1733
+ * @return string
1734
+ */
1735
+ public function ssba_email( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1736
+ // Replace ampersands as needed for email link.
1737
+ $email_title = str_replace( '&', '%26', $str_page_title );
1738
+ $network = 'email';
1739
+ $url = 'mailto:?subject=' . $email_title . '&amp;body=' . $arr_settings['ssba_email_message'] . ' ' . $url_current_page;
1740
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-email ssbp-btn' : '';
1741
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1742
+ $html_share_buttons = '';
1743
+
1744
+ // Add li if plus.
1745
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1746
+ $html_share_buttons .= '<li class="ssbp-li--email">';
1747
+ }
1748
+
1749
+ $url = 'Y' === $arr_settings['ssba_new_buttons'] ? 'mailto:?subject=' . $email_title . '&amp;body=' . $arr_settings['ssba_plus_email_message'] . ' ' . $url_current_page : $url;
1750
+ $url = isset( $arr_settings['bar_call'] ) ? 'mailto:?subject=' . $email_title . '&amp;body=' . $arr_settings['ssba_bar_email_message'] . ' ' . $url_current_page : $url;
1751
+
1752
+ // Email share link.
1753
+ $html_share_buttons .= '<a data-site="email" class="ssba_email_share' . esc_attr( $plus_class ) . '" href="' . esc_url( $url ) . '">';
1754
+
1755
+ // If image set is not custom.
1756
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1757
+ // Show ssba image.
1758
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/email.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Email" class="ssba ssba-img" alt="Email this to someone" />';
1759
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1760
+ // Show custom image.
1761
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_email'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Email" class="ssba ssba-img" alt="Email to someone" />';
1762
+ }
1763
+
1764
+ // Close href.
1765
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1766
+
1767
+ // Close href.
1768
+ $html_share_buttons .= '</a>';
1769
+
1770
+ // Add closing li if plus.
1771
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1772
+ $html_share_buttons .= '</li>';
1773
+ }
1774
+
1775
+ // Return share buttons.
1776
+ return $html_share_buttons;
1777
+ }
1778
+
1779
+ /**
1780
+ * Get flattr button.
1781
+ *
1782
+ * @param array $arr_settings The current ssba settings.
1783
+ * @param string $url_current_page The current page url.
1784
+ * @param string $str_page_title The page title.
1785
+ * @param bool $boo_show_share_count Show share count or not.
1786
+ *
1787
+ * @return string
1788
+ */
1789
+ public function ssba_flattr( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1790
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1791
+ $network = 'Flattr';
1792
+ $target =
1793
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1794
+ && 'Y' === $arr_settings['ssba_new_buttons']
1795
+ && false === isset(
1796
+ $arr_settings['bar_call']
1797
+ ) )
1798
+ ||
1799
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1800
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1801
+ && false === isset(
1802
+ $arr_settings['bar_call']
1803
+ ) )
1804
+ ||
1805
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
1806
+ && isset(
1807
+ $arr_settings['bar_call']
1808
+ ) ) ? ' target="_blank" ' : '';
1809
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-flattr ssbp-btn' : '';
1810
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1811
+ $html_share_buttons = '';
1812
+ $userid = ! empty( $arr_settings['ssba_flattr_user_id'] ) ? $arr_settings['ssba_flattr_user_id'] : '';
1813
+
1814
+ // Add li if plus.
1815
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1816
+ $html_share_buttons .= '<li class="ssbp-li--flattr">';
1817
+ }
1818
+
1819
+ // Check for dedicated flattr URL.
1820
+ if ( '' !== $arr_settings['ssba_flattr_url'] ) {
1821
+ // Update url that will be set to specified URL.
1822
+ $url_current_page = $arr_settings['ssba_flattr_url'];
1823
+ }
1824
+
1825
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] ) {
1826
+ $userid = ! empty( $arr_settings['ssba_plus_flattr_user_id'] ) ? $arr_settings['ssba_plus_flattr_user_id'] : $userid;
1827
+ $url_current_page = ! empty( $arr_settings['ssba_plus_flattr_url'] ) ? $arr_settings['ssba_plus_flattr_url'] : $url_current_page;
1828
+ }
1829
+
1830
+ if ( isset( $arr_settings['bar_call'] ) ) {
1831
+ $userid = ! empty( $arr_settings['ssba_bar_flattr_user_id'] ) ? $arr_settings['ssba_bar_flattr_user_id'] : $userid;
1832
+ $url_current_page = ! empty( $arr_settings['ssba_bar_flattr_url'] ) ? $arr_settings['ssba_bar_flattr_url'] : $url_current_page;
1833
+ }
1834
+
1835
+ // Flattr share link.
1836
+ $html_share_buttons .= '<a data-site="flattr" class="ssba_flattr_share' . esc_attr( $plus_class ) . '" href="https://flattr.com/submit/auto?user_id=' . esc_attr( $userid ) . '&amp;title=' . esc_attr( $str_page_title ) . '&amp;url=' . esc_attr( $url_current_page ) . '" ' . esc_attr( $target . $nofollow ) . '>';
1837
+
1838
+ // If image set is not custom.
1839
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1840
+ // Show ssba image.
1841
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/flattr.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Flattr" class="ssba ssba-img" alt="Flattr the author" />';
1842
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1843
+ // Show custom image.
1844
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_flattr'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Flattr" class="ssba ssba-img" alt="Flattr the author" />';
1845
+ }
1846
+
1847
+ // Close href.
1848
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1849
+
1850
+ // Close href.
1851
+ $html_share_buttons .= '</a>';
1852
+
1853
+ // Add closing li if plus.
1854
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1855
+ $html_share_buttons .= '</li>';
1856
+ }
1857
+
1858
+ // Return share buttons.
1859
+ return $html_share_buttons;
1860
+ }
1861
+
1862
+ /**
1863
+ * Get buffer button.
1864
+ *
1865
+ * @param array $arr_settings The current ssba settings.
1866
+ * @param string $url_current_page The current page url.
1867
+ * @param string $str_page_title The page title.
1868
+ * @param bool $boo_show_share_count Show share count or not.
1869
+ *
1870
+ * @return string
1871
+ */
1872
+ public function ssba_buffer( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1873
+ $buffer = '' !== $arr_settings['ssba_buffer_text'] ? $arr_settings['ssba_buffer_text'] : '';
1874
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1875
+ $network = 'Buffer';
1876
+ $target =
1877
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1878
+ && 'Y' === $arr_settings['ssba_new_buttons']
1879
+ && ! isset(
1880
+ $arr_settings['bar_call']
1881
+ ) )
1882
+ ||
1883
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1884
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1885
+ && ! isset(
1886
+ $arr_settings['bar_call']
1887
+ ) )
1888
+ ||
1889
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
1890
+ && isset(
1891
+ $arr_settings['bar_call']
1892
+ ) ) ? ' target="_blank" ' : '';
1893
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-buffer ssbp-btn' : '';
1894
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1895
+ $html_share_buttons = '';
1896
+
1897
+ // Add li if plus.
1898
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1899
+ $html_share_buttons .= '<li class="ssbp-li--buffer">';
1900
+ }
1901
+
1902
+ // Buffer share link.
1903
+ $html_share_buttons .= '<a data-site="buffer" class="ssba_buffer_share' . esc_attr( $plus_class ) . '" href="https://bufferapp.com/add?url=' . esc_attr( $url_current_page ) . '&amp;text=' . esc_attr( $buffer ) . ' ' . esc_attr( $str_page_title ) . '" ' . esc_attr( $target . $nofollow ) . '>';
1904
+
1905
+ // If image set is not custom.
1906
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1907
+ // Show ssba image.
1908
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/buffer.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Buffer" class="ssba ssba-img" alt="Buffer this page" />';
1909
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1910
+ // Show custom image.
1911
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_buffer'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Buffer" class="ssba ssba-img" alt="Buffer this page" />';
1912
+ }
1913
+
1914
+ // Close href.
1915
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1916
+
1917
+ // Close href.
1918
+ $html_share_buttons .= '</a>';
1919
+
1920
+ // Add closing li if plus.
1921
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1922
+ $html_share_buttons .= '</li>';
1923
+ }
1924
+
1925
+ // Return share buttons.
1926
+ return $html_share_buttons;
1927
+ }
1928
+
1929
+ /**
1930
+ * Get tumblr button.
1931
+ *
1932
+ * @param array $arr_settings The current ssba settings.
1933
+ * @param string $url_current_page The current page url.
1934
+ * @param string $str_page_title The page title.
1935
+ * @param bool $boo_show_share_count Show share count or not.
1936
+ *
1937
+ * @return string
1938
+ */
1939
+ public function ssba_tumblr( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
1940
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
1941
+ $network = 'Tumblr';
1942
+ $target =
1943
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
1944
+ && 'Y' === $arr_settings['ssba_new_buttons']
1945
+ && ! isset(
1946
+ $arr_settings['bar_call']
1947
+ ) )
1948
+ ||
1949
+ ( 'Y' === $arr_settings['ssba_share_new_window']
1950
+ && 'Y' !== $arr_settings['ssba_new_buttons']
1951
+ && ! isset(
1952
+ $arr_settings['bar_call']
1953
+ ) )
1954
+ ||
1955
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
1956
+ && isset(
1957
+ $arr_settings['bar_call']
1958
+ ) ) ? ' target="_blank" ' : '';
1959
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-tumblr ssbp-btn' : '';
1960
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
1961
+ $html_share_buttons = '';
1962
+
1963
+ // Add li if plus.
1964
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
1965
+ $html_share_buttons .= '<li class="ssbp-li--tumblr">';
1966
+ }
1967
+
1968
+ // Tumblr share link.
1969
+ $html_share_buttons .= '<a data-site="tumblr" class="ssba_tumblr_share' . esc_attr( $plus_class ) . '" href="http://www.tumblr.com/share/link?url=' . esc_attr( $url_current_page ) . '" ' . esc_attr( $target . $nofollow ) . '>';
1970
+
1971
+ // If image set is not custom.
1972
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
1973
+ // Show ssba image.
1974
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/tumblr.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="tumblr" class="ssba ssba-img" alt="Share on Tumblr" />';
1975
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
1976
+ // Show custom image.
1977
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_tumblr'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="tumblr" class="ssba ssba-img" alt="share on Tumblr" />';
1978
+ }
1979
+
1980
+ // Close href.
1981
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
1982
+
1983
+ // Close href.
1984
+ $html_share_buttons .= '</a>';
1985
+
1986
+ // If show share count is set to Y.
1987
+ if ( ( ( 'Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'] )
1988
+ ||
1989
+ ( 'Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'] )
1990
+ ||
1991
+ ( 'Y' === $arr_settings['ssba_bar_show_share_count'] && isset( $arr_settings['bar_call'] )
1992
+ )
1993
+ && $boo_show_share_count
1994
+ ) ) {
1995
+ $html_share_buttons .= '<span class="' . $count_class . '">' . esc_html( $this->get_tumblr_share_count( $url_current_page ) ) . '</span>';
1996
+ }
1997
+
1998
+ // Add closing li if plus.
1999
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2000
+ $html_share_buttons .= '</li>';
2001
+ }
2002
+
2003
+ // Return share buttons.
2004
+ return $html_share_buttons;
2005
+ }
2006
+
2007
+ /**
2008
+ * Get tumblr share count.
2009
+ *
2010
+ * @param string $url_current_page The current url.
2011
+ *
2012
+ * @return int|string
2013
+ */
2014
+ public function get_tumblr_share_count( $url_current_page ) {
2015
+ // Get results from tumblr and return the number of shares.
2016
+ $result = wp_safe_remote_get(
2017
+ 'http://api.tumblr.com/v2/share/stats?url=' . $url_current_page,
2018
+ array(
2019
+ 'timeout' => 6,
2020
+ )
2021
+ );
2022
+
2023
+ // Check there was an error.
2024
+ if ( is_wp_error( $result ) ) {
2025
+ return 0;
2026
+ }
2027
+
2028
+ // Decode data.
2029
+ $array = json_decode( $result['body'], true );
2030
+ $count = isset( $array['response']['note_count'] ) ? $array['response']['note_count'] : 0;
2031
+
2032
+ return ( $count ) ? $count : '0';
2033
+ }
2034
+
2035
+ /**
2036
+ * Get print button.
2037
+ *
2038
+ * @param array $arr_settings The current ssba settings.
2039
+ * @param string $url_current_page The current page url.
2040
+ * @param string $str_page_title The page title.
2041
+ * @param bool $boo_show_share_count Show share count or not.
2042
+ *
2043
+ * @return string
2044
+ */
2045
+ public function ssba_print( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
2046
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-print ssbp-btn' : '';
2047
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
2048
+ $network = 'Print';
2049
+ $html_share_buttons = '';
2050
+
2051
+ // Add li if plus.
2052
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2053
+ $html_share_buttons .= '<li class="ssbp-li--print">';
2054
+ }
2055
+
2056
+ $html_share_buttons .= '<a data-site="print" class="ssba_print ssba_share_link ' . esc_attr( $plus_class ) . '" href="#" onclick="window.print()">';
2057
+
2058
+ // If image set is not custom.
2059
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
2060
+ // Show ssba image.
2061
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/print.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Print" class="ssba ssba-img" alt="Print this page" />';
2062
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
2063
+ // Show custom image.
2064
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_print'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Print" class="ssba ssba-img" alt="Print this page" />';
2065
+ }
2066
+
2067
+ // Close href.
2068
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2069
+
2070
+ // Close href.
2071
+ $html_share_buttons .= '</a>';
2072
+
2073
+ // Add closing li if plus.
2074
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2075
+ $html_share_buttons .= '</li>';
2076
+ }
2077
+
2078
+ // Return share buttons.
2079
+ return $html_share_buttons;
2080
+ }
2081
+
2082
+ /**
2083
+ * Get vk button.
2084
+ *
2085
+ * @param array $arr_settings The current ssba settings.
2086
+ * @param string $url_current_page The current page url.
2087
+ * @param string $str_page_title The page title.
2088
+ * @param bool $boo_show_share_count Show share count or not.
2089
+ *
2090
+ * @return string
2091
+ */
2092
+ public function ssba_vk( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
2093
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
2094
+ $network = 'VK';
2095
+ $target =
2096
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
2097
+ && 'Y' === $arr_settings['ssba_new_buttons']
2098
+ && ! isset(
2099
+ $arr_settings['bar_call']
2100
+ ) )
2101
+ ||
2102
+ ( 'Y' === $arr_settings['ssba_share_new_window']
2103
+ && 'Y' !== $arr_settings['ssba_new_buttons']
2104
+ && ! isset(
2105
+ $arr_settings['bar_call']
2106
+ ) )
2107
+ ||
2108
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
2109
+ && isset(
2110
+ $arr_settings['bar_call']
2111
+ ) ) ? ' target="_blank" ' : '';
2112
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-vk ssbp-btn' : '';
2113
+ $html_share_buttons = '';
2114
+
2115
+ // Add li if plus.
2116
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2117
+ $html_share_buttons .= '<li class="ssbp-li--vk">';
2118
+ }
2119
+
2120
+ // Vk share link.
2121
+ $html_share_buttons .= '<a data-site="vk" class="ssba_vk_share ssba_share_link' . esc_attr( $plus_class ) . '" href="http://vkontakte.ru/share.php?url=' . esc_attr( $url_current_page ) . '" ' . esc_attr( $target . $nofollow ) . '>';
2122
+
2123
+ // If image set is not custom.
2124
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
2125
+ // Show ssba image.
2126
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/vk.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="VK" class="ssba ssba-img" alt="Share on VK" />';
2127
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
2128
+ // Show custom image.
2129
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_vk'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="VK" class="ssba ssba-img" alt="Share on VK" />';
2130
+ }
2131
+
2132
+ // Close href.
2133
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2134
+
2135
+ // Close href.
2136
+ $html_share_buttons .= '</a>';
2137
+
2138
+ // Add closing li if plus.
2139
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2140
+ $html_share_buttons .= '</li>';
2141
+ }
2142
+
2143
+ // Return share buttons.
2144
+ return $html_share_buttons;
2145
+ }
2146
+
2147
+ /**
2148
+ * Get yummly button.
2149
+ *
2150
+ * @param array $arr_settings The current ssba settings.
2151
+ * @param string $url_current_page The current page url.
2152
+ * @param string $str_page_title The page title.
2153
+ * @param bool $boo_show_share_count Show share count or not.
2154
+ *
2155
+ * @return string
2156
+ */
2157
+ public function ssba_yummly( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
2158
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
2159
+ $network = 'Yummly';
2160
+ $target =
2161
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
2162
+ && 'Y' === $arr_settings['ssba_new_buttons']
2163
+ && ! isset(
2164
+ $arr_settings['bar_call']
2165
+ ) )
2166
+ ||
2167
+ ( 'Y' === $arr_settings['ssba_share_new_window']
2168
+ && 'Y' !== $arr_settings['ssba_new_buttons']
2169
+ && ! isset(
2170
+ $arr_settings['bar_call']
2171
+ ) )
2172
+ ||
2173
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
2174
+ && isset(
2175
+ $arr_settings['bar_call']
2176
+ ) ) ? ' target="_blank" ' : '';
2177
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-yummly ssbp-btn' : '';
2178
+ $count_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-each-share' : ' ssba_sharecount';
2179
+ $html_share_buttons = '';
2180
+
2181
+ // Add li if plus.
2182
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2183
+ $html_share_buttons .= '<li class="ssbp-li--yummly">';
2184
+ }
2185
+
2186
+ // Yummly share link.
2187
+ $html_share_buttons .= '<a data-site="yummly" class="ssba_yummly_share ssba_share_link' . esc_attr( $plus_class ) . '" href="http://www.yummly.com/urb/verify?url=' . esc_attr( $url_current_page ) . '&title=' . esc_attr( rawurlencode( html_entity_decode( $str_page_title ) ) ) . '" ' . esc_attr( $target . $nofollow ) . '>';
2188
+
2189
+ // If image set is not custom.
2190
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
2191
+ // Show ssba image.
2192
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/yummly.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Yummly" class="ssba ssba-img" alt="Share on Yummly" />';
2193
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
2194
+ // Show custom image.
2195
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_yummly'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Yummly" class="ssba ssba-img" alt="Share on Yummly" />';
2196
+ }
2197
+
2198
+ // Close href.
2199
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2200
+
2201
+ // Close href.
2202
+ $html_share_buttons .= '</a>';
2203
+
2204
+ // If show share count is set to Y.
2205
+ if ( ( ( 'Y' === $arr_settings['ssba_show_share_count'] && 'Y' !== $arr_settings['ssba_new_buttons'] )
2206
+ ||
2207
+ ( 'Y' === $arr_settings['ssba_plus_show_share_count'] && 'Y' === $arr_settings['ssba_new_buttons'] )
2208
+ ||
2209
+ ( 'Y' === $arr_settings['ssba_bar_show_share_count'] && isset( $arr_settings['bar_call'] )
2210
+ )
2211
+ && $boo_show_share_count
2212
+ ) ) {
2213
+ $html_share_buttons .= '<span class="' . esc_attr( $count_class ) . '">' . esc_html( $this->get_yummly_share_count( $url_current_page ) ) . '</span>';
2214
+ }
2215
+
2216
+ // Add closing li if plus.
2217
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2218
+ $html_share_buttons .= '</li>';
2219
+ }
2220
+
2221
+ // Return share buttons.
2222
+ return $html_share_buttons;
2223
+ }
2224
+
2225
+ /**
2226
+ * Get yummly share count.
2227
+ *
2228
+ * @param string $url_current_page the current page url.
2229
+ *
2230
+ * @return int|string
2231
+ */
2232
+ public function get_yummly_share_count( $url_current_page ) {
2233
+ // Get results from yummly and return the number of shares.
2234
+ $result = wp_safe_remote_get(
2235
+ 'http://www.yummly.com/services/yum-count?url=' . $url_current_page,
2236
+ array(
2237
+ 'timeout' => 6,
2238
+ )
2239
+ );
2240
+
2241
+ // Check there was an error.
2242
+ if ( is_wp_error( $result ) ) {
2243
+ return 0;
2244
+ }
2245
+
2246
+ // Decode data.
2247
+ $array = json_decode( $result['body'], true );
2248
+ $count = isset( $array['count'] ) ? $array['count'] : '0';
2249
+
2250
+ // Return.
2251
+ return $count;
2252
+ }
2253
+
2254
+ /**
2255
+ * Get whatsapp button.
2256
+ *
2257
+ * @param array $arr_settings The current ssba settings.
2258
+ * @param string $url_current_page The current page url.
2259
+ * @param string $str_page_title The page title.
2260
+ * @param bool $boo_show_share_count Show share count or not.
2261
+ *
2262
+ * @return string
2263
+ */
2264
+ public function ssba_whatsapp( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
2265
+ if ( ! wp_is_mobile() ) {
2266
+ return;
2267
+ }
2268
+
2269
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
2270
+ $network = 'Whatsapp';
2271
+ $target =
2272
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
2273
+ && 'Y' === $arr_settings['ssba_new_buttons']
2274
+ && ! isset(
2275
+ $arr_settings['bar_call']
2276
+ ) )
2277
+ ||
2278
+ ( 'Y' === $arr_settings['ssba_share_new_window']
2279
+ && 'Y' !== $arr_settings['ssba_new_buttons']
2280
+ && ! isset(
2281
+ $arr_settings['bar_call']
2282
+ ) )
2283
+ ||
2284
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
2285
+ && isset(
2286
+ $arr_settings['bar_call']
2287
+ ) ) ? ' target="_blank" ' : '';
2288
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-whatsapp ssbp-btn' : '';
2289
+ $html_share_buttons = '';
2290
+
2291
+ // Add li if plus.
2292
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2293
+ $html_share_buttons .= '<li class="ssbp-li--whatsapp">';
2294
+ }
2295
+
2296
+ // Whatsapp share link.
2297
+ $html_share_buttons .= '<a data-site="whatsapp" class="ssba_whatsapp_share ssba_share_link' . esc_attr( $plus_class ) . '" href="whatsapp://send?text=' . rawurlencode( $url_current_page . ' ' . $str_page_title ) . '" ' . esc_attr( $target . $nofollow ) . '>';
2298
+
2299
+ // If image set is not custom.
2300
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
2301
+ // Show ssba image.
2302
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/whatsapp.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Whatsapp" class="ssba ssba-img" alt="Share on Whatsapp" />';
2303
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
2304
+ // Show custom image.
2305
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_whatsapp'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Whatsapp" class="ssba ssba-img" alt="Share on Whatsapp" />';
2306
+ }
2307
+
2308
+ // Close href.
2309
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2310
+
2311
+ // Close href.
2312
+ $html_share_buttons .= '</a>';
2313
+
2314
+ // Add closing li if plus.
2315
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2316
+ $html_share_buttons .= '</li>';
2317
+ }
2318
+
2319
+ // Return share buttons.
2320
+ return $html_share_buttons;
2321
+ }
2322
+
2323
+ /**
2324
+ * Get xing button.
2325
+ *
2326
+ * @param array $arr_settings The current ssba settings.
2327
+ * @param string $url_current_page The current page url.
2328
+ * @param string $str_page_title The page title.
2329
+ * @param bool $boo_show_share_count Show share count or not.
2330
+ *
2331
+ * @return string
2332
+ */
2333
+ public function ssba_xing( $arr_settings, $url_current_page, $str_page_title, $boo_show_share_count ) {
2334
+ $nofollow = 'Y' === $arr_settings['ssba_rel_nofollow'] ? ' rel="nofollow"' : '';
2335
+ $network = 'Xing';
2336
+ $target =
2337
+ ( 'Y' === $arr_settings['ssba_plus_share_new_window']
2338
+ && 'Y' === $arr_settings['ssba_new_buttons']
2339
+ && ! isset(
2340
+ $arr_settings['bar_call']
2341
+ ) )
2342
+ ||
2343
+ ( 'Y' === $arr_settings['ssba_share_new_window']
2344
+ && 'Y' !== $arr_settings['ssba_new_buttons']
2345
+ && ! isset(
2346
+ $arr_settings['bar_call']
2347
+ ) )
2348
+ ||
2349
+ ( 'Y' === $arr_settings['ssba_bar_share_new_window']
2350
+ && isset(
2351
+ $arr_settings['bar_call']
2352
+ ) ) ? ' target="_blank" ' : '';
2353
+ $plus_class = 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ? ' ssbp-xing ssbp-btn' : '';
2354
+ $html_share_buttons = '';
2355
+
2356
+ // Add li if plus.
2357
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2358
+ $html_share_buttons .= '<li class="ssbp-li--xing">';
2359
+ }
2360
+
2361
+ // Xing share link.
2362
+ $html_share_buttons .= '<a data-site="xing" class="ssba_xing_share ssba_share_link' . esc_attr( $plus_class ) . '" href="https://www.xing.com/spi/shares/new?url=' . $url_current_page . '" ' . esc_attr( $target . $nofollow ) . '>';
2363
+
2364
+ // If image set is not custom.
2365
+ if ( 'custom' !== $arr_settings['ssba_image_set'] && 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) {
2366
+ // Show ssba image.
2367
+ $html_share_buttons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/xing.png" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Xing" class="ssba ssba-img" alt="Share on Xing" />';
2368
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] && ! isset( $arr_settings['bar_call'] ) ) { // If using custom images.
2369
+ // Show custom image.
2370
+ $html_share_buttons .= '<img src="' . esc_url( $arr_settings['ssba_custom_xing'] ) . '" style="width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px;" title="Xing" class="ssba ssba-img" alt="Share on Xing" />';
2371
+ }
2372
+
2373
+ // Close href.
2374
+ $html_share_buttons .= '<div title="' . $network . '" class="ssbp-text">' . $network . '</div>';
2375
+
2376
+ // Close href.
2377
+ $html_share_buttons .= '</a>';
2378
+
2379
+ // Add closing li if plus.
2380
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] || isset( $arr_settings['bar_call'] ) ) {
2381
+ $html_share_buttons .= '</li>';
2382
+ }
2383
+
2384
+ // Return share buttons.
2385
+ return $html_share_buttons;
2386
+ }
2387
  }
php/class-database.php CHANGED
@@ -12,696 +12,684 @@ namespace SimpleShareButtonsAdder;
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
- class Database
16
- {
17
-
18
- /**
19
- * Plugin instance.
20
- *
21
- * @var object
22
- */
23
- public $plugin;
24
-
25
- /**
26
- * Simple Share Buttons Adder instance.
27
- *
28
- * @var object
29
- */
30
- public $class_ssba;
31
-
32
- /**
33
- * Class constructor.
34
- *
35
- * @param object $plugin Plugin class.
36
- * @param object $class_ssba Simple Share Buttons Adder class.
37
- */
38
- public function __construct($plugin, $class_ssba)
39
- {
40
- $this->plugin = $plugin;
41
- $this->class_ssba = $class_ssba;
42
-
43
- // Run the activation function upon activation of the plugin.
44
- register_activation_hook($this->plugin->dir_path . '/simple-share-buttons-adder.php', array($this, 'activate'));
45
-
46
- // Register deactivation hook.
47
- register_deactivation_hook($this->plugin->dir_path . '/simple-share-buttons-adder.php', array($this, 'deactivate'));
48
- }
49
-
50
- /**
51
- * Add any settings default if it doesn't exist already.
52
- *
53
- * @param bool $return_array Whether to return the default setting array or not.
54
- *
55
- * @action admin_init
56
- */
57
- public function get_setting_array($return_array = false)
58
- {
59
- // Array ready with defaults.
60
- $ssba_settings = array(
61
- 'ssba_omit_pages' => '',
62
- 'ssba_omit_pages_plus' => '',
63
- 'ssba_omit_pages_bar' => '',
64
- 'ssba_image_set' => 'somacro',
65
- 'ssba_size' => '35',
66
- 'ssba_pages' => '',
67
- 'ssba_posts' => '',
68
- 'ssba_cats_archs' => '',
69
- 'ssba_homepage' => '',
70
- 'ssba_excerpts' => '',
71
- 'ssba_plus_pages' => '',
72
- 'ssba_plus_posts' => '',
73
- 'ssba_plus_cats_archs' => '',
74
- 'ssba_plus_homepage' => '',
75
- 'ssba_plus_excerpts' => '',
76
- 'ssba_bar_pages' => '',
77
- 'ssba_bar_posts' => '',
78
- 'ssba_bar_cats_archs' => '',
79
- 'ssba_bar_homepage' => '',
80
- 'ssba_bar_excerpts' => '',
81
- 'ssba_align' => 'left',
82
- 'ssba_plus_align' => 'center',
83
- 'ssba_bar_align' => 'left',
84
- 'ssba_padding' => '6',
85
- 'ssba_before_or_after' => 'after',
86
- 'ssba_before_or_after_plus' => 'after',
87
- 'ssba_additional_css' => '',
88
- 'ssba_custom_styles' => '',
89
- 'ssba_custom_styles_enabled' => '',
90
- 'ssba_plus_additional_css' => '',
91
- 'ssba_plus_custom_styles' => '',
92
- 'ssba_plus_custom_styles_enabled' => '',
93
- 'ssba_bar_additional_css' => '',
94
- 'ssba_bar_custom_styles' => '',
95
- 'ssba_bar_custom_styles_enabled' => '',
96
- 'ssba_email_message' => '',
97
- 'ssba_twitter_text' => '',
98
- 'ssba_buffer_text' => '',
99
- 'ssba_flattr_user_id' => '',
100
- 'ssba_flattr_url' => '',
101
- 'ssba_bar_share_new_window' => 'Y',
102
- 'ssba_share_new_window' => 'Y',
103
- 'ssba_plus_share_new_window' => 'Y',
104
- 'ssba_link_to_ssb' => 'N',
105
- 'ssba_show_share_count' => '',
106
- 'ssba_plus_show_share_count' => '',
107
- 'ssba_bar_show_share_count' => '',
108
- 'ssba_share_count_style' => 'default',
109
- 'ssba_share_count_css' => '',
110
- 'ssba_share_count_once' => 'Y',
111
- 'ssba_plus_share_count_style' => 'default',
112
- 'ssba_plus_share_count_css' => '',
113
- 'ssba_plus_share_count_once' => 'Y',
114
- 'ssba_bar_share_count_style' => 'default',
115
- 'ssba_bar_share_count_css' => '',
116
- 'ssba_bar_share_count_once' => 'Y',
117
- 'ssba_widget_text' => '',
118
- 'ssba_rel_nofollow' => '',
119
- 'ssba_default_pinterest' => '',
120
- 'ssba_pinterest_featured' => '',
121
- 'ssba_plus_widget_text' => '',
122
- 'ssba_plus_rel_nofollow' => '',
123
- 'ssba_plus_default_pinterest' => '',
124
- 'ssba_plus_pinterest_featured' => '',
125
- 'ssba_bar_widget_text' => '',
126
- 'ssba_bar_rel_nofollow' => '',
127
- 'ssba_bar_default_pinterest' => '',
128
- 'ssba_bar_pinterest_featured' => '',
129
- 'ssba_content_priority' => '10',
130
-
131
- // Share container.
132
- 'ssba_div_padding' => '',
133
- 'ssba_div_rounded_corners' => '',
134
- 'ssba_border_width' => '',
135
- 'ssba_div_border' => '',
136
- 'ssba_div_background' => '',
137
-
138
- // Share text.
139
- 'ssba_share_text' => esc_html__('Share this...', 'simple-share-buttons-adder'),
140
- 'ssba_text_placement' => 'above',
141
- 'ssba_font_family' => '',
142
- 'ssba_font_color' => '',
143
- 'ssba_font_size' => '12',
144
- 'ssba_font_weight' => '',
145
- 'ssba_plus_share_text' => esc_html__('Share this...', 'simple-share-buttons-adder'),
146
- 'ssba_plus_text_placement' => 'above',
147
- 'ssba_plus_font_family' => '',
148
- 'ssba_plus_font_color' => '',
149
- 'ssba_plus_font_size' => '12',
150
- 'ssba_plus_font_weight' => '',
151
-
152
- // Include.
153
- 'ssba_selected_buttons' => 'facebook,pinterest,twitter,linkedin',
154
- 'ssba_selected_bar_buttons' => 'facebook,pinterest,twitter,linkedin',
155
- 'ssba_selected_plus_buttons' => 'facebook,pinterest,twitter,linkedin',
156
- 'ssba_plus_button_style' => 1,
157
- 'ssba_bar_style' => 1,
158
- 'ssba_new_buttons' => '',
159
- 'ssba_bar_enabled' => '',
160
- 'ssba_bar_position' => 'left',
161
- 'ssba_plus_height' => '48',
162
- 'ssba_plus_width' => '48',
163
- 'ssba_plus_margin' => '12',
164
- 'ssba_plus_button_color' => '',
165
- 'ssba_plus_button_hover_color' => '',
166
- 'ssba_plus_icon_size' => '',
167
- 'ssba_plus_icon_color' => '',
168
- 'ssba_plus_icon_hover_color' => '',
169
- 'ssba_bar_height' => '48',
170
- 'ssba_bar_width' => '48',
171
- 'ssba_bar_margin' => '0',
172
- 'ssba_bar_icon_size' => '',
173
- 'ssba_bar_button_color' => '',
174
- 'ssba_bar_button_hover_color' => '',
175
- 'ssba_bar_icon_color' => '',
176
- 'ssba_bar_icon_hover_color' => '',
177
- 'ssba_bar_desktop' => 'Y',
178
- 'ssba_bar_mobile' => 'Y',
179
- 'ssba_mobile_breakpoint' => '',
180
-
181
- // Custom images.
182
- 'ssba_custom_email' => '',
183
- 'ssba_custom_facebook' => '',
184
- 'ssba_custom_facebook_save' => '',
185
- 'ssba_custom_flipboard' => '',
186
- 'ssba_custom_twitter' => '',
187
- 'ssba_custom_diggit' => '',
188
- 'ssba_custom_line' => '',
189
- 'ssba_custom_weibo' => '',
190
- 'ssba_custom_linkedin' => '',
191
- 'ssba_custom_pinterest' => '',
192
- 'ssba_custom_print' => '',
193
- 'ssba_custom_reddit' => '',
194
- 'ssba_custom_skype' => '',
195
- 'ssba_custom_snapchat' => '',
196
- 'ssba_custom_stumbleupon' => '',
197
- 'ssba_custom_buffer' => '',
198
- 'ssba_custom_flattr' => '',
199
- 'ssba_custom_telegram' => '',
200
- 'ssba_custom_tumblr' => '',
201
- 'ssba_custom_vk' => '',
202
- 'ssba_custom_yummly' => '',
203
-
204
- // Sharedcount.
205
- 'sharedcount_enabled' => '',
206
- 'sharedcount_api_key' => '',
207
- 'sharedcount_plan' => 'free',
208
- 'sharedcount_plus_enabled' => '',
209
- 'sharedcount_plus_api_key' => '',
210
- 'sharedcount_plus_plan' => 'free',
211
- 'sharedcount_share_enabled' => '',
212
- 'sharedcount_share_api_key' => '',
213
- 'sharedcount_share_plan' => 'free',
214
-
215
- // New with sharethis.
216
- 'facebook_insights' => '',
217
- 'facebook_app_id' => '',
218
- 'ignore_facebook_sdk' => '',
219
- 'plus_facebook_insights' => '',
220
- 'plus_facebook_app_id' => '',
221
- 'plus_ignore_facebook_sdk' => '',
222
- 'share_facebook_insights' => '',
223
- 'share_facebook_app_id' => '',
224
- 'accepted_sharethis_terms' => 'N',
225
- );
226
-
227
- if ($return_array) {
228
- return $ssba_settings;
229
- }
230
-
231
- // The current setting if any.
232
- $current_settings = get_option('ssba_settings', true);
233
- $current_settings = is_array($current_settings) && null !== $current_settings && false !== $current_settings ? $current_settings : array();
234
-
235
- foreach ($ssba_settings as $setting_name => $value) {
236
- if (! isset($current_settings[$setting_name])) {
237
- $current_settings[$setting_name] = $value;
238
- }
239
- }
240
-
241
- update_option('ssba_settings', $current_settings);
242
- }
243
-
244
- /**
245
- * Activate ssba function.
246
- */
247
- public function activate()
248
- {
249
- // Likely a reactivation, return doing nothing.
250
- if (false !== get_option('ssba_version')) {
251
- return;
252
- }
253
-
254
- $ssba_settings = $this->get_setting_array(true);
255
-
256
- // Insert default options for ssba.
257
- update_option('ssba_settings', $ssba_settings);
258
-
259
- // Button helper array.
260
- $this->ssba_button_helper_array();
261
-
262
- // Ssba version.
263
- add_option('ssba_version', SSBA_VERSION);
264
- }
265
-
266
- /**
267
- * Deactivate ssba.
268
- */
269
- public function deactivate()
270
- {
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
- /**
280
- * The upgrade function.
281
- *
282
- * @param array $arr_settings The current ssba settings.
283
- * @param string $version The current plugin version.
284
- */
285
- public function upgrade_ssba($arr_settings, $version)
286
- {
287
- // If version is less than 7.4.10.
288
- if ($version < '7.7.21') {
289
- $this->ssba_button_helper_array();
290
- }
291
-
292
- // If version is less than 7.4.10.
293
- if ($version < '7.4.10') {
294
- $new_settings = array(
295
- 'ssba_plus_align' => 'left',
296
- 'ssba_bar_align' => 'left',
297
- 'ssba_before_or_after_plus' => 'after',
298
- 'ssba_share_new_window' => 'Y',
299
- 'ssba_plus_share_text' => esc_html__('Share this...', 'simple-share-buttons-adder'),
300
- 'ssba_plus_text_placement' => 'above',
301
- 'ssba_plus_font_family' => '',
302
- 'ssba_plus_font_color' => '',
303
- 'ssba_plus_font_size' => '12',
304
- 'ssba_plus_font_weight' => '',
305
- 'ssba_selected_bar_buttons' => 'facebook,pinterest,twitter,linkedin',
306
- 'ssba_selected_plus_buttons' => 'facebook,pinterest,twitter,linkedin',
307
- 'ssba_plus_button_style' => 1,
308
- 'ssba_bar_style' => 1,
309
- 'ssba_new_buttons' => '',
310
- 'ssba_bar_enabled' => '',
311
- 'ssba_bar_position' => 'left',
312
- 'ssba_plus_height' => '48',
313
- 'ssba_plus_width' => '48',
314
- 'ssba_plus_margin' => '12',
315
- 'ssba_plus_button_color' => '',
316
- 'ssba_plus_button_hover_color' => '',
317
- 'ssba_plus_icon_size' => '',
318
- 'ssba_plus_icon_color' => '',
319
- 'ssba_plus_icon_hover_color' => '',
320
- 'ssba_bar_height' => '48',
321
- 'ssba_bar_width' => '48',
322
- 'ssba_bar_margin' => '0',
323
- 'ssba_bar_icon_size' => '',
324
- 'ssba_bar_button_color' => '',
325
- 'ssba_bar_button_hover_color' => '',
326
- 'ssba_bar_icon_color' => '',
327
- 'ssba_bar_icon_hover_color' => '',
328
- 'ssba_bar_desktop' => 'Y',
329
- 'ssba_bar_mobile' => 'Y',
330
- 'ssba_mobile_breakpoint' => '',
331
- 'ssba_bar_show_share_count' => '',
332
- );
333
-
334
- $current_settings = get_option('ssba_settings', true);
335
- $new_array = $new_settings + $current_settings;
336
-
337
- update_option('ssba_settings', $new_array);
338
-
339
- // Ssba version.
340
- update_option('ssba_version', SSBA_VERSION);
341
- } // End if().
342
-
343
- // If version is less than 6.0.5.
344
- if ($version < '6.0.5') {
345
- // Ensure excerpts are set.
346
- add_option('ssba_excerpts', '');
347
-
348
- // Add print button.
349
- add_option('ssba_custom_print', '');
350
-
351
- // New for 3.8.
352
- add_option('ssba_widget_text', '');
353
- add_option('ssba_rel_nofollow', '');
354
-
355
- // Added pre 4.5, added in 4.6 to fix notice.
356
- add_option('ssba_rel_nofollow', '');
357
-
358
- // Added in 5.0.
359
- add_option('ssba_custom_vk', '');
360
- add_option('ssba_custom_yummly', '');
361
-
362
- // Added in 5.2.
363
- add_option('ssba_default_pinterest', '');
364
-
365
- // Added in 5.5.
366
- add_option('ssba_pinterest_featured', '');
367
-
368
- // Added in 5.7. Additional CSS field.
369
- add_option('ssba_additional_css', '');
370
-
371
- // Empty custom CSS var and option.
372
- $custom_css = '';
373
-
374
- add_option('ssba_custom_styles_enabled', '');
375
-
376
- // If some custom styles are in place.
377
- if ('' !== $arr_settings['ssba_custom_styles']) {
378
- $custom_css .= $arr_settings['ssba_custom_styles'];
379
-
380
- update_option('ssba_custom_styles_enabled', 'Y');
381
- }
382
-
383
- // If some custom share count styles are in place.
384
- if ('' !== $arr_settings['ssba_bar_count_css']) {
385
- $custom_css .= $arr_settings['ssba_bar_count_css'];
386
-
387
- update_option('ssba_custom_styles_enabled', 'Y');
388
- }
389
-
390
- // Update custom CSS option.
391
- update_option('ssba_custom_styles', $custom_css);
392
-
393
- // Content priority.
394
- add_option('ssba_content_priority', '10');
395
- } // End if().
396
-
397
- // If version is less than 6.0.6.
398
- if ($version < '6.0.6') {
399
- // Get old settings.
400
- $old_settings = $this->get_old_ssba_settings();
401
-
402
- // Json encode old settings.
403
- $json_settings = $old_settings;
404
-
405
- // Insert all options for ssba as json.
406
- add_option('ssba_settings', $json_settings);
407
-
408
- // Delete old options.
409
- $this->ssba_delete_old_options();
410
- }
411
-
412
- // If version is less than 6.1.3.
413
- if ($version < '6.1.3') {
414
- // New settings.
415
- $new = array(
416
- 'sharedcount_enabled' => '',
417
- 'sharedcount_api_key' => '',
418
- 'sharedcount_plan' => 'free',
419
- );
420
-
421
- // Update settings.
422
- $this->class_ssba->ssba_update_options($new);
423
- }
424
-
425
- // If version is less than 6.2.0.
426
- if ($version < '6.2.0') {
427
- // New settings.
428
- $new = array(
429
- 'facebook_insights' => '',
430
- 'facebook_app_id' => '',
431
- 'accepted_sharethis_terms' => '',
432
- );
433
-
434
- // Update settings.
435
- $this->class_ssba->ssba_update_options($new);
436
- }
437
-
438
- // Button helper array.
439
- $this->ssba_button_helper_array();
440
-
441
- // Update version number.
442
- update_option('ssba_version', SSBA_VERSION);
443
- }
444
-
445
- /**
446
- * Button helper option.
447
- */
448
- public function ssba_button_helper_array()
449
- {
450
- $buttons = array(
451
- 'buffer' => array(
452
- 'full_name' => esc_html__('Buffer', 'simple-share-buttons-adder'),
453
- ),
454
- 'diggit' => array(
455
- 'full_name' => esc_html__('Diggit', 'simple-share-buttons-adder'),
456
- ),
457
- 'line' => array(
458
- 'full_name' => esc_html__('Line', 'simple-share-buttons-adder'),
459
- ),
460
- 'skype' => array(
461
- 'full_name' => esc_html__('Skype', 'simple-share-buttons-adder'),
462
- ),
463
- 'weibo' => array(
464
- 'full_name' => esc_html__('Weibo', 'simple-share-buttons-adder'),
465
- ),
466
- 'email' => array(
467
- 'full_name' => esc_html__('Email', 'simple-share-buttons-adder'),
468
- ),
469
- 'facebook' => array(
470
- 'full_name' => esc_html__('Facebook', 'simple-share-buttons-adder'),
471
- ),
472
- 'facebook_save' => array(
473
- 'full_name' => esc_html__('Facebook Save', 'simple-share-buttons-adder'),
474
- ),
475
- 'flattr' => array(
476
- 'full_name' => esc_html__('Flattr', 'simple-share-buttons-adder'),
477
- ),
478
- 'flipboard' => array(
479
- 'full_name' => esc_html__('Flipboard', 'simple-share-buttons-adder'),
480
- ),
481
- 'linkedin' => array(
482
- 'full_name' => esc_html__('LinkedIn', 'simple-share-buttons-adder'),
483
- ),
484
- 'pinterest' => array(
485
- 'full_name' => esc_html__('Pinterest', 'simple-share-buttons-adder'),
486
- ),
487
- 'print' => array(
488
- 'full_name' => esc_html__('Print', 'simple-share-buttons-adder'),
489
- ),
490
- 'reddit' => array(
491
- 'full_name' => esc_html__('Reddit', 'simple-share-buttons-adder'),
492
- ),
493
- 'snapchat' => array(
494
- 'full_name' => esc_html__('Snapchat', 'simple-share-buttons-adder'),
495
- ),
496
- 'stumbleupon' => array(
497
- 'full_name' => esc_html__('StumbleUpon', 'simple-share-buttons-adder'),
498
- ),
499
- 'telegram' => array(
500
- 'full_name' => esc_html__('Telegram', 'simple-share-buttons-adder'),
501
- ),
502
- 'tumblr' => array(
503
- 'full_name' => esc_html__('Tumblr', 'simple-share-buttons-adder'),
504
- ),
505
- 'twitter' => array(
506
- 'full_name' => esc_html__('Twitter', 'simple-share-buttons-adder'),
507
- ),
508
- 'vk' => array(
509
- 'full_name' => esc_html__('VK', 'simple-share-buttons-adder'),
510
- ),
511
- 'whatsapp' => array(
512
- 'full_name' => esc_html__('WhatsApp', 'simple-share-buttons-adder'),
513
- ),
514
- 'xing' => array(
515
- 'full_name' => esc_html__('Xing', 'simple-share-buttons-adder'),
516
- ),
517
- 'yummly' => array(
518
- 'full_name' => esc_html__('Yummly', 'simple-share-buttons-adder'),
519
- ),
520
- );
521
-
522
- // Helper array for ssbp.
523
- update_option('ssba_buttons', $buttons);
524
- }
525
-
526
- /**
527
- * Delete old options to move to json array.
528
- */
529
- public function ssba_delete_old_options()
530
- {
531
- // Delete all options.
532
- delete_option('ssba_version');
533
- delete_option('ssba_image_set');
534
- delete_option('ssba_size');
535
- delete_option('ssba_pages');
536
- delete_option('ssba_posts');
537
- delete_option('ssba_cats_archs');
538
- delete_option('ssba_homepage');
539
- delete_option('ssba_excerpts');
540
- delete_option('ssba_plus_pages');
541
- delete_option('ssba_plus_posts');
542
- delete_option('ssba_plus_cats_archs');
543
- delete_option('ssba_plus_homepage');
544
- delete_option('ssba_plus_excerpts');
545
- delete_option('ssba_omit_pages');
546
- delete_option('ssba_omit_pages_bar');
547
- delete_option('ssba_omit_pages_plus');
548
- delete_option('ssba_bar_enabled');
549
- delete_option('ssba_bar_pages');
550
- delete_option('ssba_bar_posts');
551
- delete_option('ssba_bar_cats_archs');
552
- delete_option('ssba_bar_homepage');
553
- delete_option('ssba_bar_excerpts');
554
- delete_option('ssba_align');
555
- delete_option('ssba_plus_align');
556
- delete_option('ssba_padding');
557
- delete_option('ssba_before_or_after');
558
- delete_option('ssba_before_or_after_plus');
559
- delete_option('ssba_additional_css');
560
- delete_option('ssba_custom_styles');
561
- delete_option('ssba_custom_styles_enabled');
562
- delete_option('ssba_email_message');
563
- delete_option('ssba_buffer_text');
564
- delete_option('ssba_twitter_text');
565
- delete_option('ssba_flattr_user_id');
566
- delete_option('ssba_flattr_url');
567
- delete_option('ssba_share_new_window');
568
- delete_option('ssba_link_to_ssb');
569
- delete_option('ssba_show_share_count');
570
- delete_option('ssba_bar_count_style');
571
- delete_option('ssba_bar_count_css');
572
- delete_option('ssba_bar_count_once');
573
- delete_option('ssba_widget_text');
574
- delete_option('ssba_rel_nofollow');
575
- delete_option('ssba_default_pinterest');
576
- delete_option('ssba_pinterest_featured');
577
- delete_option('ssba_content_priority');
578
- delete_option('ssba_plus_additional_css');
579
- delete_option('ssba_plus_custom_styles');
580
- delete_option('ssba_plus_custom_styles_enabled');
581
- delete_option('ssba_plus_email_message');
582
- delete_option('ssba_plus_buffer_text');
583
- delete_option('ssba_plus_twitter_text');
584
- delete_option('ssba_plus_flattr_user_id');
585
- delete_option('ssba_plus_flattr_url');
586
- delete_option('ssba_plus_share_new_window');
587
- delete_option('ssba_plus_link_to_ssb');
588
- delete_option('ssba_plus_show_share_count');
589
- delete_option('ssba_plus_share_count_style');
590
- delete_option('ssba_plus_share_count_css');
591
- delete_option('ssba_plus_share_count_once');
592
- delete_option('ssba_plus_widget_text');
593
- delete_option('ssba_plus_rel_nofollow');
594
- delete_option('ssba_plus_default_pinterest');
595
- delete_option('ssba_plus_pinterest_featured');
596
- delete_option('ssba_bar_additional_css');
597
- delete_option('ssba_bar_custom_styles');
598
- delete_option('ssba_bar_custom_styles_enabled');
599
- delete_option('ssba_bar_email_message');
600
- delete_option('ssba_bar_buffer_text');
601
- delete_option('ssba_bar_twitter_text');
602
- delete_option('ssba_bar_flattr_user_id');
603
- delete_option('ssba_bar_flattr_url');
604
- delete_option('ssba_bar_share_new_window');
605
- delete_option('ssba_bar_link_to_ssb');
606
- delete_option('ssba_bar_show_share_count');
607
- delete_option('ssba_bar_share_count_style');
608
- delete_option('ssba_bar_share_count_css');
609
- delete_option('ssba_bar_share_count_once');
610
- delete_option('ssba_bar_widget_text');
611
- delete_option('ssba_bar_rel_nofollow');
612
- delete_option('ssba_bar_default_pinterest');
613
- delete_option('ssba_bar_pinterest_featured');
614
-
615
- // Share container.
616
- delete_option('ssba_div_padding');
617
- delete_option('ssba_div_rounded_corners');
618
- delete_option('ssba_border_width');
619
- delete_option('ssba_div_border');
620
- delete_option('ssba_div_background');
621
-
622
- // Share text.
623
- delete_option('ssba_share_text');
624
- delete_option('ssba_text_placement');
625
- delete_option('ssba_font_family');
626
- delete_option('ssba_font_color');
627
- delete_option('ssba_font_size');
628
- delete_option('ssba_font_weight');
629
- delete_option('ssba_plus_share_text');
630
- delete_option('ssba_plus_text_placement');
631
- delete_option('ssba_plus_font_family');
632
- delete_option('ssba_plus_font_color');
633
- delete_option('ssba_plus_font_size');
634
- delete_option('ssba_plus_font_weight');
635
-
636
- // Include.
637
- delete_option('ignore_facebook_sdk');
638
- delete_option('plus_ignore_facebook_sdk');
639
- delete_option('ssba_selected_buttons');
640
- delete_option('ssba_selected_share_buttons');
641
- delete_option('ssba_selected_plus_buttons');
642
- delete_option('ssba_bar_button_style');
643
- delete_option('ssba_bar_style');
644
- delete_option('ssba_new_buttons');
645
- delete_option('ssba_bar_position');
646
- delete_option('ssba_plus_height');
647
- delete_option('ssba_plus_width');
648
- delete_option('ssba_plus_margin');
649
- delete_option('ssba_plus_button_color');
650
- delete_option('ssba_plus_button_hover_color');
651
- delete_option('ssba_plus_icon_size');
652
- delete_option('ssba_plus_icon_color');
653
- delete_option('ssba_plus_icon_hover_color');
654
- delete_option('ssba_bar_height');
655
- delete_option('ssba_bar_width');
656
- delete_option('ssba_bar_margin');
657
- delete_option('ssba_bar_button_color');
658
- delete_option('ssba_bar_button_hover_color');
659
- delete_option('ssba_bar_icon_size');
660
- delete_option('ssba_bar_icon_color');
661
- delete_option('ssba_bar_icon_hover_color');
662
- delete_option('ssba_bar_desktop');
663
- delete_option('ssba_bar_mobile');
664
- delete_option('ssba_mobile_breakpoint');
665
-
666
- // Custom images.
667
- delete_option('ssba_custom_email');
668
- delete_option('ssba_custom_google');
669
- delete_option('ssba_custom_facebook');
670
- delete_option('ssba_custom_twitter');
671
- delete_option('ssba_custom_diggit');
672
- delete_option('ssba_custom_linkedin');
673
- delete_option('ssba_custom_reddit');
674
- delete_option('ssba_custom_stumbleupon');
675
- delete_option('ssba_custom_pinterest');
676
- delete_option('ssba_custom_buffer');
677
- delete_option('ssba_custom_flattr');
678
- delete_option('ssba_custom_tumblr');
679
- delete_option('ssba_custom_print');
680
- delete_option('ssba_custom_vk');
681
- delete_option('ssba_custom_yummly');
682
-
683
- // Notice.
684
- delete_option('ssba_dismiss_notice');
685
- }
686
-
687
- /**
688
- * Return old ssba settings (pre 6.0.6).
689
- *
690
- * @return array|null|object
691
- */
692
- public function get_old_ssba_settings()
693
- {
694
- global $wp_registered_settings;
695
-
696
- // Set variable.
697
- $arr_settings = array();
698
-
699
- foreach ($wp_registered_settings as $name => $value) {
700
- if (in_array('ssba', explode('_', $name), true)) {
701
- $arr_settings[$name] = $value;
702
- }
703
- }
704
-
705
- return $arr_settings;
706
- }
707
  }
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
+ class Database {
16
+
17
+
18
+ /**
19
+ * Plugin instance.
20
+ *
21
+ * @var object
22
+ */
23
+ public $plugin;
24
+
25
+ /**
26
+ * Simple Share Buttons Adder instance.
27
+ *
28
+ * @var object
29
+ */
30
+ public $class_ssba;
31
+
32
+ /**
33
+ * Class constructor.
34
+ *
35
+ * @param object $plugin Plugin class.
36
+ * @param object $class_ssba Simple Share Buttons Adder class.
37
+ */
38
+ public function __construct( $plugin, $class_ssba ) {
39
+ $this->plugin = $plugin;
40
+ $this->class_ssba = $class_ssba;
41
+
42
+ // Run the activation function upon activation of the plugin.
43
+ register_activation_hook( $this->plugin->dir_path . '/simple-share-buttons-adder.php', array( $this, 'activate' ) );
44
+
45
+ // Register deactivation hook.
46
+ register_deactivation_hook( $this->plugin->dir_path . '/simple-share-buttons-adder.php', array( $this, 'deactivate' ) );
47
+ }
48
+
49
+ /**
50
+ * Add any settings default if it doesn't exist already.
51
+ *
52
+ * @param bool $return_array Whether to return the default setting array or not.
53
+ *
54
+ * @action admin_init
55
+ */
56
+ public function get_setting_array( $return_array = false ) {
57
+ // Array ready with defaults.
58
+ $ssba_settings = array(
59
+ 'ssba_omit_pages' => '',
60
+ 'ssba_omit_pages_plus' => '',
61
+ 'ssba_omit_pages_bar' => '',
62
+ 'ssba_image_set' => 'somacro',
63
+ 'ssba_size' => '35',
64
+ 'ssba_pages' => '',
65
+ 'ssba_posts' => '',
66
+ 'ssba_cats_archs' => '',
67
+ 'ssba_homepage' => '',
68
+ 'ssba_excerpts' => '',
69
+ 'ssba_plus_pages' => '',
70
+ 'ssba_plus_posts' => '',
71
+ 'ssba_plus_cats_archs' => '',
72
+ 'ssba_plus_homepage' => '',
73
+ 'ssba_plus_excerpts' => '',
74
+ 'ssba_bar_pages' => '',
75
+ 'ssba_bar_posts' => '',
76
+ 'ssba_bar_cats_archs' => '',
77
+ 'ssba_bar_homepage' => '',
78
+ 'ssba_bar_excerpts' => '',
79
+ 'ssba_align' => 'left',
80
+ 'ssba_plus_align' => 'center',
81
+ 'ssba_bar_align' => 'left',
82
+ 'ssba_padding' => '6',
83
+ 'ssba_before_or_after' => 'after',
84
+ 'ssba_before_or_after_plus' => 'after',
85
+ 'ssba_additional_css' => '',
86
+ 'ssba_custom_styles' => '',
87
+ 'ssba_custom_styles_enabled' => '',
88
+ 'ssba_plus_additional_css' => '',
89
+ 'ssba_plus_custom_styles' => '',
90
+ 'ssba_plus_custom_styles_enabled' => '',
91
+ 'ssba_bar_additional_css' => '',
92
+ 'ssba_bar_custom_styles' => '',
93
+ 'ssba_bar_custom_styles_enabled' => '',
94
+ 'ssba_email_message' => '',
95
+ 'ssba_twitter_text' => '',
96
+ 'ssba_buffer_text' => '',
97
+ 'ssba_flattr_user_id' => '',
98
+ 'ssba_flattr_url' => '',
99
+ 'ssba_bar_share_new_window' => 'Y',
100
+ 'ssba_share_new_window' => 'Y',
101
+ 'ssba_plus_share_new_window' => 'Y',
102
+ 'ssba_link_to_ssb' => 'N',
103
+ 'ssba_show_share_count' => '',
104
+ 'ssba_plus_show_share_count' => '',
105
+ 'ssba_bar_show_share_count' => '',
106
+ 'ssba_share_count_style' => 'default',
107
+ 'ssba_share_count_css' => '',
108
+ 'ssba_share_count_once' => 'Y',
109
+ 'ssba_plus_share_count_style' => 'default',
110
+ 'ssba_plus_share_count_css' => '',
111
+ 'ssba_plus_share_count_once' => 'Y',
112
+ 'ssba_bar_share_count_style' => 'default',
113
+ 'ssba_bar_share_count_css' => '',
114
+ 'ssba_bar_share_count_once' => 'Y',
115
+ 'ssba_widget_text' => '',
116
+ 'ssba_rel_nofollow' => '',
117
+ 'ssba_default_pinterest' => '',
118
+ 'ssba_pinterest_featured' => '',
119
+ 'ssba_plus_widget_text' => '',
120
+ 'ssba_plus_rel_nofollow' => '',
121
+ 'ssba_plus_default_pinterest' => '',
122
+ 'ssba_plus_pinterest_featured' => '',
123
+ 'ssba_bar_widget_text' => '',
124
+ 'ssba_bar_rel_nofollow' => '',
125
+ 'ssba_bar_default_pinterest' => '',
126
+ 'ssba_bar_pinterest_featured' => '',
127
+ 'ssba_content_priority' => '10',
128
+
129
+ // Share container.
130
+ 'ssba_div_padding' => '',
131
+ 'ssba_div_rounded_corners' => '',
132
+ 'ssba_border_width' => '',
133
+ 'ssba_div_border' => '',
134
+ 'ssba_div_background' => '',
135
+
136
+ // Share text.
137
+ 'ssba_share_text' => esc_html__( 'Share this...', 'simple-share-buttons-adder' ),
138
+ 'ssba_text_placement' => 'above',
139
+ 'ssba_font_family' => '',
140
+ 'ssba_font_color' => '',
141
+ 'ssba_font_size' => '12',
142
+ 'ssba_font_weight' => '',
143
+ 'ssba_plus_share_text' => esc_html__( 'Share this...', 'simple-share-buttons-adder' ),
144
+ 'ssba_plus_text_placement' => 'above',
145
+ 'ssba_plus_font_family' => '',
146
+ 'ssba_plus_font_color' => '',
147
+ 'ssba_plus_font_size' => '12',
148
+ 'ssba_plus_font_weight' => '',
149
+
150
+ // Include.
151
+ 'ssba_selected_buttons' => 'facebook,pinterest,twitter,linkedin',
152
+ 'ssba_selected_bar_buttons' => 'facebook,pinterest,twitter,linkedin',
153
+ 'ssba_selected_plus_buttons' => 'facebook,pinterest,twitter,linkedin',
154
+ 'ssba_plus_button_style' => 1,
155
+ 'ssba_bar_style' => 1,
156
+ 'ssba_new_buttons' => '',
157
+ 'ssba_bar_enabled' => '',
158
+ 'ssba_bar_position' => 'left',
159
+ 'ssba_plus_height' => '48',
160
+ 'ssba_plus_width' => '48',
161
+ 'ssba_plus_margin' => '12',
162
+ 'ssba_plus_button_color' => '',
163
+ 'ssba_plus_button_hover_color' => '',
164
+ 'ssba_plus_icon_size' => '',
165
+ 'ssba_plus_icon_color' => '',
166
+ 'ssba_plus_icon_hover_color' => '',
167
+ 'ssba_bar_height' => '48',
168
+ 'ssba_bar_width' => '48',
169
+ 'ssba_bar_margin' => '0',
170
+ 'ssba_bar_icon_size' => '',
171
+ 'ssba_bar_button_color' => '',
172
+ 'ssba_bar_button_hover_color' => '',
173
+ 'ssba_bar_icon_color' => '',
174
+ 'ssba_bar_icon_hover_color' => '',
175
+ 'ssba_bar_desktop' => 'Y',
176
+ 'ssba_bar_mobile' => 'Y',
177
+ 'ssba_mobile_breakpoint' => '',
178
+
179
+ // Custom images.
180
+ 'ssba_custom_email' => '',
181
+ 'ssba_custom_facebook' => '',
182
+ 'ssba_custom_flipboard' => '',
183
+ 'ssba_custom_twitter' => '',
184
+ 'ssba_custom_diggit' => '',
185
+ 'ssba_custom_line' => '',
186
+ 'ssba_custom_weibo' => '',
187
+ 'ssba_custom_linkedin' => '',
188
+ 'ssba_custom_pinterest' => '',
189
+ 'ssba_custom_print' => '',
190
+ 'ssba_custom_reddit' => '',
191
+ 'ssba_custom_skype' => '',
192
+ 'ssba_custom_snapchat' => '',
193
+ 'ssba_custom_stumbleupon' => '',
194
+ 'ssba_custom_buffer' => '',
195
+ 'ssba_custom_flattr' => '',
196
+ 'ssba_custom_telegram' => '',
197
+ 'ssba_custom_tumblr' => '',
198
+ 'ssba_custom_vk' => '',
199
+ 'ssba_custom_yummly' => '',
200
+
201
+ // Sharedcount.
202
+ 'sharedcount_enabled' => '',
203
+ 'sharedcount_api_key' => '',
204
+ 'sharedcount_plan' => 'free',
205
+ 'sharedcount_plus_enabled' => '',
206
+ 'sharedcount_plus_api_key' => '',
207
+ 'sharedcount_plus_plan' => 'free',
208
+ 'sharedcount_share_enabled' => '',
209
+ 'sharedcount_share_api_key' => '',
210
+ 'sharedcount_share_plan' => 'free',
211
+
212
+ // New with sharethis.
213
+ 'facebook_insights' => '',
214
+ 'facebook_app_id' => '',
215
+ 'ignore_facebook_sdk' => '',
216
+ 'plus_facebook_insights' => '',
217
+ 'plus_facebook_app_id' => '',
218
+ 'plus_ignore_facebook_sdk' => '',
219
+ 'share_facebook_insights' => '',
220
+ 'share_facebook_app_id' => '',
221
+ 'accepted_sharethis_terms' => 'N',
222
+ );
223
+
224
+ if ( $return_array ) {
225
+ return $ssba_settings;
226
+ }
227
+
228
+ // The current setting if any.
229
+ $current_settings = get_option( 'ssba_settings', true );
230
+ $current_settings = is_array( $current_settings ) && null !== $current_settings && false !== $current_settings ? $current_settings : array();
231
+
232
+ foreach ( $ssba_settings as $setting_name => $value ) {
233
+ if ( ! isset( $current_settings[ $setting_name ] ) ) {
234
+ $current_settings[ $setting_name ] = $value;
235
+ }
236
+ }
237
+
238
+ update_option( 'ssba_settings', $current_settings );
239
+ }
240
+
241
+ /**
242
+ * Activate ssba function.
243
+ */
244
+ public function activate() {
245
+ // Likely a reactivation, return doing nothing.
246
+ if ( false !== get_option( 'ssba_version' ) ) {
247
+ return;
248
+ }
249
+
250
+ $ssba_settings = $this->get_setting_array( true );
251
+
252
+ // Insert default options for ssba.
253
+ update_option( 'ssba_settings', $ssba_settings );
254
+
255
+ // Button helper array.
256
+ $this->ssba_button_helper_array();
257
+
258
+ // Ssba version.
259
+ add_option( 'ssba_version', SSBA_VERSION );
260
+ }
261
+
262
+ /**
263
+ * Deactivate ssba.
264
+ */
265
+ public function deactivate() {
266
+ // Delete options.
267
+ delete_option( 'ssba_settings' );
268
+ delete_option( 'ssba_version' );
269
+ delete_option( 'ssba_property_id' );
270
+ delete_option( 'ssba_token' );
271
+ delete_option( 'ssba_buttons' );
272
+ }
273
+
274
+ /**
275
+ * The upgrade function.
276
+ *
277
+ * @param array $arr_settings The current ssba settings.
278
+ * @param string $version The current plugin version.
279
+ */
280
+ public function upgrade_ssba( $arr_settings, $version ) {
281
+ // If version is less than 7.4.10.
282
+ if ( $version < '7.7.21' ) {
283
+ $this->ssba_button_helper_array();
284
+ }
285
+
286
+ // If version is less than 7.4.10.
287
+ if ( $version < '7.4.10' ) {
288
+ $new_settings = array(
289
+ 'ssba_plus_align' => 'left',
290
+ 'ssba_bar_align' => 'left',
291
+ 'ssba_before_or_after_plus' => 'after',
292
+ 'ssba_share_new_window' => 'Y',
293
+ 'ssba_plus_share_text' => esc_html__( 'Share this...', 'simple-share-buttons-adder' ),
294
+ 'ssba_plus_text_placement' => 'above',
295
+ 'ssba_plus_font_family' => '',
296
+ 'ssba_plus_font_color' => '',
297
+ 'ssba_plus_font_size' => '12',
298
+ 'ssba_plus_font_weight' => '',
299
+ 'ssba_selected_bar_buttons' => 'facebook,pinterest,twitter,linkedin',
300
+ 'ssba_selected_plus_buttons' => 'facebook,pinterest,twitter,linkedin',
301
+ 'ssba_plus_button_style' => 1,
302
+ 'ssba_bar_style' => 1,
303
+ 'ssba_new_buttons' => '',
304
+ 'ssba_bar_enabled' => '',
305
+ 'ssba_bar_position' => 'left',
306
+ 'ssba_plus_height' => '48',
307
+ 'ssba_plus_width' => '48',
308
+ 'ssba_plus_margin' => '12',
309
+ 'ssba_plus_button_color' => '',
310
+ 'ssba_plus_button_hover_color' => '',
311
+ 'ssba_plus_icon_size' => '',
312
+ 'ssba_plus_icon_color' => '',
313
+ 'ssba_plus_icon_hover_color' => '',
314
+ 'ssba_bar_height' => '48',
315
+ 'ssba_bar_width' => '48',
316
+ 'ssba_bar_margin' => '0',
317
+ 'ssba_bar_icon_size' => '',
318
+ 'ssba_bar_button_color' => '',
319
+ 'ssba_bar_button_hover_color' => '',
320
+ 'ssba_bar_icon_color' => '',
321
+ 'ssba_bar_icon_hover_color' => '',
322
+ 'ssba_bar_desktop' => 'Y',
323
+ 'ssba_bar_mobile' => 'Y',
324
+ 'ssba_mobile_breakpoint' => '',
325
+ 'ssba_bar_show_share_count' => '',
326
+ );
327
+
328
+ $current_settings = get_option( 'ssba_settings', true );
329
+ $new_array = $new_settings + $current_settings;
330
+
331
+ update_option( 'ssba_settings', $new_array );
332
+
333
+ // Ssba version.
334
+ update_option( 'ssba_version', SSBA_VERSION );
335
+ }
336
+
337
+ // If version is less than 6.0.5.
338
+ if ( $version < '6.0.5' ) {
339
+ // Ensure excerpts are set.
340
+ add_option( 'ssba_excerpts', '' );
341
+
342
+ // Add print button.
343
+ add_option( 'ssba_custom_print', '' );
344
+
345
+ // New for 3.8.
346
+ add_option( 'ssba_widget_text', '' );
347
+ add_option( 'ssba_rel_nofollow', '' );
348
+
349
+ // Added pre 4.5, added in 4.6 to fix notice.
350
+ add_option( 'ssba_rel_nofollow', '' );
351
+
352
+ // Added in 5.0.
353
+ add_option( 'ssba_custom_vk', '' );
354
+ add_option( 'ssba_custom_yummly', '' );
355
+
356
+ // Added in 5.2.
357
+ add_option( 'ssba_default_pinterest', '' );
358
+
359
+ // Added in 5.5.
360
+ add_option( 'ssba_pinterest_featured', '' );
361
+
362
+ // Added in 5.7. Additional CSS field.
363
+ add_option( 'ssba_additional_css', '' );
364
+
365
+ // Empty custom CSS var and option.
366
+ $custom_css = '';
367
+
368
+ add_option( 'ssba_custom_styles_enabled', '' );
369
+
370
+ // If some custom styles are in place.
371
+ if ( '' !== $arr_settings['ssba_custom_styles'] ) {
372
+ $custom_css .= $arr_settings['ssba_custom_styles'];
373
+
374
+ update_option( 'ssba_custom_styles_enabled', 'Y' );
375
+ }
376
+
377
+ // If some custom share count styles are in place.
378
+ if ( '' !== $arr_settings['ssba_bar_count_css'] ) {
379
+ $custom_css .= $arr_settings['ssba_bar_count_css'];
380
+
381
+ update_option( 'ssba_custom_styles_enabled', 'Y' );
382
+ }
383
+
384
+ // Update custom CSS option.
385
+ update_option( 'ssba_custom_styles', $custom_css );
386
+
387
+ // Content priority.
388
+ add_option( 'ssba_content_priority', '10' );
389
+ }
390
+
391
+ // If version is less than 6.0.6.
392
+ if ( $version < '6.0.6' ) {
393
+ // Get old settings.
394
+ $old_settings = $this->get_old_ssba_settings();
395
+
396
+ // Json encode old settings.
397
+ $json_settings = $old_settings;
398
+
399
+ // Insert all options for ssba as json.
400
+ add_option( 'ssba_settings', $json_settings );
401
+
402
+ // Delete old options.
403
+ $this->ssba_delete_old_options();
404
+ }
405
+
406
+ // If version is less than 6.1.3.
407
+ if ( $version < '6.1.3' ) {
408
+ // New settings.
409
+ $new = array(
410
+ 'sharedcount_enabled' => '',
411
+ 'sharedcount_api_key' => '',
412
+ 'sharedcount_plan' => 'free',
413
+ );
414
+
415
+ // Update settings.
416
+ $this->class_ssba->ssba_update_options( $new );
417
+ }
418
+
419
+ // If version is less than 6.2.0.
420
+ if ( $version < '6.2.0' ) {
421
+ // New settings.
422
+ $new = array(
423
+ 'facebook_insights' => '',
424
+ 'facebook_app_id' => '',
425
+ 'accepted_sharethis_terms' => '',
426
+ );
427
+
428
+ // Update settings.
429
+ $this->class_ssba->ssba_update_options( $new );
430
+ }
431
+
432
+ // Button helper array.
433
+ $this->ssba_button_helper_array();
434
+
435
+ // Update version number.
436
+ update_option( 'ssba_version', SSBA_VERSION );
437
+ }
438
+
439
+ /**
440
+ * Button helper option.
441
+ */
442
+ public function ssba_button_helper_array() {
443
+ $buttons = array(
444
+ 'buffer' => array(
445
+ 'full_name' => esc_html__( 'Buffer', 'simple-share-buttons-adder' ),
446
+ ),
447
+ 'diggit' => array(
448
+ 'full_name' => esc_html__( 'Diggit', 'simple-share-buttons-adder' ),
449
+ ),
450
+ 'line' => array(
451
+ 'full_name' => esc_html__( 'Line', 'simple-share-buttons-adder' ),
452
+ ),
453
+ 'skype' => array(
454
+ 'full_name' => esc_html__( 'Skype', 'simple-share-buttons-adder' ),
455
+ ),
456
+ 'weibo' => array(
457
+ 'full_name' => esc_html__( 'Weibo', 'simple-share-buttons-adder' ),
458
+ ),
459
+ 'email' => array(
460
+ 'full_name' => esc_html__( 'Email', 'simple-share-buttons-adder' ),
461
+ ),
462
+ 'facebook' => array(
463
+ 'full_name' => esc_html__( 'Facebook', 'simple-share-buttons-adder' ),
464
+ ),
465
+ 'flattr' => array(
466
+ 'full_name' => esc_html__( 'Flattr', 'simple-share-buttons-adder' ),
467
+ ),
468
+ 'flipboard' => array(
469
+ 'full_name' => esc_html__( 'Flipboard', 'simple-share-buttons-adder' ),
470
+ ),
471
+ 'linkedin' => array(
472
+ 'full_name' => esc_html__( 'LinkedIn', 'simple-share-buttons-adder' ),
473
+ ),
474
+ 'pinterest' => array(
475
+ 'full_name' => esc_html__( 'Pinterest', 'simple-share-buttons-adder' ),
476
+ ),
477
+ 'print' => array(
478
+ 'full_name' => esc_html__( 'Print', 'simple-share-buttons-adder' ),
479
+ ),
480
+ 'reddit' => array(
481
+ 'full_name' => esc_html__( 'Reddit', 'simple-share-buttons-adder' ),
482
+ ),
483
+ 'snapchat' => array(
484
+ 'full_name' => esc_html__( 'Snapchat', 'simple-share-buttons-adder' ),
485
+ ),
486
+ 'stumbleupon' => array(
487
+ 'full_name' => esc_html__( 'StumbleUpon', 'simple-share-buttons-adder' ),
488
+ ),
489
+ 'telegram' => array(
490
+ 'full_name' => esc_html__( 'Telegram', 'simple-share-buttons-adder' ),
491
+ ),
492
+ 'tumblr' => array(
493
+ 'full_name' => esc_html__( 'Tumblr', 'simple-share-buttons-adder' ),
494
+ ),
495
+ 'twitter' => array(
496
+ 'full_name' => esc_html__( 'Twitter', 'simple-share-buttons-adder' ),
497
+ ),
498
+ 'vk' => array(
499
+ 'full_name' => esc_html__( 'VK', 'simple-share-buttons-adder' ),
500
+ ),
501
+ 'whatsapp' => array(
502
+ 'full_name' => esc_html__( 'WhatsApp', 'simple-share-buttons-adder' ),
503
+ ),
504
+ 'xing' => array(
505
+ 'full_name' => esc_html__( 'Xing', 'simple-share-buttons-adder' ),
506
+ ),
507
+ 'yummly' => array(
508
+ 'full_name' => esc_html__( 'Yummly', 'simple-share-buttons-adder' ),
509
+ ),
510
+ );
511
+
512
+ // Helper array for ssbp.
513
+ update_option( 'ssba_buttons', $buttons );
514
+ }
515
+
516
+ /**
517
+ * Delete old options to move to json array.
518
+ */
519
+ public function ssba_delete_old_options() {
520
+ // Delete all options.
521
+ delete_option( 'ssba_version' );
522
+ delete_option( 'ssba_image_set' );
523
+ delete_option( 'ssba_size' );
524
+ delete_option( 'ssba_pages' );
525
+ delete_option( 'ssba_posts' );
526
+ delete_option( 'ssba_cats_archs' );
527
+ delete_option( 'ssba_homepage' );
528
+ delete_option( 'ssba_excerpts' );
529
+ delete_option( 'ssba_plus_pages' );
530
+ delete_option( 'ssba_plus_posts' );
531
+ delete_option( 'ssba_plus_cats_archs' );
532
+ delete_option( 'ssba_plus_homepage' );
533
+ delete_option( 'ssba_plus_excerpts' );
534
+ delete_option( 'ssba_omit_pages' );
535
+ delete_option( 'ssba_omit_pages_bar' );
536
+ delete_option( 'ssba_omit_pages_plus' );
537
+ delete_option( 'ssba_bar_enabled' );
538
+ delete_option( 'ssba_bar_pages' );
539
+ delete_option( 'ssba_bar_posts' );
540
+ delete_option( 'ssba_bar_cats_archs' );
541
+ delete_option( 'ssba_bar_homepage' );
542
+ delete_option( 'ssba_bar_excerpts' );
543
+ delete_option( 'ssba_align' );
544
+ delete_option( 'ssba_plus_align' );
545
+ delete_option( 'ssba_padding' );
546
+ delete_option( 'ssba_before_or_after' );
547
+ delete_option( 'ssba_before_or_after_plus' );
548
+ delete_option( 'ssba_additional_css' );
549
+ delete_option( 'ssba_custom_styles' );
550
+ delete_option( 'ssba_custom_styles_enabled' );
551
+ delete_option( 'ssba_email_message' );
552
+ delete_option( 'ssba_buffer_text' );
553
+ delete_option( 'ssba_twitter_text' );
554
+ delete_option( 'ssba_flattr_user_id' );
555
+ delete_option( 'ssba_flattr_url' );
556
+ delete_option( 'ssba_share_new_window' );
557
+ delete_option( 'ssba_link_to_ssb' );
558
+ delete_option( 'ssba_show_share_count' );
559
+ delete_option( 'ssba_bar_count_style' );
560
+ delete_option( 'ssba_bar_count_css' );
561
+ delete_option( 'ssba_bar_count_once' );
562
+ delete_option( 'ssba_widget_text' );
563
+ delete_option( 'ssba_rel_nofollow' );
564
+ delete_option( 'ssba_default_pinterest' );
565
+ delete_option( 'ssba_pinterest_featured' );
566
+ delete_option( 'ssba_content_priority' );
567
+ delete_option( 'ssba_plus_additional_css' );
568
+ delete_option( 'ssba_plus_custom_styles' );
569
+ delete_option( 'ssba_plus_custom_styles_enabled' );
570
+ delete_option( 'ssba_plus_email_message' );
571
+ delete_option( 'ssba_plus_buffer_text' );
572
+ delete_option( 'ssba_plus_twitter_text' );
573
+ delete_option( 'ssba_plus_flattr_user_id' );
574
+ delete_option( 'ssba_plus_flattr_url' );
575
+ delete_option( 'ssba_plus_share_new_window' );
576
+ delete_option( 'ssba_plus_link_to_ssb' );
577
+ delete_option( 'ssba_plus_show_share_count' );
578
+ delete_option( 'ssba_plus_share_count_style' );
579
+ delete_option( 'ssba_plus_share_count_css' );
580
+ delete_option( 'ssba_plus_share_count_once' );
581
+ delete_option( 'ssba_plus_widget_text' );
582
+ delete_option( 'ssba_plus_rel_nofollow' );
583
+ delete_option( 'ssba_plus_default_pinterest' );
584
+ delete_option( 'ssba_plus_pinterest_featured' );
585
+ delete_option( 'ssba_bar_additional_css' );
586
+ delete_option( 'ssba_bar_custom_styles' );
587
+ delete_option( 'ssba_bar_custom_styles_enabled' );
588
+ delete_option( 'ssba_bar_email_message' );
589
+ delete_option( 'ssba_bar_buffer_text' );
590
+ delete_option( 'ssba_bar_twitter_text' );
591
+ delete_option( 'ssba_bar_flattr_user_id' );
592
+ delete_option( 'ssba_bar_flattr_url' );
593
+ delete_option( 'ssba_bar_share_new_window' );
594
+ delete_option( 'ssba_bar_link_to_ssb' );
595
+ delete_option( 'ssba_bar_show_share_count' );
596
+ delete_option( 'ssba_bar_share_count_style' );
597
+ delete_option( 'ssba_bar_share_count_css' );
598
+ delete_option( 'ssba_bar_share_count_once' );
599
+ delete_option( 'ssba_bar_widget_text' );
600
+ delete_option( 'ssba_bar_rel_nofollow' );
601
+ delete_option( 'ssba_bar_default_pinterest' );
602
+ delete_option( 'ssba_bar_pinterest_featured' );
603
+
604
+ // Share container.
605
+ delete_option( 'ssba_div_padding' );
606
+ delete_option( 'ssba_div_rounded_corners' );
607
+ delete_option( 'ssba_border_width' );
608
+ delete_option( 'ssba_div_border' );
609
+ delete_option( 'ssba_div_background' );
610
+
611
+ // Share text.
612
+ delete_option( 'ssba_share_text' );
613
+ delete_option( 'ssba_text_placement' );
614
+ delete_option( 'ssba_font_family' );
615
+ delete_option( 'ssba_font_color' );
616
+ delete_option( 'ssba_font_size' );
617
+ delete_option( 'ssba_font_weight' );
618
+ delete_option( 'ssba_plus_share_text' );
619
+ delete_option( 'ssba_plus_text_placement' );
620
+ delete_option( 'ssba_plus_font_family' );
621
+ delete_option( 'ssba_plus_font_color' );
622
+ delete_option( 'ssba_plus_font_size' );
623
+ delete_option( 'ssba_plus_font_weight' );
624
+
625
+ // Include.
626
+ delete_option( 'ignore_facebook_sdk' );
627
+ delete_option( 'plus_ignore_facebook_sdk' );
628
+ delete_option( 'ssba_selected_buttons' );
629
+ delete_option( 'ssba_selected_share_buttons' );
630
+ delete_option( 'ssba_selected_plus_buttons' );
631
+ delete_option( 'ssba_bar_button_style' );
632
+ delete_option( 'ssba_bar_style' );
633
+ delete_option( 'ssba_new_buttons' );
634
+ delete_option( 'ssba_bar_position' );
635
+ delete_option( 'ssba_plus_height' );
636
+ delete_option( 'ssba_plus_width' );
637
+ delete_option( 'ssba_plus_margin' );
638
+ delete_option( 'ssba_plus_button_color' );
639
+ delete_option( 'ssba_plus_button_hover_color' );
640
+ delete_option( 'ssba_plus_icon_size' );
641
+ delete_option( 'ssba_plus_icon_color' );
642
+ delete_option( 'ssba_plus_icon_hover_color' );
643
+ delete_option( 'ssba_bar_height' );
644
+ delete_option( 'ssba_bar_width' );
645
+ delete_option( 'ssba_bar_margin' );
646
+ delete_option( 'ssba_bar_button_color' );
647
+ delete_option( 'ssba_bar_button_hover_color' );
648
+ delete_option( 'ssba_bar_icon_size' );
649
+ delete_option( 'ssba_bar_icon_color' );
650
+ delete_option( 'ssba_bar_icon_hover_color' );
651
+ delete_option( 'ssba_bar_desktop' );
652
+ delete_option( 'ssba_bar_mobile' );
653
+ delete_option( 'ssba_mobile_breakpoint' );
654
+
655
+ // Custom images.
656
+ delete_option( 'ssba_custom_email' );
657
+ delete_option( 'ssba_custom_google' );
658
+ delete_option( 'ssba_custom_facebook' );
659
+ delete_option( 'ssba_custom_twitter' );
660
+ delete_option( 'ssba_custom_diggit' );
661
+ delete_option( 'ssba_custom_linkedin' );
662
+ delete_option( 'ssba_custom_reddit' );
663
+ delete_option( 'ssba_custom_stumbleupon' );
664
+ delete_option( 'ssba_custom_pinterest' );
665
+ delete_option( 'ssba_custom_buffer' );
666
+ delete_option( 'ssba_custom_flattr' );
667
+ delete_option( 'ssba_custom_tumblr' );
668
+ delete_option( 'ssba_custom_print' );
669
+ delete_option( 'ssba_custom_vk' );
670
+ delete_option( 'ssba_custom_yummly' );
671
+
672
+ // Notice.
673
+ delete_option( 'ssba_dismiss_notice' );
674
+ }
675
+
676
+ /**
677
+ * Return old ssba settings (pre 6.0.6).
678
+ *
679
+ * @return array|null|object
680
+ */
681
+ public function get_old_ssba_settings() {
682
+ global $wp_registered_settings;
683
+
684
+ // Set variable.
685
+ $arr_settings = array();
686
+
687
+ foreach ( $wp_registered_settings as $name => $value ) {
688
+ if ( in_array( 'ssba', explode( '_', $name ), true ) ) {
689
+ $arr_settings[ $name ] = $value;
690
+ }
691
+ }
692
+
693
+ return $arr_settings;
694
+ }
 
 
 
 
 
 
 
 
 
 
 
 
695
  }
php/class-forms.php CHANGED
@@ -12,256 +12,254 @@ namespace SimpleShareButtonsAdder;
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
- class Forms
16
- {
17
-
18
- /**
19
- * Plugin instance.
20
- *
21
- * @var object
22
- */
23
- public $plugin;
24
-
25
- /**
26
- * Checkboxes.
27
- *
28
- * @var string
29
- */
30
- public $ssba_checkboxes;
31
-
32
- /**
33
- * Class constructor.
34
- *
35
- * @param object $plugin Plugin class.
36
- */
37
- public function __construct($plugin)
38
- {
39
- $this->plugin = $plugin;
40
- }
41
-
42
- /**
43
- * Opening form tag.
44
- *
45
- * @param string $wrap The wrap class.
46
- * @param string $action The action attribute.
47
- * @param string $class The class attribute.
48
- *
49
- * @return string
50
- */
51
- public function open($wrap, $action = '', $class = '')
52
- {
53
- $wrap = $wrap ? 'ssba-form-wrap' : '';
54
- $return = '<div class="' . esc_attr($wrap) . '">';
55
- $return .= '<form class="form-horizontal ' . esc_attr($class) . '" id="ssba-admin-form" method="post" action="' . esc_attr($action) . '">';
56
-
57
- // Required hidden fields.
58
- $return .= wp_nonce_field('ssba_save_settings', 'ssba_save_nonce');
59
- $return .= '<input type="hidden" name="ssba_options" />';
60
-
61
- // Open fieldset.
62
- $return .= '<fieldset>';
63
-
64
- return $return;
65
- }
66
-
67
- /**
68
- * Close form tag.
69
- *
70
- * @return string
71
- */
72
- public function close()
73
- {
74
- // Save button.
75
- $return = '<button id="submit" class="ssba-btn-save btn btn-lg btn-primary"><i class="fa fa-floppy-o"></i></button>';
76
-
77
- // Success button.
78
- $return .= '<button type="button" class="ssba-btn-save-success btn btn-lg btn-success"><i class="fa fa-check"></i></button>';
79
-
80
- // Close fieldset.
81
- $return .= '</fieldset>';
82
-
83
- // Close form.
84
- $return .= '</form>';
85
- $return .= '</div>';
86
-
87
- return $return;
88
- }
89
-
90
- /**
91
- * Inline checkboxes.
92
- *
93
- * @param array $opts The option array.
94
- *
95
- * @return string
96
- */
97
- public function ssbp_checkboxes($opts)
98
- {
99
- // Check if opts passed is an array.
100
- if (! is_array($opts)) {
101
- return 'Variable passed not an array';
102
- }
103
-
104
- // Define variable.
105
- $input = '';
106
-
107
- // If we're including the form group div.
108
- if ($opts['form_group']) {
109
- $input .= '<div class="form-group">';
110
- }
111
-
112
- // If a tooltip has been set.
113
- if (isset($opts['tooltip']) && '' !== $opts['tooltip']) {
114
- $tooltip = 'data-toggle="tooltip" data-placement="right" data-original-title="' . esc_attr($opts['tooltip']) . '"';
115
- } else {
116
- $tooltip = '';
117
- }
118
-
119
- // Label with tooltip.
120
- $input .= '<label class="control-label" ' . esc_attr($tooltip) . '>' . esc_html($opts['label']) . '</label>';
121
-
122
- // Input div.
123
- $input .= '<div class="">';
124
-
125
- // Add all checkboxes.
126
- foreach ($opts['checkboxes'] as $checkbox => $value) {
127
- $input .= $this->_ssbp_add_checkboxes($value, $checkbox);
128
- }
129
-
130
- // Close input div.
131
- $input .= '</div>';
132
-
133
- // If we're including the form group div.
134
- if ($opts['form_group']) {
135
- $input .= '</div>';
136
- }
137
-
138
- // Return the input.
139
- return $input;
140
- }
141
-
142
- /**
143
- * Checkboxes.
144
- *
145
- * @param array $value The checked prop.
146
- * @param string $key The label value.
147
- */
148
- public function _ssbp_add_checkboxes($value, $key)
149
- {
150
- $checked = isset($value['checked']) && $value['checked'] ? 'checked="checked"' : '';
151
-
152
- $ssba_checkboxes = '<label class="checkbox-inline no_indent">
153
- ' . esc_html($key) . '<br />
154
- <input type="checkbox" id="' . esc_attr($value['value']) . '" name="' . esc_attr($value['value']) . '" value="Y" ' . esc_attr($checked) . '>
155
  </label>';
156
 
157
- return $ssba_checkboxes;
158
- }
159
-
160
- /**
161
- * Form input with group.
162
- *
163
- * @param array $opts The option array.
164
- *
165
- * @return string
166
- */
167
- public function ssbp_input($opts)
168
- {
169
- // Check if opts passed is an array.
170
- if ( ! is_array($opts)) {
171
- return 'Variable passed not an array';
172
- }
173
-
174
- // Define variable.
175
- $input = '';
176
-
177
- // If we're including the form group div.
178
- if ($opts['form_group']) {
179
- $input .= '<div class="form-group">';
180
- }
181
-
182
- // If a tooltip has been set.
183
- if (isset($opts['tooltip']) && '' !== $opts['tooltip']) {
184
- $tooltip = 'data-toggle="tooltip" data-placement="right" data-original-title="' . esc_attr($opts['tooltip']) . '"';
185
- } else {
186
- $tooltip = '';
187
- }
188
-
189
- // Label with tooltip.
190
- $input .= '<label for="' . esc_attr($opts['name']) . '" class="control-label" ' . $tooltip . '>' . esc_html($opts['label']) . '</label>';
191
-
192
- // Input div.
193
- $input .= '<div class="input-div">';
194
- $disabled = isset($opts['disabled']) ? $opts['disabled'] : null;
195
-
196
- // Switch based on the input type.
197
- switch ($opts['type']) {
198
- case 'text':
199
- default:
200
- $input .= '<input class="form-control" name="' . esc_attr($opts['name']) . '" id="' . esc_attr($opts['name']) . '" type="text" value="' . esc_attr($opts['value']) . '" placeholder="' . esc_attr($opts['placeholder']) . '" ' . $disabled . ' />';
201
- break;
202
- case 'text_prefix':
203
- $input .= '<div class="input-group">
204
- <span class="input-group-addon">' . esc_html($opts['prefix']) . '</span>
205
- <input name="' . esc_attr($opts['name']) . '" id="' . esc_attr($opts['name']) . '" type="text" value="' . esc_attr($opts['value']) . '" class="form-control" placeholder="' . esc_attr($opts['placeholder']) . '">
206
  </div>';
207
- break;
208
- case 'error':
209
- $input .= '<p class="text-danger">' . esc_html($opts['error']) . '</p>';
210
- break;
211
- case 'number':
212
- $max = isset($opts['max']) ? 'max=' . $opts['max'] : '';
213
- $input .= '<input class="form-control" name="' . esc_attr($opts['name']) . '" id="' . esc_attr($opts['name']) . '" type="number" value="' . esc_attr($opts['value']) . '" placeholder="' . esc_attr($opts['placeholder']) . '"' . esc_attr($max) . ' />';
214
- break;
215
- case 'image_upload':
216
- $input .= '<div class="input-group">
217
- <input id="' . esc_attr($opts['name']) . '" name="' . esc_attr($opts['name']) . '" type="text" class="form-control" value="' . esc_attr($opts['value']) . '">
218
  <span class="input-group-btn">
219
- <button id="upload_' . esc_attr($opts['name']) . '_button" class="ssbpUpload ssbp_upload_btn btn btn-default" data-ssbp-input="' . esc_attr($opts['name']) . '" type="button">Upload</button>
220
  </span>
221
  </div>';
222
- break;
223
- case 'number_addon':
224
- $max = isset($opts['max']) ? 'max=' . $opts['max'] : '';
225
- $input .= '<div class="input-group">
226
- <input id="' . esc_attr($opts['name']) . '" name="' . esc_attr($opts['name']) . '" type="number" class="form-control" value="' . esc_attr($opts['value']) . '" placeholder="' . esc_attr($opts['placeholder']) . '"' . esc_attr($max) . ' />
227
- <span class="input-group-addon">' . esc_html($opts['addon']) . '</span>
228
  </div>';
229
- break;
230
- case 'colorpicker':
231
- $value = '' !== $opts['value'] ? $opts['value'] : '#eaeaea';
232
- $input .= '<input id="' . esc_attr($opts['name']) . '" name="' . esc_attr($opts['name']) . '" type="text" class="ssba-colorpicker form-control" value="' . esc_attr($opts['value']) . '" placeholder="#4582ec" style="border-color: ' . esc_attr($value) . '" />';
233
- break;
234
- case 'textarea':
235
- $class = isset($opts['class']) ? $opts['class'] : '';
236
- $input .= '<textarea class="form-control ' . esc_attr($class) . '" name="' . esc_attr($opts['name']) . '" id="' . esc_attr($opts['name']) . '" rows="' . esc_attr($opts['rows']) . '">' . esc_html($opts['value']) . '</textarea>';
237
- break;
238
- case 'checkbox':
239
- $class = isset($opts['class']) ? $opts['class'] : '';
240
- $disabled = isset($opts['disabled']) ? $opts['disabled'] : '';
241
- $input .= '<input class="' . esc_attr($class) . '" name="' . esc_attr($opts['name']) . '" id="' . esc_attr($opts['name']) . '" type="checkbox" ' . esc_attr($opts['checked']) . ' value="' . esc_attr($opts['value']) . '" ' . esc_attr($disabled) . ' />';
242
- break;
243
- case 'select':
244
- $input .= '<select class="form-control" name="' . esc_attr($opts['name']) . '" id="' . esc_attr($opts['name']) . '">';
245
-
246
- // Add all options.
247
- foreach ($opts['options'] as $key => $value) {
248
- $selected = (string)$value === $opts['selected'] ? 'selected=selected' : '';
249
- $input .= '<option value="' . esc_attr($value) . '" ' . esc_attr($selected) . '>' . esc_html($key) . '</option>';
250
- }
251
-
252
- $input .= '</select>';
253
- break;
254
- } // End switch().
255
-
256
- // Close input div.
257
- $input .= '</div>';
258
-
259
- // If we're including the form group div.
260
- if ($opts['form_group']) {
261
- $input .= '</div>';
262
- }
263
-
264
- // Return the input.
265
- return $input;
266
- }
267
  }
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
+ class Forms {
16
+
17
+ /**
18
+ * Plugin instance.
19
+ *
20
+ * @var object
21
+ */
22
+ public $plugin;
23
+
24
+ /**
25
+ * Checkboxes.
26
+ *
27
+ * @var string
28
+ */
29
+ public $ssba_checkboxes;
30
+
31
+ /**
32
+ * Class constructor.
33
+ *
34
+ * @param object $plugin Plugin class.
35
+ */
36
+ public function __construct( $plugin ) {
37
+ $this->plugin = $plugin;
38
+ }
39
+
40
+ /**
41
+ * Opening form tag.
42
+ *
43
+ * @param string $wrap The wrap class.
44
+ * @param string $action The action attribute.
45
+ * @param string $class The class attribute.
46
+ *
47
+ * @return string
48
+ */
49
+ public function open( $wrap, $action = '', $class = '' ) {
50
+ $wrap = $wrap ? 'ssba-form-wrap' : '';
51
+ $return = '<div class="' . esc_attr( $wrap ) . '">';
52
+ $return .= '<form class="form-horizontal ' . esc_attr( $class ) . '" id="ssba-admin-form" method="post" action="' . esc_attr( $action ) . '">';
53
+
54
+ // Required hidden fields.
55
+ $return .= wp_nonce_field( 'ssba_save_settings', 'ssba_save_nonce' );
56
+ $return .= '<input type="hidden" name="ssba_options" />';
57
+
58
+ // Open fieldset.
59
+ $return .= '<fieldset>';
60
+
61
+ return $return;
62
+ }
63
+
64
+ /**
65
+ * Close form tag.
66
+ *
67
+ * @return string
68
+ */
69
+ public function close() {
70
+ // Save button.
71
+ $return = '<button id="submit" class="ssba-btn-save btn btn-lg btn-primary"><i class="fa fa-floppy-o"></i></button>';
72
+
73
+ // Success button.
74
+ $return .= '<button type="button" class="ssba-btn-save-success btn btn-lg btn-success"><i class="fa fa-check"></i></button>';
75
+
76
+ // Close fieldset.
77
+ $return .= '</fieldset>';
78
+
79
+ // Close form.
80
+ $return .= '</form>';
81
+ $return .= '</div>';
82
+
83
+ return $return;
84
+ }
85
+
86
+ /**
87
+ * Inline checkboxes.
88
+ *
89
+ * @param array $opts The option array.
90
+ *
91
+ * @return string
92
+ */
93
+ public function ssbp_checkboxes( $opts ) {
94
+ // Check if opts passed is an array.
95
+ if ( ! is_array( $opts ) ) {
96
+ return 'Variable passed not an array';
97
+ }
98
+
99
+ // Define variable.
100
+ $input = '';
101
+
102
+ // If we're including the form group div.
103
+ if ( $opts['form_group'] ) {
104
+ $input .= '<div class="form-group">';
105
+ }
106
+
107
+ // If a tooltip has been set.
108
+ if ( isset( $opts['tooltip'] ) && '' !== $opts['tooltip'] ) {
109
+ $tooltip = 'data-toggle="tooltip" data-placement="right" data-original-title="' . esc_attr( $opts['tooltip'] ) . '"';
110
+ } else {
111
+ $tooltip = '';
112
+ }
113
+
114
+ // Label with tooltip.
115
+ $input .= '<label class="control-label" ' . esc_attr( $tooltip ) . '>' . esc_html( $opts['label'] ) . '</label>';
116
+
117
+ // Input div.
118
+ $input .= '<div class="">';
119
+
120
+ // Add all checkboxes.
121
+ foreach ( $opts['checkboxes'] as $checkbox => $value ) {
122
+ $input .= $this->ssbp_add_checkboxes( $value, $checkbox );
123
+ }
124
+
125
+ // Close input div.
126
+ $input .= '</div>';
127
+
128
+ // If we're including the form group div.
129
+ if ( $opts['form_group'] ) {
130
+ $input .= '</div>';
131
+ }
132
+
133
+ // Return the input.
134
+ return $input;
135
+ }
136
+
137
+ /**
138
+ * Checkboxes.
139
+ *
140
+ * @param array $value The checked prop.
141
+ * @param string $key The label value.
142
+ */
143
+ public function ssbp_add_checkboxes( $value, $key ) {
144
+ $checked = false === empty( $value['checked'] );
145
+
146
+ $ssba_checkboxes = '<label class="checkbox-inline no_indent"> '
147
+ . esc_html( $key )
148
+ . '<br /> <input type="checkbox" id="'
149
+ . esc_attr( $value['value'] )
150
+ . '" name="'
151
+ . esc_attr( $value['value'] )
152
+ . '" value="Y" '
153
+ . checked( $checked, true, false ) . '>
 
154
  </label>';
155
 
156
+ return $ssba_checkboxes;
157
+ }
158
+
159
+ /**
160
+ * Form input with group.
161
+ *
162
+ * @param array $opts The option array.
163
+ *
164
+ * @return string
165
+ */
166
+ public function ssbp_input( $opts ) {
167
+ // Check if opts passed is an array.
168
+ if ( ! is_array( $opts ) ) {
169
+ return 'Variable passed not an array';
170
+ }
171
+
172
+ // Define variable.
173
+ $input = '';
174
+
175
+ // If we're including the form group div.
176
+ if ( $opts['form_group'] ) {
177
+ $input .= '<div class="form-group">';
178
+ }
179
+
180
+ // If a tooltip has been set.
181
+ if ( isset( $opts['tooltip'] ) && '' !== $opts['tooltip'] ) {
182
+ $tooltip = 'data-toggle="tooltip" data-placement="right" data-original-title="' . esc_attr( $opts['tooltip'] ) . '"';
183
+ } else {
184
+ $tooltip = '';
185
+ }
186
+
187
+ // Label with tooltip.
188
+ $input .= '<label for="' . esc_attr( $opts['name'] ) . '" class="control-label" ' . $tooltip . '>' . esc_html( $opts['label'] ) . '</label>';
189
+
190
+ // Input div.
191
+ $input .= '<div class="input-div">';
192
+ $disabled = isset( $opts['disabled'] ) ? $opts['disabled'] : null;
193
+
194
+ // Switch based on the input type.
195
+ switch ( $opts['type'] ) {
196
+ case 'text':
197
+ default:
198
+ $input .= '<input class="form-control" name="' . esc_attr( $opts['name'] ) . '" id="' . esc_attr( $opts['name'] ) . '" type="text" value="' . esc_attr( $opts['value'] ) . '" placeholder="' . esc_attr( $opts['placeholder'] ) . '" ' . $disabled . ' />';
199
+ break;
200
+ case 'text_prefix':
201
+ $input .= '<div class="input-group">
202
+ <span class="input-group-addon">' . esc_html( $opts['prefix'] ) . '</span>
203
+ <input name="' . esc_attr( $opts['name'] ) . '" id="' . esc_attr( $opts['name'] ) . '" type="text" value="' . esc_attr( $opts['value'] ) . '" class="form-control" placeholder="' . esc_attr( $opts['placeholder'] ) . '">
 
204
  </div>';
205
+ break;
206
+ case 'error':
207
+ $input .= '<p class="text-danger">' . esc_html( $opts['error'] ) . '</p>';
208
+ break;
209
+ case 'number':
210
+ $max = isset( $opts['max'] ) ? 'max=' . $opts['max'] : '';
211
+ $input .= '<input class="form-control" name="' . esc_attr( $opts['name'] ) . '" id="' . esc_attr( $opts['name'] ) . '" type="number" value="' . esc_attr( $opts['value'] ) . '" placeholder="' . esc_attr( $opts['placeholder'] ) . '"' . esc_attr( $max ) . ' />';
212
+ break;
213
+ case 'image_upload':
214
+ $input .= '<div class="input-group">
215
+ <input id="' . esc_attr( $opts['name'] ) . '" name="' . esc_attr( $opts['name'] ) . '" type="text" class="form-control" value="' . esc_attr( $opts['value'] ) . '">
216
  <span class="input-group-btn">
217
+ <button id="upload_' . esc_attr( $opts['name'] ) . '_button" class="ssbpUpload ssbp_upload_btn btn btn-default" data-ssbp-input="' . esc_attr( $opts['name'] ) . '" type="button">Upload</button>
218
  </span>
219
  </div>';
220
+ break;
221
+ case 'number_addon':
222
+ $max = isset( $opts['max'] ) ? 'max=' . $opts['max'] : '';
223
+ $input .= '<div class="input-group">
224
+ <input id="' . esc_attr( $opts['name'] ) . '" name="' . esc_attr( $opts['name'] ) . '" type="number" class="form-control" value="' . esc_attr( $opts['value'] ) . '" placeholder="' . esc_attr( $opts['placeholder'] ) . '"' . esc_attr( $max ) . ' />
225
+ <span class="input-group-addon">' . esc_html( $opts['addon'] ) . '</span>
226
  </div>';
227
+ break;
228
+ case 'colorpicker':
229
+ $value = '' !== $opts['value'] ? $opts['value'] : '#eaeaea';
230
+ $input .= '<input id="' . esc_attr( $opts['name'] ) . '" name="' . esc_attr( $opts['name'] ) . '" type="text" class="ssba-colorpicker form-control" value="' . esc_attr( $opts['value'] ) . '" placeholder="#4582ec" style="border-color: ' . esc_attr( $value ) . '" />';
231
+ break;
232
+ case 'textarea':
233
+ $class = isset( $opts['class'] ) ? $opts['class'] : '';
234
+ $input .= '<textarea class="form-control ' . esc_attr( $class ) . '" name="' . esc_attr( $opts['name'] ) . '" id="' . esc_attr( $opts['name'] ) . '" rows="' . esc_attr( $opts['rows'] ) . '">' . esc_html( $opts['value'] ) . '</textarea>';
235
+ break;
236
+ case 'checkbox':
237
+ $class = isset( $opts['class'] ) ? $opts['class'] : '';
238
+ $disabled = isset( $opts['disabled'] ) ? $opts['disabled'] : '';
239
+ $input .= '<input class="' . esc_attr( $class ) . '" name="' . esc_attr( $opts['name'] ) . '" id="' . esc_attr( $opts['name'] ) . '" type="checkbox" ' . esc_attr( $opts['checked'] ) . ' value="' . esc_attr( $opts['value'] ) . '" ' . esc_attr( $disabled ) . ' />';
240
+ break;
241
+ case 'select':
242
+ $input .= '<select class="form-control" name="' . esc_attr( $opts['name'] ) . '" id="' . esc_attr( $opts['name'] ) . '">';
243
+
244
+ // Add all options.
245
+ foreach ( $opts['options'] as $key => $value ) {
246
+ $selected = (string) $value === $opts['selected'] ? 'selected=selected' : '';
247
+ $input .= '<option value="' . esc_attr( $value ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $key ) . '</option>';
248
+ }
249
+
250
+ $input .= '</select>';
251
+ break;
252
+ }
253
+
254
+ // Close input div.
255
+ $input .= '</div>';
256
+
257
+ // If we're including the form group div.
258
+ if ( $opts['form_group'] ) {
259
+ $input .= '</div>';
260
+ }
261
+
262
+ // Return the input.
263
+ return $input;
264
+ }
265
  }
php/class-plugin-base.php CHANGED
@@ -62,16 +62,16 @@ abstract class Plugin_Base {
62
  *
63
  * @var array
64
  */
65
- protected $_called_doc_hooks = array();
66
 
67
  /**
68
  * Plugin_Base constructor.
69
  */
70
  public function __construct() {
71
- $location = $this->locate_plugin();
72
- $this->slug = $location['dir_basename'];
73
  $this->dir_path = $location['dir_path'];
74
- $this->dir_url = $location['dir_url'];
75
 
76
  spl_autoload_register( array( $this, 'autoload' ) );
77
  $this->add_doc_hooks();
@@ -80,7 +80,7 @@ abstract class Plugin_Base {
80
  /**
81
  * Plugin_Base destructor.
82
  */
83
- function __destruct() {
84
  $this->remove_doc_hooks();
85
  }
86
 
@@ -145,9 +145,9 @@ abstract class Plugin_Base {
145
  * @return array
146
  */
147
  public function locate_plugin() {
148
- $base_file = str_replace( 'php', '', __FILE__ );
149
- $dir_url = trailingslashit( plugins_url( '', $base_file ) );
150
- $dir_path = substr( str_replace( 'class-plugin-base', '', $base_file ), 0, -2 );
151
  $dir_basename = basename( $dir_path );
152
 
153
  return compact( 'dir_url', 'dir_path', 'dir_basename' );
@@ -191,12 +191,15 @@ abstract class Plugin_Base {
191
  */
192
  public function add_filter( $name, $callback, $args = array() ) {
193
  // Merge defaults.
194
- $args = array_merge( array(
195
- 'priority' => 10,
196
- 'arg_count' => PHP_INT_MAX,
197
- ), $args );
198
-
199
- return $this->_add_hook( 'filter', $name, $callback, $args );
 
 
 
200
  }
201
 
202
  /**
@@ -208,7 +211,7 @@ abstract class Plugin_Base {
208
  * @return mixed
209
  */
210
  public function add_shortcode( $name, $callback ) {
211
- return $this->_add_hook( 'shortcode', $name, $callback );
212
  }
213
 
214
  /**
@@ -222,12 +225,15 @@ abstract class Plugin_Base {
222
  */
223
  public function add_action( $name, $callback, $args = array() ) {
224
  // Merge defaults.
225
- $args = array_merge( array(
226
- 'priority' => 10,
227
- 'arg_count' => PHP_INT_MAX,
228
- ), $args );
229
-
230
- return $this->_add_hook( 'action', $name, $callback, $args );
 
 
 
231
  }
232
 
233
  /**
@@ -240,11 +246,11 @@ abstract class Plugin_Base {
240
  *
241
  * @return mixed
242
  */
243
- protected function _add_hook( $type, $name, $callback, $args = array() ) {
244
- $priority = isset( $args['priority'] ) ? $args['priority'] : 10;
245
- $arg_count = isset( $args['arg_count'] ) ? $args['arg_count'] : PHP_INT_MAX;
246
- $fn = sprintf( '\add_%s', $type );
247
- $retval = \call_user_func( $fn, $name, $callback, $priority, $arg_count );
248
 
249
  return $retval;
250
  }
@@ -259,22 +265,22 @@ abstract class Plugin_Base {
259
  $object = $this;
260
  }
261
  $class_name = get_class( $object );
262
- if ( isset( $this->_called_doc_hooks[ $class_name ] ) ) {
263
  $notice = sprintf( 'The add_doc_hooks method was already called on %s. Note that the Plugin_Base constructor automatically calls this method.', $class_name );
264
  // @codingStandardsIgnoreStart
265
  trigger_error( esc_html( $notice ), \E_USER_NOTICE );
266
  // @codingStandardsIgnoreEnd
267
  return;
268
  }
269
- $this->_called_doc_hooks[ $class_name ] = true;
270
- $reflector = new \ReflectionObject( $object );
271
  foreach ( $reflector->getMethods() as $method ) {
272
- $doc = $method->getDocComment();
273
  $arg_count = $method->getNumberOfParameters();
274
  if ( preg_match_all( '#\* @(?P<type>filter|action|shortcode)\s+(?P<name>[a-z0-9\-\._]+)(?:,\s+(?P<priority>\d+))?#', $doc, $matches, PREG_SET_ORDER ) ) {
275
  foreach ( $matches as $match ) {
276
- $type = $match['type'];
277
- $name = $match['name'];
278
  $priority = empty( $match['priority'] ) ? 10 : intval( $match['priority'] );
279
  $callback = array( $object, $method->getName() );
280
  call_user_func( array( $this, "add_{$type}" ), $name, $callback, compact( 'priority', 'arg_count' ) );
@@ -293,19 +299,19 @@ abstract class Plugin_Base {
293
  $object = $this;
294
  }
295
  $class_name = get_class( $object );
296
- $reflector = new \ReflectionObject( $object );
297
  foreach ( $reflector->getMethods() as $method ) {
298
  $doc = $method->getDocComment();
299
  if ( preg_match_all( '#\* @(?P<type>filter|action|shortcode)\s+(?P<name>[a-z0-9\-\._]+)(?:,\s+(?P<priority>\d+))?#', $doc, $matches, PREG_SET_ORDER ) ) {
300
  foreach ( $matches as $match ) {
301
- $type = $match['type'];
302
- $name = $match['name'];
303
  $priority = empty( $match['priority'] ) ? 10 : intval( $match['priority'] );
304
  $callback = array( $object, $method->getName() );
305
  call_user_func( "remove_{$type}", $name, $callback, $priority );
306
  }
307
  }
308
  }
309
- unset( $this->_called_doc_hooks[ $class_name ] );
310
  }
311
  }
62
  *
63
  * @var array
64
  */
65
+ protected $called_doc_hooks = array();
66
 
67
  /**
68
  * Plugin_Base constructor.
69
  */
70
  public function __construct() {
71
+ $location = $this->locate_plugin();
72
+ $this->slug = $location['dir_basename'];
73
  $this->dir_path = $location['dir_path'];
74
+ $this->dir_url = $location['dir_url'];
75
 
76
  spl_autoload_register( array( $this, 'autoload' ) );
77
  $this->add_doc_hooks();
80
  /**
81
  * Plugin_Base destructor.
82
  */
83
+ public function __destruct() {
84
  $this->remove_doc_hooks();
85
  }
86
 
145
  * @return array
146
  */
147
  public function locate_plugin() {
148
+ $base_file = str_replace( 'php', '', __FILE__ );
149
+ $dir_url = trailingslashit( plugins_url( '', $base_file ) );
150
+ $dir_path = substr( str_replace( 'class-plugin-base', '', $base_file ), 0, -2 );
151
  $dir_basename = basename( $dir_path );
152
 
153
  return compact( 'dir_url', 'dir_path', 'dir_basename' );
191
  */
192
  public function add_filter( $name, $callback, $args = array() ) {
193
  // Merge defaults.
194
+ $args = array_merge(
195
+ array(
196
+ 'priority' => 10,
197
+ 'arg_count' => PHP_INT_MAX,
198
+ ),
199
+ $args
200
+ );
201
+
202
+ return $this->add_hook( 'filter', $name, $callback, $args );
203
  }
204
 
205
  /**
211
  * @return mixed
212
  */
213
  public function add_shortcode( $name, $callback ) {
214
+ return $this->add_hook( 'shortcode', $name, $callback );
215
  }
216
 
217
  /**
225
  */
226
  public function add_action( $name, $callback, $args = array() ) {
227
  // Merge defaults.
228
+ $args = array_merge(
229
+ array(
230
+ 'priority' => 10,
231
+ 'arg_count' => PHP_INT_MAX,
232
+ ),
233
+ $args
234
+ );
235
+
236
+ return $this->add_hook( 'action', $name, $callback, $args );
237
  }
238
 
239
  /**
246
  *
247
  * @return mixed
248
  */
249
+ protected function add_hook( $type, $name, $callback, $args = array() ) {
250
+ $priority = true === isset( $args['priority'] ) ? $args['priority'] : 10;
251
+ $arg_count = true === isset( $args['arg_count'] ) ? $args['arg_count'] : PHP_INT_MAX;
252
+ $fn = sprintf( '\add_%s', $type );
253
+ $retval = \call_user_func( $fn, $name, $callback, $priority, $arg_count );
254
 
255
  return $retval;
256
  }
265
  $object = $this;
266
  }
267
  $class_name = get_class( $object );
268
+ if ( isset( $this->called_doc_hooks[ $class_name ] ) ) {
269
  $notice = sprintf( 'The add_doc_hooks method was already called on %s. Note that the Plugin_Base constructor automatically calls this method.', $class_name );
270
  // @codingStandardsIgnoreStart
271
  trigger_error( esc_html( $notice ), \E_USER_NOTICE );
272
  // @codingStandardsIgnoreEnd
273
  return;
274
  }
275
+ $this->called_doc_hooks[ $class_name ] = true;
276
+ $reflector = new \ReflectionObject( $object );
277
  foreach ( $reflector->getMethods() as $method ) {
278
+ $doc = $method->getDocComment();
279
  $arg_count = $method->getNumberOfParameters();
280
  if ( preg_match_all( '#\* @(?P<type>filter|action|shortcode)\s+(?P<name>[a-z0-9\-\._]+)(?:,\s+(?P<priority>\d+))?#', $doc, $matches, PREG_SET_ORDER ) ) {
281
  foreach ( $matches as $match ) {
282
+ $type = $match['type'];
283
+ $name = $match['name'];
284
  $priority = empty( $match['priority'] ) ? 10 : intval( $match['priority'] );
285
  $callback = array( $object, $method->getName() );
286
  call_user_func( array( $this, "add_{$type}" ), $name, $callback, compact( 'priority', 'arg_count' ) );
299
  $object = $this;
300
  }
301
  $class_name = get_class( $object );
302
+ $reflector = new \ReflectionObject( $object );
303
  foreach ( $reflector->getMethods() as $method ) {
304
  $doc = $method->getDocComment();
305
  if ( preg_match_all( '#\* @(?P<type>filter|action|shortcode)\s+(?P<name>[a-z0-9\-\._]+)(?:,\s+(?P<priority>\d+))?#', $doc, $matches, PREG_SET_ORDER ) ) {
306
  foreach ( $matches as $match ) {
307
+ $type = $match['type'];
308
+ $name = $match['name'];
309
  $priority = empty( $match['priority'] ) ? 10 : intval( $match['priority'] );
310
  $callback = array( $object, $method->getName() );
311
  call_user_func( "remove_{$type}", $name, $callback, $priority );
312
  }
313
  }
314
  }
315
+ unset( $this->called_doc_hooks[ $class_name ] );
316
  }
317
  }
php/class-plugin.php CHANGED
@@ -10,93 +10,198 @@ namespace SimpleShareButtonsAdder;
10
  /**
11
  * Main plugin bootstrap file.
12
  */
13
- class Plugin extends Plugin_Base
14
- {
15
- /**
16
- * Plugin constructor.
17
- */
18
- public function __construct()
19
- {
20
- parent::__construct();
21
-
22
- // Define some prefixes to use througout the plugin.
23
- $this->assets_prefix = strtolower(preg_replace('/\B([A-Z])/', '-$1', __NAMESPACE__));
24
- $this->meta_prefix = strtolower(preg_replace('/\B([A-Z])/', '_$1', __NAMESPACE__));
25
-
26
- // Globals.
27
- $class_ssba = new Simple_Share_Buttons_Adder($this);
28
- $database = new Database($this, $class_ssba);
29
- $forms = new Forms($this);
30
- $widget_class = new Widget();
31
- $admin_panel = new Admin_Panel($this, $class_ssba, $forms, $widget_class);
32
-
33
- // Initiate classes.
34
- $classes = array(
35
- $class_ssba,
36
- $database,
37
- $admin_panel,
38
- $widget_class,
39
- $forms,
40
- new Styles($this, $class_ssba),
41
- new Admin_Bits($this, $class_ssba, $database, $admin_panel),
42
- new Buttons($this, $class_ssba, $admin_panel),
43
- );
44
-
45
- // Add classes doc hooks.
46
- foreach ($classes as $instance) {
47
- $this->add_doc_hooks($instance);
48
- }
49
-
50
- // Define some prefixes to use througout the plugin.
51
- $this->assets_prefix = strtolower(preg_replace('/\B([A-Z])/', '-$1', __NAMESPACE__));
52
- $this->meta_prefix = strtolower(preg_replace('/\B([A-Z])/', '_$1', __NAMESPACE__));
53
- }
54
-
55
- /**
56
- * Register assets.
57
- *
58
- * @action wp_enqueue_scripts
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
- /**
82
- * Register admin scripts/styles.
83
- *
84
- * @action admin_enqueue_scripts
85
- */
86
- public function register_admin_assets()
87
- {
88
- wp_register_script("{$this->assets_prefix}-admin", "{$this->dir_url}js/admin.js", array('jquery', 'jquery-ui-sortable', '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_register_style("{$this->assets_prefix}-admin", "{$this->dir_url}css/admin.css", false, time());
93
- wp_register_style("{$this->assets_prefix}-readable", "{$this->dir_url}css/readable.css");
94
- wp_register_style("{$this->assets_prefix}-colorpicker", "{$this->dir_url}css/colorpicker.css");
95
- wp_register_style("{$this->assets_prefix}-switch", "{$this->dir_url}css/switch.css");
96
- wp_register_style("{$this->assets_prefix}-admin-theme", "{$this->dir_url}css/admin-theme.css", "{$this->assets_prefix}-font-awesome", filemtime("{$this->dir_path}css/admin-theme.css"));
97
- wp_register_style("{$this->assets_prefix}-font-awesome", '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', false);
98
- wp_register_style("{$this->assets_prefix}-styles", "{$this->dir_url}css/style.css");
99
- wp_register_style("{$this->assets_prefix}-indie", '//fonts.googleapis.com/css?family=Indie+Flower');
100
- wp_register_style("{$this->assets_prefix}-reenie", '//fonts.googleapis.com/css?family=Reenie+Beanie');
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
10
  /**
11
  * Main plugin bootstrap file.
12
  */
13
+ class Plugin extends Plugin_Base {
14
+
15
+ /**
16
+ * Plugin constructor.
17
+ */
18
+ public function __construct() {
19
+ parent::__construct();
20
+
21
+ // Define some prefixes to use througout the plugin.
22
+ $this->assets_prefix = strtolower( preg_replace( '/\B([A-Z])/', '-$1', __NAMESPACE__ ) );
23
+ $this->meta_prefix = strtolower( preg_replace( '/\B([A-Z])/', '_$1', __NAMESPACE__ ) );
24
+
25
+ // Globals.
26
+ $class_ssba = new Simple_Share_Buttons_Adder( $this );
27
+ $database = new Database( $this, $class_ssba );
28
+ $forms = new Forms( $this );
29
+ $widget_class = new Widget();
30
+ $admin_panel = new Admin_Panel( $this, $class_ssba, $forms, $widget_class );
31
+
32
+ // Initiate classes.
33
+ $classes = array(
34
+ $class_ssba,
35
+ $database,
36
+ $admin_panel,
37
+ $widget_class,
38
+ $forms,
39
+ new Styles( $this, $class_ssba ),
40
+ new Admin_Bits( $this, $class_ssba, $database, $admin_panel ),
41
+ new Buttons( $this, $class_ssba, $admin_panel ),
42
+ );
43
+
44
+ // Add classes doc hooks.
45
+ foreach ( $classes as $instance ) {
46
+ $this->add_doc_hooks( $instance );
47
+ }
48
+
49
+ // Define some prefixes to use througout the plugin.
50
+ $this->assets_prefix = strtolower( preg_replace( '/\B([A-Z])/', '-$1', __NAMESPACE__ ) );
51
+ $this->meta_prefix = strtolower( preg_replace( '/\B([A-Z])/', '_$1', __NAMESPACE__ ) );
52
+ }
53
+
54
+ /**
55
+ * Register assets.
56
+ *
57
+ * @action wp_enqueue_scripts
58
+ */
59
+ public function register_assets() {
60
+ $propertyid = get_option( 'ssba_property_id' );
61
+
62
+ wp_register_script(
63
+ "{$this->assets_prefix}-ssba",
64
+ "{$this->dir_url}js/ssba.js",
65
+ array( 'jquery' ),
66
+ filemtime( "{$this->dir_path}js/ssba.js" ),
67
+ true
68
+ );
69
+
70
+ wp_register_style(
71
+ "{$this->assets_prefix}-indie",
72
+ '//fonts.googleapis.com/css?family=Indie+Flower',
73
+ array(),
74
+ SSBA_VERSION
75
+ );
76
+
77
+ wp_register_style(
78
+ "{$this->assets_prefix}-reenie",
79
+ '//fonts.googleapis.com/css?family=Reenie+Beanie',
80
+ array(),
81
+ SSBA_VERSION
82
+ );
83
+
84
+ wp_register_style(
85
+ "{$this->assets_prefix}-ssba",
86
+ "{$this->dir_url}css/ssba.css",
87
+ array(),
88
+ filemtime( "{$this->dir_path}css/ssba.css" )
89
+ );
90
+
91
+ wp_register_style(
92
+ "{$this->assets_prefix}-font-awesome",
93
+ '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css',
94
+ array(),
95
+ SSBA_VERSION
96
+ );
97
+
98
+ if ( false === empty( $propertyid ) ) {
99
+ wp_register_script(
100
+ "{$this->assets_prefix}-mu",
101
+ "//platform-api.sharethis.com/js/sharethis.js#property={$propertyid}&product=gdpr-compliance-tool-v2",
102
+ null,
103
+ SSBA_VERSION,
104
+ false
105
+ );
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Register admin scripts/styles.
111
+ *
112
+ * @action admin_enqueue_scripts
113
+ */
114
+ public function register_admin_assets() {
115
+ wp_register_script(
116
+ "{$this->assets_prefix}-admin",
117
+ "{$this->dir_url}js/admin.js",
118
+ array( 'jquery', 'jquery-ui-sortable', 'wp-util' ),
119
+ filemtime( "{$this->dir_path}js/admin.js" ),
120
+ false
121
+ );
122
+ wp_register_script(
123
+ "{$this->assets_prefix}-bootstrap-js",
124
+ "{$this->dir_url}js/vendor/bootstrap.js",
125
+ array(),
126
+ filemtime( "{$this->dir_path}js/vendor/bootstrap.js" ),
127
+ false
128
+ );
129
+ wp_register_script(
130
+ "{$this->assets_prefix}-colorpicker",
131
+ "{$this->dir_url}js/vendor/colorpicker.js",
132
+ array(),
133
+ filemtime( "{$this->dir_path}js/vendor/colorpicker.js" ),
134
+ false
135
+ );
136
+ wp_register_script(
137
+ "{$this->assets_prefix}-switch",
138
+ "{$this->dir_url}js/vendor/switch.js",
139
+ array(),
140
+ filemtime( "{$this->dir_path}js/vendor/switch.js" ),
141
+ false
142
+ );
143
+
144
+ wp_register_style(
145
+ "{$this->assets_prefix}-admin",
146
+ "{$this->dir_url}css/admin.css",
147
+ false,
148
+ time()
149
+ );
150
+
151
+ wp_register_style(
152
+ "{$this->assets_prefix}-readable",
153
+ "{$this->dir_url}css/readable.css",
154
+ array(),
155
+ filemtime( "{$this->dir_path}css/readable.css" )
156
+ );
157
+
158
+ wp_register_style(
159
+ "{$this->assets_prefix}-colorpicker",
160
+ "{$this->dir_url}css/colorpicker.css",
161
+ array(),
162
+ filemtime( "{$this->dir_path}css/colorpicker.css" )
163
+ );
164
+
165
+ wp_register_style(
166
+ "{$this->assets_prefix}-switch",
167
+ "{$this->dir_url}css/switch.css",
168
+ array(),
169
+ filemtime( "{$this->dir_path}css/switch.css" )
170
+ );
171
+
172
+ wp_register_style(
173
+ "{$this->assets_prefix}-admin-theme",
174
+ "{$this->dir_url}css/admin-theme.css",
175
+ "{$this->assets_prefix}-font-awesome",
176
+ filemtime( "{$this->dir_path}css/admin-theme.css" )
177
+ );
178
+
179
+ wp_register_style(
180
+ "{$this->assets_prefix}-font-awesome",
181
+ '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css',
182
+ array(),
183
+ SSBA_VERSION
184
+ );
185
+
186
+ wp_register_style(
187
+ "{$this->assets_prefix}-styles",
188
+ "{$this->dir_url}css/style.css",
189
+ array(),
190
+ filemtime( "{$this->dir_path}css/style.css" )
191
+ );
192
+
193
+ wp_register_style(
194
+ "{$this->assets_prefix}-indie",
195
+ '//fonts.googleapis.com/css?family=Indie+Flower',
196
+ array(),
197
+ SSBA_VERSION
198
+ );
199
+
200
+ wp_register_style(
201
+ "{$this->assets_prefix}-reenie",
202
+ '//fonts.googleapis.com/css?family=Reenie+Beanie',
203
+ array(),
204
+ SSBA_VERSION
205
+ );
206
+ }
207
  }
php/class-simple-share-buttons-adder.php CHANGED
@@ -12,112 +12,109 @@ namespace SimpleShareButtonsAdder;
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
- class Simple_Share_Buttons_Adder
16
- {
17
-
18
- /**
19
- * Plugin instance.
20
- *
21
- * @var object
22
- */
23
- public $plugin;
24
-
25
- /**
26
- * Class constructor.
27
- *
28
- * @param object $plugin Plugin class.
29
- */
30
- public function __construct($plugin)
31
- {
32
- $this->plugin = $plugin;
33
- }
34
-
35
- /**
36
- * Get the SSBA option settings.
37
- *
38
- * @action init
39
- * @return array
40
- */
41
- public function get_ssba_settings()
42
- {
43
- if (SSBA_VERSION < 8) {
44
- $this->convertSettings();
45
- }
46
-
47
- $ssba_settings = get_option('ssba_settings', true);
48
-
49
- // Decode and return settings.
50
- return $ssba_settings;
51
- }
52
-
53
- /**
54
- * Convert settings to non JSON if exist.
55
- */
56
- private function convertSettings()
57
- {
58
- // On update convert settings to non-json.
59
- // Only update if ssba_settings exist already.
60
- if (empty(get_option('convert_json_ssba_settings')) && ! empty(get_option('ssba_settings'))) {
61
- $convert_settings = json_decode(get_option('ssba_settings'), true);
62
-
63
- update_option('ssba_settings', $convert_settings);
64
- update_option('convert_json_ssba_settings', true);
65
- } elseif (empty(get_option('ssba_settings'))) {
66
- update_option('convert_json_ssba_settings', true);
67
- }
68
-
69
- // On update convert settings to non-json.
70
- // Only update if ssba_settings exist already.
71
- if (empty(get_option('convert_json_ssba_buttons')) && ! empty(get_option('ssba_buttons'))) {
72
- $convert_buttons = json_decode(get_option('ssba_buttons'), true);
73
-
74
- update_option('ssba_buttons', $convert_buttons);
75
- update_option('convert_json_ssba_buttons', true);
76
-
77
- wp_safe_redirect('/');
78
- } elseif (empty(get_option('ssba_buttons'))) {
79
- update_option('convert_json_ssba_buttons', true);
80
- }
81
- }
82
-
83
- /**
84
- * Update an array of options.
85
- *
86
- * @param array $arr_options The options array.
87
- */
88
- public function ssba_update_options($arr_options)
89
- {
90
- // If not given an array.
91
- if (! is_array($arr_options)) {
92
- return esc_html__('Value parsed not an array', 'simple-share-buttons-adder');
93
- }
94
-
95
- // Get ssba settings.
96
- $ssba_settings = get_option('ssba_settings', true);
97
-
98
- // Loop through array given.
99
- foreach ($arr_options as $name => $value) {
100
- // Update/add the option in the array.
101
- $ssba_settings[$name] = $value;
102
- }
103
-
104
- // Update the option in the db.
105
- update_option('ssba_settings', $ssba_settings);
106
- }
107
-
108
- /**
109
- * Add setting link to plugin page.
110
- *
111
- * @param $links
112
- *
113
- * @return mixed
114
- */
115
- public function add_action_links($links)
116
- {
117
- $mylinks = array(
118
- '<a href="' . admin_url('options-general.php?page=simple-share-buttons-adder') . '">Settings</a>',
119
- );
120
-
121
- return array_merge($links, $mylinks);
122
- }
123
  }
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
+ class Simple_Share_Buttons_Adder {
16
+
17
+
18
+ /**
19
+ * Plugin instance.
20
+ *
21
+ * @var object
22
+ */
23
+ public $plugin;
24
+
25
+ /**
26
+ * Class constructor.
27
+ *
28
+ * @param object $plugin Plugin class.
29
+ */
30
+ public function __construct( $plugin ) {
31
+ $this->plugin = $plugin;
32
+ }
33
+
34
+ /**
35
+ * Get the SSBA option settings.
36
+ *
37
+ * @action init
38
+ * @return array
39
+ */
40
+ public function get_ssba_settings() {
41
+ if ( SSBA_VERSION < 8 ) {
42
+ $this->convert_settings();
43
+ }
44
+
45
+ $ssba_settings = get_option( 'ssba_settings', true );
46
+
47
+ // Decode and return settings.
48
+ return $ssba_settings;
49
+ }
50
+
51
+ /**
52
+ * Convert settings to non JSON if they exist.
53
+ */
54
+ private function convert_settings() {
55
+ // On update convert settings to non-json.
56
+ // Only update if ssba_settings exist already.
57
+ if ( true === empty( get_option( 'convert_json_ssba_settings' ) )
58
+ && false === empty( get_option( 'ssba_settings' ) )
59
+ ) {
60
+ $convert_settings = json_decode( get_option( 'ssba_settings' ), true );
61
+
62
+ update_option( 'ssba_settings', $convert_settings );
63
+ update_option( 'convert_json_ssba_settings', true );
64
+ } elseif ( empty( get_option( 'ssba_settings' ) ) ) {
65
+ update_option( 'convert_json_ssba_settings', true );
66
+ }
67
+
68
+ // On update convert settings to non-json.
69
+ // Only update if ssba_settings exist already.
70
+ if ( empty( get_option( 'convert_json_ssba_buttons' ) ) && ! empty( get_option( 'ssba_buttons' ) ) ) {
71
+ $convert_buttons = json_decode( get_option( 'ssba_buttons' ), true );
72
+
73
+ update_option( 'ssba_buttons', $convert_buttons );
74
+ update_option( 'convert_json_ssba_buttons', true );
75
+
76
+ wp_safe_redirect( '/' );
77
+ } elseif ( empty( get_option( 'ssba_buttons' ) ) ) {
78
+ update_option( 'convert_json_ssba_buttons', true );
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Update an array of options.
84
+ *
85
+ * @param array $arr_options The options array.
86
+ */
87
+ public function ssba_update_options( $arr_options ) {
88
+ // If not given an array.
89
+ if ( false === is_array( $arr_options ) ) {
90
+ return esc_html__( 'Value parsed not an array', 'simple-share-buttons-adder' );
91
+ }
92
+
93
+ // Get ssba settings.
94
+ $ssba_settings = get_option( 'ssba_settings', true );
95
+
96
+ // Loop through array given.
97
+ foreach ( $arr_options as $name => $value ) {
98
+ // Update/add the option in the array.
99
+ $ssba_settings[ $name ] = $value;
100
+ }
101
+
102
+ // Update the option in the db.
103
+ update_option( 'ssba_settings', $ssba_settings );
104
+ }
105
+
106
+ /**
107
+ * Add setting link to plugin page.
108
+ *
109
+ * @param array $links Links array.
110
+ *
111
+ * @return array Modified links array.
112
+ */
113
+ public function add_action_links( $links ) {
114
+ $mylinks = array(
115
+ '<a href="' . admin_url( 'options-general.php?page=simple-share-buttons-adder' ) . '">Settings</a>',
116
+ );
117
+
118
+ return array_merge( $links, $mylinks );
119
+ }
 
 
 
120
  }
php/class-styles.php CHANGED
@@ -12,129 +12,132 @@ namespace SimpleShareButtonsAdder;
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
- class Styles
16
- {
17
- /**
18
- * Plugin instance.
19
- *
20
- * @var object
21
- */
22
- public $plugin;
23
-
24
- /**
25
- * Simple Share Buttons Adder instance.
26
- *
27
- * @var object
28
- */
29
- public $class_ssba;
30
-
31
- /**
32
- * Class constructor.
33
- *
34
- * @param object $plugin Plugin class.
35
- * @param object $class_ssba Simple Share Buttons Adder class.
36
- */
37
- public function __construct($plugin, $class_ssba)
38
- {
39
- $this->plugin = $plugin;
40
- $this->class_ssba = $class_ssba;
41
- }
42
-
43
- /**
44
- * Add css scripts for page/post use.
45
- *
46
- * @action wp_enqueue_scripts
47
- */
48
- public function ssba_page_scripts()
49
- {
50
- // Get settings.
51
- $arr_settings = $this->class_ssba->get_ssba_settings();
52
-
53
- if (is_ssl()) {
54
- $st_insights = 'https://ws.sharethis.com/button/st_insights.js';
55
- } else {
56
- $st_insights = 'http://w.sharethis.com/button/st_insights.js';
57
- }
58
-
59
- // Add call to st_insights.js with params.
60
- $url = add_query_arg(array(
61
- 'publisher' => '4d48b7c5-0ae3-43d4-bfbe-3ff8c17a8ae6',
62
- 'product' => 'simpleshare',
63
- ), $st_insights);
64
-
65
- if ('Y' === $arr_settings['accepted_sharethis_terms']) {
66
- wp_enqueue_script('ssba-sharethis', $url, null, null);
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 );',
79
- wp_json_encode(array())
80
- ));
81
-
82
- // If indie flower font is selected.
83
- if ('Indie Flower' === $arr_settings['ssba_font_family'] || 'Indie Flower' === $arr_settings['ssba_plus_font_family']) {
84
- // Font scripts.
85
- wp_enqueue_style("{$this->plugin->assets_prefix}-indie");
86
- }
87
-
88
- if ('Reenie Beanie' === $arr_settings['ssba_font_family'] || 'Reenie Beanie' === $arr_settings['ssba_plus_font_family']) {
89
- // Font scripts.
90
- wp_enqueue_style("{$this->plugin->assets_prefix}-reenie");
91
- }
92
- }
93
-
94
- /**
95
- * Adds ID to sharethis script.
96
- *
97
- * @param string $tag HTML script tag.
98
- * @param string $handle Script handle.
99
- *
100
- * @return string
101
- */
102
- public function ssba_script_tags($tag, $handle)
103
- {
104
- if ('ssba-sharethis' === $handle) {
105
- return str_replace('<script ', '<script id=\'st_insights_js\' ', $tag);
106
- }
107
-
108
- return $tag;
109
- }
 
 
 
 
110
 
111
  /**
112
  * Generate style.
113
  *
114
  * @action wp_enqueue_scripts
115
  */
116
- public function get_ssba_style()
117
- {
118
  // Query the db for current ssba settings.
119
  $arr_settings = $this->class_ssba->get_ssba_settings();
120
 
121
- $facebook_app_id = true === empty($arr_settings['plus_facebook_app_id']) ? $arr_settings['facebook_app_id'] : $arr_settings['plus_facebook_app_id'];
122
 
123
  // If the sharethis terms have been accepted.
124
- if ('Y' === $arr_settings['accepted_sharethis_terms'] && (('Y' !== $arr_settings['ssba_new_buttons'] && 'Y' !== $arr_settings['ignore_facebook_sdk']) || ('Y' === $arr_settings['ssba_new_buttons'] && 'Y' !== $arr_settings['plus_ignore_facebook_sdk']))) {
125
- // if a facebook app id has been set
126
- if (false === empty($facebook_app_id)) {
127
  $src = '//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6&appID=' . $facebook_app_id;
128
  } else {
129
  $src = '//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6';
130
  }
131
 
132
  // If an app id has been entered.
133
- if (false === empty($facebook_app_id)) {
134
  // Init facebook.
135
  echo "<script>window.fbAsyncInit = function() {
136
  FB.init({
137
- appId : '" . $facebook_app_id . "',
138
  xfbml : true,
139
  version : 'v2.6'
140
  });
@@ -146,43 +149,43 @@ class Styles
146
  var js, fjs = d.getElementsByTagName(s)[0];
147
  if (d.getElementById(id)) {return;}
148
  js = d.createElement(s); js.id = id;
149
- js.src = "' . $src . '";
150
  fjs.parentNode.insertBefore(js, fjs);
151
  }(document, \'script\', \'facebook-jssdk\'));</script>';
152
 
153
  // If an app id has been entered.
154
- if (false === empty($facebook_app_id)) {
155
  // If facebook insights have been enabled.
156
- if ('Y' === $arr_settings['facebook_insights']) {
157
  // Add facebook meta tag.
158
- echo '<meta property="fb:app_id" content="' . esc_attr($facebook_app_id) . '" />';
159
  }
160
  }
161
- } // End if().
162
-
163
- // Check if custom styles haven't been set.
164
- if ('Y' !== $arr_settings['ssba_custom_styles_enabled'] && 'Y' !== $arr_settings['ssba_new_buttons']) {
165
- $div_padding = '' !== $arr_settings['ssba_div_padding'] ? 'padding: ' . $arr_settings['ssba_div_padding'] . 'px;' : '';
166
- $border_width = '' !== $arr_settings['ssba_border_width'] ? 'border: ' . $arr_settings['ssba_border_width'] . 'px solid ' . $arr_settings['ssba_div_border'] . ';' : '';
167
- $div_background1 = '' !== $arr_settings['ssba_div_background'] ? 'background-color: ' . $arr_settings['ssba_div_background'] . ';' : '';
168
- $rounded = 'Y' === $arr_settings['ssba_div_rounded_corners'] ? '-moz-border-radius: 10px; -webkit-border-radius: 10px; -khtml-border-radius: 10px; border-radius: 10px; -o-border-radius: 10px;' : '';
169
- $div_background2 = '' === $arr_settings['ssba_div_background'] ? 'background: none;' : '';
170
- $font = '' !== $arr_settings['ssba_font_family'] ? 'font-family: ' . $arr_settings['ssba_font_family'] . ';' : '';
171
- $font_size = '' !== $arr_settings['ssba_font_size'] ? 'font-size: ' . $arr_settings['ssba_font_size'] . 'px;' : '';
172
- $font_color = '' !== $arr_settings['ssba_font_color'] ? 'color: ' . $arr_settings['ssba_font_color'] . '!important;' : '';
173
- $font_weight = '' !== $arr_settings['ssba_font_weight'] ? 'font-weight: ' . $arr_settings['ssba_font_weight'] . ';' : '';
174
-
175
- // Use set options.
176
- $html_ssba_style = ' .ssba {
177
- ' . esc_html($div_padding) . '
178
- ' . esc_html($border_width) . '
179
- ' . esc_html($div_background1) . '
180
- ' . esc_html($rounded) . '
181
  }
182
  .ssba img
183
  {
184
- width: ' . esc_html($arr_settings['ssba_size']) . 'px !important;
185
- padding: ' . esc_html($arr_settings['ssba_padding']) . 'px;
186
  border: 0;
187
  box-shadow: none !important;
188
  display: inline !important;
@@ -196,25 +199,25 @@ class Styles
196
 
197
  .ssba .fb-save
198
  {
199
- padding: ' . esc_html($arr_settings['ssba_padding']) . 'px;
200
  ';
201
 
202
- $html_ssba_style .= 'line-height: ' . esc_html((int)$arr_settings['ssba_size'] - 5) . 'px; }
203
  .ssba, .ssba a
204
  {
205
  text-decoration:none;
206
- ' . esc_html($div_background2) . '
207
- ' . esc_html($font) . '
208
- ' . esc_html($font_size) . '
209
- ' . esc_html($font_color) . '
210
- ' . esc_html($font_weight) . '
211
  }
212
  ';
213
 
214
- // If counters option is set to Y.
215
- if ('Y' === $arr_settings['ssba_show_share_count']) {
216
- // Styles that apply to all counter css sets.
217
- $html_ssba_style .= ' .ssba_sharecount:after, .ssba_sharecount:before {
218
  right: 100%;
219
  border: solid transparent;
220
  content: " ";
@@ -249,67 +252,67 @@ class Styles
249
  position: relative;
250
  border: 1px solid #e0dddd;';
251
 
252
- // If default counter style has been chosen.
253
- if ('default' === $arr_settings['ssba_share_count_style']) {
254
- // Style share count.
255
- $html_ssba_style .= 'color: #555e58;
256
  background: #f5f5f5;
257
  }
258
  .ssba_sharecount:after {
259
  border-right-color: #f5f5f5;
260
  }';
261
 
262
- } elseif ('white' === $arr_settings['ssba_share_count_style']) {
263
- // Show white style share counts.
264
- $html_ssba_style .= 'color: #555e58;
265
  background: #ffffff;
266
  }
267
  .ssba_sharecount:after {
268
  border-right-color: #ffffff;
269
  }';
270
 
271
- } elseif ('blue' === $arr_settings['ssba_share_count_style']) {
272
- // Show blue style share counts.
273
- $html_ssba_style .= 'color: #ffffff;
274
  background: #42a7e2;
275
  }
276
  .ssba_sharecount:after {
277
  border-right-color: #42a7e2;
278
  }';
279
- }
280
- }
281
-
282
- // If there's any additional css.
283
- if ('' !== $arr_settings['ssba_additional_css']) {
284
- // Add the additional CSS.
285
- $html_ssba_style .= $arr_settings['ssba_additional_css'];
286
- }
287
-
288
- wp_add_inline_style("{$this->plugin->assets_prefix}-ssba", $html_ssba_style); // WPCS: XSS ok.
289
- } elseif ('Y' !== $arr_settings['ssba_new_buttons']) { // Else use set options.
290
- // Use custom styles.
291
- $html_ssba_style = $arr_settings['ssba_custom_styles'];
292
-
293
- wp_add_inline_style("{$this->plugin->assets_prefix}-ssba", $html_ssba_style); // WPCS: XSS ok.
294
- }
295
-
296
- if ('Y' === $arr_settings['ssba_new_buttons']) {
297
- // Plus styles.
298
- $plus_height = '' !== $arr_settings['ssba_plus_height'] ? 'height: ' . $arr_settings['ssba_plus_height'] . 'px!important;' : 'height: 48px!important;';
299
- $plus_width = '' !== $arr_settings['ssba_plus_width'] ? 'width: ' . $arr_settings['ssba_plus_width'] . 'px!important;' : 'width: 48px!important;';
300
- $plus_icon = '' !== $arr_settings['ssba_plus_icon_size'] ? 'line-' . $plus_height . '; font-size: ' . $arr_settings['ssba_plus_icon_size'] . 'px;' : 'line-' . $plus_height . '; font-size: 18px;';
301
- $plus_margin = '' !== $arr_settings['ssba_plus_margin'] ? 'margin-left: ' . $arr_settings['ssba_plus_margin'] . 'px!important;' : 'margin-left: 7px!important;';
302
- $plus_font_style = '' !== $arr_settings['ssba_plus_font_family'] ? 'font-family: ' . $arr_settings['ssba_plus_font_family'] . ';' : 'font-family: inherit;';
303
- $plus_font_size = '' !== $arr_settings['ssba_plus_font_size'] ? 'font-size: ' . $arr_settings['ssba_plus_font_size'] . 'px;' : 'font-size: 12px;';
304
- $plus_font_weight = '' !== $arr_settings['ssba_plus_font_weight'] ? 'font-weight: ' . $arr_settings['ssba_plus_font_weight'] . ';' : 'font-weight: normal;';
305
- $plus_font_color = '' !== $arr_settings['ssba_plus_font_color'] ? 'color: ' . $arr_settings['ssba_plus_font_color'] . '!important;' : '';
306
- $plus_icon_color = '' !== $arr_settings['ssba_plus_icon_color'] ? 'color: ' . $arr_settings['ssba_plus_icon_color'] . '!important;' : '';
307
- $plus_icon_hover = '' !== $arr_settings['ssba_plus_icon_hover_color'] ? 'color: ' . $arr_settings['ssba_plus_icon_hover_color'] . '!important;' : '';
308
- $plus_button_color = '' !== $arr_settings['ssba_plus_button_color'] ? 'background-color: ' . $arr_settings['ssba_plus_button_color'] . '!important;' : '';
309
- $plus_button_hover = '' !== $arr_settings['ssba_plus_button_hover_color'] ? 'background-color: ' . $arr_settings['ssba_plus_button_hover_color'] . '!important;' : '';
310
-
311
- $html_ssba_style =
312
- '.ssba img
313
  {border: 0;
314
  box-shadow: none !important;
315
  display: inline !important;
@@ -321,91 +324,91 @@ class Styles
321
  display: none!important;
322
  }
323
  .ssbp-list li a {' .
324
- esc_html($plus_height) . ' ' .
325
- esc_html($plus_width) . ' ' .
326
- esc_html($plus_button_color) . '
327
  }
328
  .ssbp-list li a:hover {' .
329
- esc_html($plus_button_hover) . '
330
  }
331
 
332
  .ssbp-list li a::before {' .
333
- esc_html($plus_icon) .
334
- esc_html($plus_icon_color) .
335
- '}
336
  .ssbp-list li a:hover::before {' .
337
- esc_html($plus_icon_hover) .
338
- '}
339
  .ssbp-list li {
340
- ' . esc_html($plus_margin) . '
341
  }
342
 
343
  .ssba-share-text {
344
- ' . esc_html($plus_font_size) . ' '
345
- . esc_html($plus_font_color) . ' '
346
- . esc_html($plus_font_weight) . ' '
347
- . esc_html($plus_font_style) . '
348
  }';
349
 
350
- if ('' !== $arr_settings['ssba_plus_additional_css'] && 'Y' === $arr_settings['ssba_new_buttons']) {
351
- $html_ssba_style .= $arr_settings['ssba_plus_additional_css'];
352
- }
353
-
354
- wp_add_inline_style("{$this->plugin->assets_prefix}-ssba", $html_ssba_style); // WPCS: XSS ok.
355
- }
356
-
357
- // If sharebar custom css is enabled use it.
358
- // Check if custom styles haven't been set.
359
- if ('Y' !== $arr_settings['ssba_bar_custom_styles_enabled']) {
360
- // Share bar styles.
361
- $bar_height = '' !== $arr_settings['ssba_bar_height'] ? 'height: ' . $arr_settings['ssba_bar_height'] . 'px!important;' : 'height: 48px!important;';
362
- $bar_width = '' !== $arr_settings['ssba_bar_width'] ? 'width: ' . $arr_settings['ssba_bar_width'] . 'px!important;' : 'width: 48px!important;';
363
- $bar_icon = '' !== $arr_settings['ssba_bar_icon_size'] ? 'line-' . $bar_height . '; font-size: ' . $arr_settings['ssba_bar_icon_size'] . 'px;' : 'line-' . $bar_height . '; font-size: 18px;';
364
- $bar_margin = '' !== $arr_settings['ssba_bar_margin'] ? 'margin: ' . $arr_settings['ssba_bar_margin'] . 'px 0!important;' : '';
365
- $bar_button_color = '' !== $arr_settings['ssba_bar_button_color'] ? 'background-color: ' . $arr_settings['ssba_bar_button_color'] . '!important;' : '';
366
- $bar_button_hover = '' !== $arr_settings['ssba_bar_button_hover_color'] ? 'background-color: ' . $arr_settings['ssba_bar_button_hover_color'] . '!important;' : '';
367
- $bar_icon_color = '' !== $arr_settings['ssba_bar_icon_color'] ? 'color: ' . $arr_settings['ssba_bar_icon_color'] . '!important;' : '';
368
- $bar_icon_hover = '' !== $arr_settings['ssba_bar_icon_hover_color'] ? 'color: ' . $arr_settings['ssba_bar_icon_hover_color'] . '!important;' : '';
369
- $bar_break_point = 'Y' !== $arr_settings['ssba_bar_mobile'] ? 'display: none;' : 'display: block;';
370
- $the_breakpoint = '' === $arr_settings['ssba_mobile_breakpoint'] || null === $arr_settings['ssba_mobile_breakpoint'] ? '750' : $arr_settings['ssba_mobile_breakpoint'];
371
-
372
- $html_bar_ssba_style = '
373
  #ssba-bar-2 .ssbp-bar-list {
374
- max-' . esc_html($bar_width) . ';
375
  }
376
  #ssba-bar-2 .ssbp-bar-list li a {' .
377
- esc_html($bar_height) . ' ' .
378
- esc_html($bar_width) . ' ' .
379
- esc_html($bar_button_color) . '
380
  }
381
  #ssba-bar-2 .ssbp-bar-list li a:hover {' .
382
- esc_html($bar_button_hover) . '
383
  }
384
 
385
  #ssba-bar-2 .ssbp-bar-list li a::before {' .
386
- esc_html($bar_icon) .
387
- esc_html($bar_icon_color) .
388
- '}
389
  #ssba-bar-2 .ssbp-bar-list li a:hover::before {' .
390
- esc_html($bar_icon_hover) .
391
- '}
392
  #ssba-bar-2 .ssbp-bar-list li {
393
- ' . esc_html($bar_margin) . '
394
  }';
395
 
396
- $html_bar_ssba_style .= '@media only screen and ( max-width: ' . $the_breakpoint . 'px ) {
397
  #ssba-bar-2 {
398
  ' . $bar_break_point . '
399
  }
400
  }';
401
 
402
- // If there's any additional css.
403
- if ('' !== $arr_settings['ssba_bar_additional_css']) {
404
- // Add the additional CSS.
405
- $html_bar_ssba_style .= $arr_settings['ssba_bar_additional_css'];
406
- }
407
 
408
- wp_add_inline_style("{$this->plugin->assets_prefix}-ssba", $html_bar_ssba_style); // WPCS: XSS ok.
409
- }
410
- }
411
  }
12
  *
13
  * @package SimpleShareButtonsAdder
14
  */
15
+ class Styles {
16
+
17
+ /**
18
+ * Plugin instance.
19
+ *
20
+ * @var object
21
+ */
22
+ public $plugin;
23
+
24
+ /**
25
+ * Simple Share Buttons Adder instance.
26
+ *
27
+ * @var object
28
+ */
29
+ public $class_ssba;
30
+
31
+ /**
32
+ * Class constructor.
33
+ *
34
+ * @param object $plugin Plugin class.
35
+ * @param object $class_ssba Simple Share Buttons Adder class.
36
+ */
37
+ public function __construct( $plugin, $class_ssba ) {
38
+ $this->plugin = $plugin;
39
+ $this->class_ssba = $class_ssba;
40
+ }
41
+
42
+ /**
43
+ * Add css scripts for page/post use.
44
+ *
45
+ * @action wp_enqueue_scripts
46
+ */
47
+ public function ssba_page_scripts() {
48
+ // Get settings.
49
+ $arr_settings = $this->class_ssba->get_ssba_settings();
50
+
51
+ if ( is_ssl() ) {
52
+ $st_insights = 'https://ws.sharethis.com/button/st_insights.js';
53
+ } else {
54
+ $st_insights = 'http://w.sharethis.com/button/st_insights.js';
55
+ }
56
+
57
+ // Add call to st_insights.js with params.
58
+ $url = add_query_arg(
59
+ array(
60
+ 'publisher' => '4d48b7c5-0ae3-43d4-bfbe-3ff8c17a8ae6',
61
+ 'product' => 'simpleshare',
62
+ ),
63
+ $st_insights
64
+ );
65
+
66
+ if ( 'Y' === $arr_settings['accepted_sharethis_terms'] ) {
67
+ wp_enqueue_script( 'ssba-sharethis', $url, null, SSBA_VERSION, false );
68
+ add_filter( 'script_loader_tag', array( $this, 'ssba_script_tags' ), 10, 2 );
69
+ }
70
+
71
+ // Enqueue ST script for ST products.
72
+ if ( false === empty( get_option( 'ssba_property_id' ) ) ) {
73
+ wp_dequeue_script( 'ssba-sharethis' );
74
+ wp_enqueue_script( "{$this->plugin->assets_prefix}-mu" );
75
+ }
76
+
77
+ // Enqueue main script.
78
+ wp_enqueue_script( "{$this->plugin->assets_prefix}-ssba" );
79
+ wp_add_inline_script(
80
+ "{$this->plugin->assets_prefix}-ssba",
81
+ sprintf(
82
+ 'Main.boot( %s );',
83
+ wp_json_encode( array() )
84
+ )
85
+ );
86
+
87
+ // If indie flower font is selected.
88
+ if ( 'Indie Flower' === $arr_settings['ssba_font_family'] || 'Indie Flower' === $arr_settings['ssba_plus_font_family'] ) {
89
+ // Font scripts.
90
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-indie" );
91
+ }
92
+
93
+ if ( 'Reenie Beanie' === $arr_settings['ssba_font_family'] || 'Reenie Beanie' === $arr_settings['ssba_plus_font_family'] ) {
94
+ // Font scripts.
95
+ wp_enqueue_style( "{$this->plugin->assets_prefix}-reenie" );
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Adds ID to sharethis script.
101
+ *
102
+ * @param string $tag HTML script tag.
103
+ * @param string $handle Script handle.
104
+ *
105
+ * @return string
106
+ */
107
+ public function ssba_script_tags( $tag, $handle ) {
108
+ if ( 'ssba-sharethis' === $handle ) {
109
+ return str_replace( '<script ', '<script id=\'st_insights_js\' ', $tag );
110
+ }
111
+
112
+ return $tag;
113
+ }
114
 
115
  /**
116
  * Generate style.
117
  *
118
  * @action wp_enqueue_scripts
119
  */
120
+ public function get_ssba_style() {
 
121
  // Query the db for current ssba settings.
122
  $arr_settings = $this->class_ssba->get_ssba_settings();
123
 
124
+ $facebook_app_id = true === empty( $arr_settings['plus_facebook_app_id'] ) ? $arr_settings['facebook_app_id'] : $arr_settings['plus_facebook_app_id'];
125
 
126
  // If the sharethis terms have been accepted.
127
+ if ( 'Y' === $arr_settings['accepted_sharethis_terms'] && ( ( 'Y' !== $arr_settings['ssba_new_buttons'] && 'Y' !== $arr_settings['ignore_facebook_sdk'] ) || ( 'Y' === $arr_settings['ssba_new_buttons'] && 'Y' !== $arr_settings['plus_ignore_facebook_sdk'] ) ) ) {
128
+ // If a facebook app id has been set.
129
+ if ( false === empty( $facebook_app_id ) ) {
130
  $src = '//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6&appID=' . $facebook_app_id;
131
  } else {
132
  $src = '//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6';
133
  }
134
 
135
  // If an app id has been entered.
136
+ if ( false === empty( $facebook_app_id ) ) {
137
  // Init facebook.
138
  echo "<script>window.fbAsyncInit = function() {
139
  FB.init({
140
+ appId : '" . esc_js( $facebook_app_id ) . "',
141
  xfbml : true,
142
  version : 'v2.6'
143
  });
149
  var js, fjs = d.getElementsByTagName(s)[0];
150
  if (d.getElementById(id)) {return;}
151
  js = d.createElement(s); js.id = id;
152
+ js.src = "' . esc_js( $src ) . '";
153
  fjs.parentNode.insertBefore(js, fjs);
154
  }(document, \'script\', \'facebook-jssdk\'));</script>';
155
 
156
  // If an app id has been entered.
157
+ if ( false === empty( $facebook_app_id ) ) {
158
  // If facebook insights have been enabled.
159
+ if ( 'Y' === $arr_settings['facebook_insights'] ) {
160
  // Add facebook meta tag.
161
+ echo '<meta property="fb:app_id" content="' . esc_attr( $facebook_app_id ) . '" />';
162
  }
163
  }
164
+ }
165
+
166
+ // Check if custom styles haven't been set.
167
+ if ( 'Y' !== $arr_settings['ssba_custom_styles_enabled'] && 'Y' !== $arr_settings['ssba_new_buttons'] ) {
168
+ $div_padding = '' !== $arr_settings['ssba_div_padding'] ? 'padding: ' . $arr_settings['ssba_div_padding'] . 'px;' : '';
169
+ $border_width = '' !== $arr_settings['ssba_border_width'] ? 'border: ' . $arr_settings['ssba_border_width'] . 'px solid ' . $arr_settings['ssba_div_border'] . ';' : '';
170
+ $div_background1 = '' !== $arr_settings['ssba_div_background'] ? 'background-color: ' . $arr_settings['ssba_div_background'] . ';' : '';
171
+ $rounded = 'Y' === $arr_settings['ssba_div_rounded_corners'] ? '-moz-border-radius: 10px; -webkit-border-radius: 10px; -khtml-border-radius: 10px; border-radius: 10px; -o-border-radius: 10px;' : '';
172
+ $div_background2 = '' === $arr_settings['ssba_div_background'] ? 'background: none;' : '';
173
+ $font = '' !== $arr_settings['ssba_font_family'] ? 'font-family: ' . $arr_settings['ssba_font_family'] . ';' : '';
174
+ $font_size = '' !== $arr_settings['ssba_font_size'] ? 'font-size: ' . $arr_settings['ssba_font_size'] . 'px;' : '';
175
+ $font_color = '' !== $arr_settings['ssba_font_color'] ? 'color: ' . $arr_settings['ssba_font_color'] . '!important;' : '';
176
+ $font_weight = '' !== $arr_settings['ssba_font_weight'] ? 'font-weight: ' . $arr_settings['ssba_font_weight'] . ';' : '';
177
+
178
+ // Use set options.
179
+ $html_ssba_style = ' .ssba {
180
+ ' . esc_html( $div_padding ) . '
181
+ ' . esc_html( $border_width ) . '
182
+ ' . esc_html( $div_background1 ) . '
183
+ ' . esc_html( $rounded ) . '
184
  }
185
  .ssba img
186
  {
187
+ width: ' . esc_html( $arr_settings['ssba_size'] ) . 'px !important;
188
+ padding: ' . esc_html( $arr_settings['ssba_padding'] ) . 'px;
189
  border: 0;
190
  box-shadow: none !important;
191
  display: inline !important;
199
 
200
  .ssba .fb-save
201
  {
202
+ padding: ' . esc_html( $arr_settings['ssba_padding'] ) . 'px;
203
  ';
204
 
205
+ $html_ssba_style .= 'line-height: ' . esc_html( (int) $arr_settings['ssba_size'] - 5 ) . 'px; }
206
  .ssba, .ssba a
207
  {
208
  text-decoration:none;
209
+ ' . esc_html( $div_background2 ) . '
210
+ ' . esc_html( $font ) . '
211
+ ' . esc_html( $font_size ) . '
212
+ ' . esc_html( $font_color ) . '
213
+ ' . esc_html( $font_weight ) . '
214
  }
215
  ';
216
 
217
+ // If counters option is set to Y.
218
+ if ( 'Y' === $arr_settings['ssba_show_share_count'] ) {
219
+ // Styles that apply to all counter css sets.
220
+ $html_ssba_style .= ' .ssba_sharecount:after, .ssba_sharecount:before {
221
  right: 100%;
222
  border: solid transparent;
223
  content: " ";
252
  position: relative;
253
  border: 1px solid #e0dddd;';
254
 
255
+ // If default counter style has been chosen.
256
+ if ( 'default' === $arr_settings['ssba_share_count_style'] ) {
257
+ // Style share count.
258
+ $html_ssba_style .= 'color: #555e58;
259
  background: #f5f5f5;
260
  }
261
  .ssba_sharecount:after {
262
  border-right-color: #f5f5f5;
263
  }';
264
 
265
+ } elseif ( 'white' === $arr_settings['ssba_share_count_style'] ) {
266
+ // Show white style share counts.
267
+ $html_ssba_style .= 'color: #555e58;
268
  background: #ffffff;
269
  }
270
  .ssba_sharecount:after {
271
  border-right-color: #ffffff;
272
  }';
273
 
274
+ } elseif ( 'blue' === $arr_settings['ssba_share_count_style'] ) {
275
+ // Show blue style share counts.
276
+ $html_ssba_style .= 'color: #ffffff;
277
  background: #42a7e2;
278
  }
279
  .ssba_sharecount:after {
280
  border-right-color: #42a7e2;
281
  }';
282
+ }
283
+ }
284
+
285
+ // If there's any additional css.
286
+ if ( '' !== $arr_settings['ssba_additional_css'] ) {
287
+ // Add the additional CSS.
288
+ $html_ssba_style .= $arr_settings['ssba_additional_css'];
289
+ }
290
+
291
+ wp_add_inline_style( "{$this->plugin->assets_prefix}-ssba", $html_ssba_style ); // WPCS: XSS ok.
292
+ } elseif ( 'Y' !== $arr_settings['ssba_new_buttons'] ) { // Else use set options.
293
+ // Use custom styles.
294
+ $html_ssba_style = $arr_settings['ssba_custom_styles'];
295
+
296
+ wp_add_inline_style( "{$this->plugin->assets_prefix}-ssba", $html_ssba_style ); // WPCS: XSS ok.
297
+ }
298
+
299
+ if ( 'Y' === $arr_settings['ssba_new_buttons'] ) {
300
+ // Plus styles.
301
+ $plus_height = '' !== $arr_settings['ssba_plus_height'] ? 'height: ' . $arr_settings['ssba_plus_height'] . 'px!important;' : 'height: 48px!important;';
302
+ $plus_width = '' !== $arr_settings['ssba_plus_width'] ? 'width: ' . $arr_settings['ssba_plus_width'] . 'px!important;' : 'width: 48px!important;';
303
+ $plus_icon = '' !== $arr_settings['ssba_plus_icon_size'] ? 'line-' . $plus_height . '; font-size: ' . $arr_settings['ssba_plus_icon_size'] . 'px;' : 'line-' . $plus_height . '; font-size: 18px;';
304
+ $plus_margin = '' !== $arr_settings['ssba_plus_margin'] ? 'margin-left: ' . $arr_settings['ssba_plus_margin'] . 'px!important;' : 'margin-left: 7px!important;';
305
+ $plus_font_style = '' !== $arr_settings['ssba_plus_font_family'] ? 'font-family: ' . $arr_settings['ssba_plus_font_family'] . ';' : 'font-family: inherit;';
306
+ $plus_font_size = '' !== $arr_settings['ssba_plus_font_size'] ? 'font-size: ' . $arr_settings['ssba_plus_font_size'] . 'px;' : 'font-size: 12px;';
307
+ $plus_font_weight = '' !== $arr_settings['ssba_plus_font_weight'] ? 'font-weight: ' . $arr_settings['ssba_plus_font_weight'] . ';' : 'font-weight: normal;';
308
+ $plus_font_color = '' !== $arr_settings['ssba_plus_font_color'] ? 'color: ' . $arr_settings['ssba_plus_font_color'] . '!important;' : '';
309
+ $plus_icon_color = '' !== $arr_settings['ssba_plus_icon_color'] ? 'color: ' . $arr_settings['ssba_plus_icon_color'] . '!important;' : '';
310
+ $plus_icon_hover = '' !== $arr_settings['ssba_plus_icon_hover_color'] ? 'color: ' . $arr_settings['ssba_plus_icon_hover_color'] . '!important;' : '';
311
+ $plus_button_color = '' !== $arr_settings['ssba_plus_button_color'] ? 'background-color: ' . $arr_settings['ssba_plus_button_color'] . '!important;' : '';
312
+ $plus_button_hover = '' !== $arr_settings['ssba_plus_button_hover_color'] ? 'background-color: ' . $arr_settings['ssba_plus_button_hover_color'] . '!important;' : '';
313
+
314
+ $html_ssba_style =
315
+ '.ssba img
316
  {border: 0;
317
  box-shadow: none !important;
318
  display: inline !important;
324
  display: none!important;
325
  }
326
  .ssbp-list li a {' .
327
+ esc_html( $plus_height ) . ' ' .
328
+ esc_html( $plus_width ) . ' ' .
329
+ esc_html( $plus_button_color ) . '
330
  }
331
  .ssbp-list li a:hover {' .
332
+ esc_html( $plus_button_hover ) . '
333
  }
334
 
335
  .ssbp-list li a::before {' .
336
+ esc_html( $plus_icon ) .
337
+ esc_html( $plus_icon_color ) .
338
+ '}
339
  .ssbp-list li a:hover::before {' .
340
+ esc_html( $plus_icon_hover ) .
341
+ '}
342
  .ssbp-list li {
343
+ ' . esc_html( $plus_margin ) . '
344
  }
345
 
346
  .ssba-share-text {
347
+ ' . esc_html( $plus_font_size ) . ' '
348
+ . esc_html( $plus_font_color ) . ' '
349
+ . esc_html( $plus_font_weight ) . ' '
350
+ . esc_html( $plus_font_style ) . '
351
  }';
352
 
353
+ if ( '' !== $arr_settings['ssba_plus_additional_css'] && 'Y' === $arr_settings['ssba_new_buttons'] ) {
354
+ $html_ssba_style .= $arr_settings['ssba_plus_additional_css'];
355
+ }
356
+
357
+ wp_add_inline_style( "{$this->plugin->assets_prefix}-ssba", $html_ssba_style ); // WPCS: XSS ok.
358
+ }
359
+
360
+ // If sharebar custom css is enabled use it.
361
+ // Check if custom styles haven't been set.
362
+ if ( 'Y' !== $arr_settings['ssba_bar_custom_styles_enabled'] ) {
363
+ // Share bar styles.
364
+ $bar_height = '' !== $arr_settings['ssba_bar_height'] ? 'height: ' . $arr_settings['ssba_bar_height'] . 'px!important;' : 'height: 48px!important;';
365
+ $bar_width = '' !== $arr_settings['ssba_bar_width'] ? 'width: ' . $arr_settings['ssba_bar_width'] . 'px!important;' : 'width: 48px!important;';
366
+ $bar_icon = '' !== $arr_settings['ssba_bar_icon_size'] ? 'line-' . $bar_height . '; font-size: ' . $arr_settings['ssba_bar_icon_size'] . 'px;' : 'line-' . $bar_height . '; font-size: 18px;';
367
+ $bar_margin = '' !== $arr_settings['ssba_bar_margin'] ? 'margin: ' . $arr_settings['ssba_bar_margin'] . 'px 0!important;' : '';
368
+ $bar_button_color = '' !== $arr_settings['ssba_bar_button_color'] ? 'background-color: ' . $arr_settings['ssba_bar_button_color'] . '!important;' : '';
369
+ $bar_button_hover = '' !== $arr_settings['ssba_bar_button_hover_color'] ? 'background-color: ' . $arr_settings['ssba_bar_button_hover_color'] . '!important;' : '';
370
+ $bar_icon_color = '' !== $arr_settings['ssba_bar_icon_color'] ? 'color: ' . $arr_settings['ssba_bar_icon_color'] . '!important;' : '';
371
+ $bar_icon_hover = '' !== $arr_settings['ssba_bar_icon_hover_color'] ? 'color: ' . $arr_settings['ssba_bar_icon_hover_color'] . '!important;' : '';
372
+ $bar_break_point = 'Y' !== $arr_settings['ssba_bar_mobile'] ? 'display: none;' : 'display: block;';
373
+ $the_breakpoint = '' === $arr_settings['ssba_mobile_breakpoint'] || null === $arr_settings['ssba_mobile_breakpoint'] ? '750' : $arr_settings['ssba_mobile_breakpoint'];
374
+
375
+ $html_bar_ssba_style = '
376
  #ssba-bar-2 .ssbp-bar-list {
377
+ max-' . esc_html( $bar_width ) . ';
378
  }
379
  #ssba-bar-2 .ssbp-bar-list li a {' .
380
+ esc_html( $bar_height ) . ' ' .
381
+ esc_html( $bar_width ) . ' ' .
382
+ esc_html( $bar_button_color ) . '
383
  }
384
  #ssba-bar-2 .ssbp-bar-list li a:hover {' .
385
+ esc_html( $bar_button_hover ) . '
386
  }
387
 
388
  #ssba-bar-2 .ssbp-bar-list li a::before {' .
389
+ esc_html( $bar_icon ) .
390
+ esc_html( $bar_icon_color ) .
391
+ '}
392
  #ssba-bar-2 .ssbp-bar-list li a:hover::before {' .
393
+ esc_html( $bar_icon_hover ) .
394
+ '}
395
  #ssba-bar-2 .ssbp-bar-list li {
396
+ ' . esc_html( $bar_margin ) . '
397
  }';
398
 
399
+ $html_bar_ssba_style .= '@media only screen and ( max-width: ' . $the_breakpoint . 'px ) {
400
  #ssba-bar-2 {
401
  ' . $bar_break_point . '
402
  }
403
  }';
404
 
405
+ // If there's any additional css.
406
+ if ( '' !== $arr_settings['ssba_bar_additional_css'] ) {
407
+ // Add the additional CSS.
408
+ $html_bar_ssba_style .= $arr_settings['ssba_bar_additional_css'];
409
+ }
410
 
411
+ wp_add_inline_style( "{$this->plugin->assets_prefix}-ssba", $html_bar_ssba_style ); // WPCS: XSS ok.
412
+ }
413
+ }
414
  }
php/class-widget.php CHANGED
@@ -34,13 +34,13 @@ class Widget extends \WP_Widget {
34
  * @param array $instance THe widget instance.
35
  */
36
  public function widget( $args, $instance ) {
37
- $before_title = $args['before_title'];
38
  $before_widget = $args['before_widget'];
39
- $after_title = $args['after_title'];
40
- $after_widget = $args['after_widget'];
41
- $title = apply_filters( 'widget_title', $instance['title'] );
42
- $url = $instance['url'];
43
- $pagetitle = $instance['pagetitle'];
44
 
45
  echo wp_kses_post( $before_widget );
46
 
@@ -48,9 +48,9 @@ class Widget extends \WP_Widget {
48
  echo wp_kses_post( $before_title . $title . $after_title );
49
  }
50
 
51
- $shortcode = '[ssba-buttons';
52
- $shortcode .= '' !== $url ? ' url="' . $url . '"' : '';
53
- $shortcode .= '' !== $pagetitle ? ' title="' . $pagetitle . '"' : '';
54
  $shortcode .= ' widget="Y"]';
55
 
56
  echo do_shortcode( $shortcode );
@@ -102,10 +102,10 @@ class Widget extends \WP_Widget {
102
  * @return array
103
  */
104
  public function update( $new_instance, $old_instance ) {
105
- $instance = array();
106
- $instance['title'] = strip_tags( $new_instance['title'] );
107
- $instance['url'] = strip_tags( $new_instance['url'] );
108
- $instance['pagetitle'] = strip_tags( $new_instance['pagetitle'] );
109
 
110
  return $instance;
111
  }
34
  * @param array $instance THe widget instance.
35
  */
36
  public function widget( $args, $instance ) {
37
+ $before_title = $args['before_title'];
38
  $before_widget = $args['before_widget'];
39
+ $after_title = $args['after_title'];
40
+ $after_widget = $args['after_widget'];
41
+ $title = apply_filters( 'widget_title', $instance['title'] );
42
+ $url = $instance['url'];
43
+ $pagetitle = $instance['pagetitle'];
44
 
45
  echo wp_kses_post( $before_widget );
46
 
48
  echo wp_kses_post( $before_title . $title . $after_title );
49
  }
50
 
51
+ $shortcode = '[ssba-buttons';
52
+ $shortcode .= '' !== $url ? ' url="' . esc_url( $url ) . '"' : '';
53
+ $shortcode .= '' !== $pagetitle ? ' title="' . esc_attr( $pagetitle ) . '"' : '';
54
  $shortcode .= ' widget="Y"]';
55
 
56
  echo do_shortcode( $shortcode );
102
  * @return array
103
  */
104
  public function update( $new_instance, $old_instance ) {
105
+ $instance = array();
106
+ $instance['title'] = wp_strip_all_tags( $new_instance['title'] );
107
+ $instance['url'] = wp_strip_all_tags( $new_instance['url'] );
108
+ $instance['pagetitle'] = wp_strip_all_tags( $new_instance['pagetitle'] );
109
 
110
  return $instance;
111
  }
readme.txt CHANGED
@@ -2,8 +2,9 @@
2
  Contributors: sharethis, scottstorebloom, scottmweaver, 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.9
6
- Stable tag: 8.2.3
 
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 +67,10 @@ Please visit the <a href="https://wordpress.org/support/plugin/simple-share-butt
66
 
67
  == Changelog ==
68
 
 
 
 
 
69
  = 8.2.3 =
70
  * Add: new media assets.
71
  * Test with WordPress 5.9.
2
  Contributors: sharethis, scottstorebloom, scottmweaver, 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.9.1
6
+ Stable tag: 8.2.4
7
+ Version: 8.2.4
8
  License: GPLv2 or later
9
 
10
  A simple plugin that enables you to add share buttons to all of your posts and/or pages.
67
 
68
  == Changelog ==
69
 
70
+ = 8.2.4 =
71
+ * Test with WordPress 5.9.1.
72
+ * Clean up and sanitize things.
73
+
74
  = 8.2.3 =
75
  * Add: new media assets.
76
  * Test with WordPress 5.9.
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: 8.2.3
7
  * Author: Simple Share Buttons
8
  * Author URI: https://simplesharebuttons.com
9
  * License: GPLv2
@@ -50,9 +50,17 @@ function _simple_share_buttons_adder_php_version_text() {
50
 
51
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), '_simple_share_buttons_adder_add_action_links' );
52
 
 
 
 
 
 
 
 
53
  function _simple_share_buttons_adder_add_action_links( $links ) {
54
  $mylinks = array(
55
  '<a href="' . admin_url( 'options-general.php?page=simple-share-buttons-adder' ) . '">Settings</a>',
56
  );
 
57
  return array_merge( $links, $mylinks );
58
  }
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.2.4
7
  * Author: Simple Share Buttons
8
  * Author URI: https://simplesharebuttons.com
9
  * License: GPLv2
50
 
51
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), '_simple_share_buttons_adder_add_action_links' );
52
 
53
+ /**
54
+ * Add action links to array.
55
+ *
56
+ * @param array $links Links array.
57
+ *
58
+ * @return array
59
+ */
60
  function _simple_share_buttons_adder_add_action_links( $links ) {
61
  $mylinks = array(
62
  '<a href="' . admin_url( 'options-general.php?page=simple-share-buttons-adder' ) . '">Settings</a>',
63
  );
64
+
65
  return array_merge( $links, $mylinks );
66
  }
templates/admin-footer.php CHANGED
@@ -9,20 +9,22 @@
9
 
10
  ?>
11
  </div>
12
- <?php if (empty(get_option('ssba-hide-review'))) : ?>
13
- <div class="ssba-review-us">
14
- <h3>
15
- <?php echo esc_html__('Love this plugin?', 'googleanalytics'); ?>
16
- <p>
17
- <a href="https://wordpress.org/support/plugin/simple-share-buttons-adder/reviews/#new-post" target="_blank">
18
- <?php echo esc_html__(
19
- 'Please spread the word by leaving us a 5 star review!',
20
- 'simple-share-buttons-adder'
21
- ); ?>
22
- </a>
23
- </p>
24
- <div id="close-review-us">close</div>
25
- </h3>
26
- </div>
27
- <?php endif; ?>
 
 
28
  </div>
9
 
10
  ?>
11
  </div>
12
+ <?php if ( empty( get_option( 'ssba-hide-review' ) ) ) : ?>
13
+ <div class="ssba-review-us">
14
+ <h3>
15
+ <?php echo esc_html__( 'Love this plugin?', 'simple-share-buttons-adder' ); ?>
16
+ <p>
17
+ <a href="https://wordpress.org/support/plugin/simple-share-buttons-adder/reviews/#new-post" target="_blank">
18
+ <?php
19
+ echo esc_html__(
20
+ 'Please spread the word by leaving us a 5 star review!',
21
+ 'simple-share-buttons-adder'
22
+ );
23
+ ?>
24
+ </a>
25
+ </p>
26
+ <div id="close-review-us">close</div>
27
+ </h3>
28
+ </div>
29
+ <?php endif; ?>
30
  </div>
templates/admin-header.php CHANGED
@@ -7,8 +7,20 @@
7
  * @package SimpleShareButtonsAdder
8
  */
9
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ?>
11
- <div class="ssba-admin-wrap">
12
  <nav class="navbar navbar-default">
13
  <div class="container-fluid">
14
  <div class="navbar-header">
7
  * @package SimpleShareButtonsAdder
8
  */
9
 
10
+ use SimpleShareButtonsAdder\Admin_Bits;
11
+
12
+ $accept_terms = filter_input( INPUT_GET, 'accept-terms', FILTER_SANITIZE_STRING );
13
+
14
+ $arr_settings = get_option( 'ssba_settings' );
15
+ $accepted = isset( $arr_settings['accepted_sharethis_terms'] ) ? $arr_settings['accepted_sharethis_terms'] : '';
16
+ $accepted = 'Y' === $accepted || 'Y' === $accept_terms ? 'true' : 'false';
17
+
18
+ // If terms not accepted, show the notice.
19
+ if ( 'false' === $accepted ) {
20
+ Admin_Bits::sharethis_terms_notice();
21
+ }
22
  ?>
23
+ <div data-accepted="<?php echo esc_attr( $accepted ); ?>" class="ssba-admin-wrap">
24
  <nav class="navbar navbar-default">
25
  <div class="container-fluid">
26
  <div class="navbar-header">
templates/admin-panel.php CHANGED
@@ -9,34 +9,19 @@
9
 
10
  $selected_tab = get_option( 'ssba_selected_tab' );
11
  $selected_tab = null !== $selected_tab && false !== $selected_tab ? $selected_tab : 'classic';
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.
 
 
 
19
  ?>
20
  <h2><?php echo esc_html__( 'Settings', 'simple-share-buttons-adder' ); ?></h2>
21
 
22
- <?php
23
- // If terms have just been accepted.
24
- if ( isset( $_GET['accept-terms'] ) && 'Y' === $_GET['accept-terms'] ) { // WPCS: CSRF ok. ?>
25
- <div class="alert alert-success text-center">
26
- <p><?php echo esc_html__( 'Thanks for accepting the terms, you can now take advantage of the great new features!', 'simple-share-buttons-adder' ); ?></p>
27
- </div>
28
- <?php } elseif ( 'Y' !== $arr_settings['accepted_sharethis_terms'] ) { ?>
29
- <div class="alert alert-warning text-center">
30
- <p>
31
- <?php echo esc_html__( 'The Facebook save button requires acceptance of the terms before it can be used.', 'simple-share-buttons-adder' ); ?>
32
- <a href="options-general.php?page=simple-share-buttons-adder&accept-terms=Y">
33
- <span class="button button-secondary">
34
- <?php echo esc_html__( 'I accept', 'simple-share-buttons-adder' ); ?>
35
- </span>
36
- </a>
37
- </p>
38
- </div>
39
- <?php } ?>
40
  <ul class="nav nav-tabs">
41
  <li class="ssba-classic-tab <?php echo esc_attr( $classic ); ?>">
42
  <a href="#classic-share-buttons" data-toggle="tab">
@@ -53,21 +38,21 @@ if ( isset( $_GET['accept-terms'] ) && 'Y' === $_GET['accept-terms'] ) { // WPCS
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
71
- echo $this->forms->close(); // WPCS: XSS ok.
72
- echo $this->admin_footer(); // WPCS: XSS ok.
73
  ?>
9
 
10
  $selected_tab = get_option( 'ssba_selected_tab' );
11
  $selected_tab = null !== $selected_tab && false !== $selected_tab ? $selected_tab : 'classic';
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
+ $accept_terms = filter_input( INPUT_GET, 'accept-terms', FILTER_SANITIZE_STRING );
18
+ $accept_terms = sanitize_text_field( wp_unslash( $accept_terms ) );
19
+
20
+ echo $this->admin_header(); // phpcs:ignore
21
+ echo $this->forms->open( false ); // phpcs:ignore
22
  ?>
23
  <h2><?php echo esc_html__( 'Settings', 'simple-share-buttons-adder' ); ?></h2>
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  <ul class="nav nav-tabs">
26
  <li class="ssba-classic-tab <?php echo esc_attr( $classic ); ?>">
27
  <a href="#classic-share-buttons" data-toggle="tab">
38
  <?php echo esc_html__( 'Share Bar', 'simple-share-buttons-adder' ); ?>
39
  </a>
40
  </li>
41
+ <li class="ssba-gdpr <?php echo esc_attr( $gdpr ); ?>">
42
+ <span class="ssba-new-icon">new</span>
43
+ <a href="#gdpr" data-toggle="tab">
44
+ <?php echo esc_html__( 'GDPR', 'simple-share-buttons-adder' ); ?>
45
+ </a>
46
+ </li>
47
  </ul>
48
  <div id="ssbaTabContent" class="tab-content">
49
+ <?php require_once "{$this->plugin->dir_path}/templates/classic-tab.php"; ?>
50
+ <?php require_once "{$this->plugin->dir_path}/templates/plus-tab.php"; ?>
51
+ <?php require_once "{$this->plugin->dir_path}/templates/share-bar-tab.php"; ?>
52
+ <?php require_once "{$this->plugin->dir_path}/templates/gdpr-tab.php"; ?>
53
  </div>
54
  <input id="ssba_selected_tab" name="ssba_selected_tab" type="hidden" value="<?php echo esc_html( $selected_tab ); ?>"/>
55
  <?php
56
+ echo $this->forms->close(); // phpcs:ignore
57
+ echo $this->admin_footer(); // phpcs:ignore
58
  ?>
templates/classic-tab.php CHANGED
@@ -10,7 +10,7 @@
10
  use SimpleShareButtonsAdder\Admin_Panel;
11
 
12
  ?>
13
- <div class="tab-pane fade <?php echo 'active' === $classic ? esc_attr( $classic . ' in' ): ''; ?>" id="classic-share-buttons">
14
  <div class="col-sm-12 ssba-tab-container">
15
  <blockquote class="yellow">
16
  <p><?php echo esc_html__( 'Dear valued SSB users,', 'simple-share-buttons-adder' ); ?></p>
@@ -19,7 +19,7 @@ use SimpleShareButtonsAdder\Admin_Panel;
19
  <p><?php echo esc_html__( 'We plan on moving the "Classic Share Buttons" tab within this plugin to highlight our "Modern Share Buttons." Please make the switch over to the Modern Share Buttons version as soon as possible!', 'simple-share-buttons-adder' ); ?></p>
20
  <p><?php echo esc_html__( 'Thank you :)', 'simple-share-buttons-adder' ); ?></p>
21
  </blockquote>
22
- <?php if ( isset( $arr_settings['ssba_new_buttons'] ) && 'Y' === $arr_settings['ssba_new_buttons'] ) :?>
23
  <blockquote class="yellow">
24
  <p>
25
  <?php echo esc_html__( 'The "Modern Share Buttons" are currently active. To use the buttons below you must deactivate the "Modern Share Buttons".', 'simple-share-buttons-adder' ); ?>
@@ -80,11 +80,11 @@ use SimpleShareButtonsAdder\Admin_Panel;
80
  <input type="hidden" name="ssba_selected_buttons" id="ssba_selected_buttons" value="<?php esc_attr( $arr_settings['ssba_selected_buttons'] ); ?>"/>
81
  </div>
82
  <?php
83
- echo $this->forms->ssbp_checkboxes( $opts1 ); // WPCS: XSS ok.
84
- echo $this->forms->ssbp_input( $opts2 ); // WPCS: XSS ok.
85
- echo $this->forms->ssbp_input( $page_omit ); // WPCS: XSS ok.
86
 
87
- $line_height = 'below' === $arr_settings['ssba_text_placement'] || 'above' === $arr_settings['ssba_text_placement'] ? 'inherit' : ( (int) $arr_settings['ssba_size'] + (int) $arr_settings['ssba_padding'] + 3 ) . 'px';
88
  $image_line_height = $arr_settings['ssba_size'] . 'px';
89
  ?>
90
 
@@ -98,10 +98,11 @@ use SimpleShareButtonsAdder\Admin_Panel;
98
  </div>
99
 
100
  <ul class="ssbp-list">
101
- <?php foreach ( $arr_buttons as $buttons ) :
 
102
  $button = strtolower( str_replace( ' ', '_', str_replace( '+', '', $buttons['full_name'] ) ) );
103
 
104
- if (false === Admin_Panel::showInClassic('classic', $buttons['full_name'])) {
105
  continue;
106
  }
107
 
@@ -109,14 +110,18 @@ use SimpleShareButtonsAdder\Admin_Panel;
109
  $img_src = esc_attr( $this->plugin->dir_url ) . 'buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/' . esc_attr( $button ) . '.png';
110
  } else {
111
  $img_src = isset( $custom_buttons[ $button ] ) ? $custom_buttons[ $button ] : '';
112
- } ?>
113
- <li class="ssbp-li--<?php echo esc_attr( $button );
 
 
 
114
  if ( ! in_array( $button, explode( ',', $arr_settings['ssba_selected_buttons'] ), true ) ) {
115
  echo esc_attr( ' ssba-hide-button' );
116
  }
117
- ?>">
 
118
  <img style="line-height: <?php echo esc_attr( $image_line_height ); ?>; height: <?php echo esc_attr( $arr_settings['ssba_size'] ); ?>px; padding: <?php echo esc_attr( $arr_settings['ssba_padding'] ); ?>px;" src="<?php echo esc_attr( $img_src ); ?>" title="<?php echo esc_attr( $buttons['full_name'] ); ?>" class="ssba ssba-img" alt="Share on <?php echo esc_attr( $button ); ?>" />
119
- <span style="vertical-align: middle;" class="<?php echo 'Y' === $arr_settings['ssba_show_share_count'] ? esc_attr( 'ssba_sharecount ssba_' . $arr_settings['ssba_share_count_style'] ) : ''; ?> ssbp-total-<?php echo esc_attr( $button ); ?>-shares">1.8k</span>
120
  </li>
121
  <?php endforeach; ?>
122
  </ul>
@@ -135,7 +140,7 @@ use SimpleShareButtonsAdder\Admin_Panel;
135
  </div>
136
 
137
  <div class="col-md-6">
138
- <?php echo $this->forms->ssbp_input( $opts4 ); // WPCS: XSS ok.?>
139
 
140
  <div id="ssba-custom-images" <?php echo 'custom' !== $arr_settings['ssba_image_set'] ? 'style="display: none;"' : null; ?>>
141
  <?php
@@ -144,7 +149,7 @@ use SimpleShareButtonsAdder\Admin_Panel;
144
  $custom_button = strtolower( str_replace( ' ', '_', str_replace( '+', '', $arr_button['full_name'] ) ) );
145
 
146
  // Enable custom images.
147
- $opts5 = array(
148
  'form_group' => false,
149
  'type' => 'image_upload',
150
  'name' => 'ssba_custom_' . $custom_button,
@@ -152,17 +157,17 @@ use SimpleShareButtonsAdder\Admin_Panel;
152
  'tooltip' => 'Upload a custom ' . $arr_button['full_name'] . ' image',
153
  'value' => isset( $arr_settings[ 'ssba_custom_' . $custom_button ] ) ? $arr_settings[ 'ssba_custom_' . $custom_button ] : '',
154
  );
155
- echo $this->forms->ssbp_input( $opts5 ); // WPCS: XSS ok.
156
  }
157
  ?>
158
  </div>
159
 
160
- <?php echo $this->forms->ssbp_input( $opts6 ); // WPCS: XSS ok. ?>
161
  </div>
162
  <div class="col-md-6">
163
  <?php
164
- echo $this->forms->ssbp_input( $opts7 ); // WPCS: XSS ok.
165
- echo $this->forms->ssbp_input( $opts8 ); // WPCS: XSS ok.
166
  ?>
167
  </div>
168
 
@@ -171,16 +176,16 @@ use SimpleShareButtonsAdder\Admin_Panel;
171
  </div>
172
  <div class="col-md-6 share-text-prev">
173
  <?php
174
- echo $this->forms->ssbp_input( $opts3 ); // WPCS: XSS ok.
175
- echo $this->forms->ssbp_input( $opts10 ); // WPCS: XSS ok.
176
- echo $this->forms->ssbp_input( $opts11 ); // WPCS: XSS ok.
177
  ?>
178
  </div>
179
  <div class="col-md-6 share-text-prev">
180
  <?php
181
- echo $this->forms->ssbp_input( $opts12 ); // WPCS: XSS ok.
182
- echo $this->forms->ssbp_input( $opts13 ); // WPCS: XSS ok.
183
- echo $this->forms->ssbp_input( $opts9 ); // WPCS: XSS ok.
184
  ?>
185
  </div>
186
 
@@ -189,19 +194,19 @@ use SimpleShareButtonsAdder\Admin_Panel;
189
  </div>
190
 
191
  <div class="col-md-12 share-cont-prev">
192
- <?php echo $this->forms->ssbp_input( $opts18 ); // WPCS: XSS ok. ?>
193
  </div>
194
 
195
  <div class="col-md-6 share-cont-prev">
196
  <?php
197
- echo $this->forms->ssbp_input( $opts14 ); // WPCS: XSS ok.
198
- echo $this->forms->ssbp_input( $opts17 ); // WPCS: XSS ok.
199
  ?>
200
  </div>
201
  <div class="col-md-6 share-cont-prev">
202
  <?php
203
- echo $this->forms->ssbp_input( $opts16 ); // WPCS: XSS ok.
204
- echo $this->forms->ssbp_input( $opts15 ); // WPCS: XSS ok.
205
  ?>
206
  </div>
207
  </div>
@@ -220,9 +225,9 @@ use SimpleShareButtonsAdder\Admin_Panel;
220
 
221
  <div class="col-md-12 share-count-prev">
222
  <?php
223
- echo $this->forms->ssbp_input( $opts19 ); // WPCS: XSS ok.
224
- echo $this->forms->ssbp_input( $opts20 ); // WPCS: XSS ok.
225
- echo $this->forms->ssbp_input( $opts21 ); // WPCS: XSS ok.
226
  ?>
227
  </div>
228
  </div>
@@ -261,19 +266,19 @@ use SimpleShareButtonsAdder\Admin_Panel;
261
 
262
  <div class="col-md-12">
263
  <?php
264
- echo $this->forms->ssbp_input( $opts26 ); // WPCS: XSS ok.
265
- echo $this->forms->ssbp_input( $opts27 ); // WPCS: XSS ok.
266
- echo $this->forms->ssbp_input( $opts28 ); // WPCS: XSS ok.
267
- echo $this->forms->ssbp_input( $opts29 ); // WPCS: XSS ok.
268
  ?>
269
  </div>
270
 
271
  <div class="col-md-6">
272
- <?php echo $this->forms->ssbp_input( $opts30 ); // WPCS: XSS ok. ?>
273
  </div>
274
 
275
  <div class="col-md-6">
276
- <?php echo $this->forms->ssbp_input( $opts31 ); // WPCS: XSS ok. ?>
277
  </div>
278
 
279
  <div class="col-md-12">
@@ -281,11 +286,11 @@ use SimpleShareButtonsAdder\Admin_Panel;
281
  </div>
282
 
283
  <div class="col-md-12">
284
- <?php echo $this->forms->ssbp_input( $opts33 ); // WPCS: XSS ok.?>
285
  </div>
286
 
287
  <div class="col-md-12">
288
- <?php echo $this->forms->ssbp_input( $ignore_sdk ); // WPCS: XSS ok.?>
289
  </div>
290
 
291
  <div class="col-md-12">
@@ -293,26 +298,26 @@ use SimpleShareButtonsAdder\Admin_Panel;
293
  </div>
294
 
295
  <div class="col-md-12">
296
- <?php echo $this->forms->ssbp_input( $opts32 ); // WPCS: XSS ok. ?>
297
  </div>
298
 
299
  <div class="col-md-6">
300
  <?php
301
- echo $this->forms->ssbp_input( $opts34 ); // WPCS: XSS ok.
302
- echo $this->forms->ssbp_input( $opts37 ); // WPCS: XSS ok.
303
  ?>
304
  </div>
305
  <div class="col-md-6">
306
  <?php
307
- echo $this->forms->ssbp_input( $opts35 ); // WPCS: XSS ok.
308
- echo $this->forms->ssbp_input( $opts36 ); // WPCS: XSS ok.
309
  ?>
310
  </div>
311
 
312
  <div class="col-md-12">
313
  <?php
314
- echo $this->forms->ssbp_input( $opts38 ); // WPCS: XSS ok.
315
- echo $this->forms->ssbp_input( $opts39 ); // WPCS: XSS ok.
316
  ?>
317
  </div>
318
  </div>
@@ -336,7 +341,7 @@ use SimpleShareButtonsAdder\Admin_Panel;
336
  </div>
337
 
338
  <div class="col-sm-12">
339
- <?php echo $this->forms->ssbp_input( $opts40 ); // WPCS: XSS ok.?>
340
  </div>
341
 
342
  <div class="col-md-12">
@@ -347,8 +352,8 @@ use SimpleShareButtonsAdder\Admin_Panel;
347
 
348
  <div class="col-sm-12">
349
  <?php
350
- echo $this->forms->ssbp_input( $opts41 ); // WPCS: XSS ok.
351
- echo $this->forms->ssbp_input( $opts42 ); // WPCS: XSS ok.
352
  ?>
353
  </div>
354
  </div>
10
  use SimpleShareButtonsAdder\Admin_Panel;
11
 
12
  ?>
13
+ <div class="tab-pane fade <?php echo 'active' === $classic ? esc_attr( $classic . ' in' ) : ''; ?>" id="classic-share-buttons">
14
  <div class="col-sm-12 ssba-tab-container">
15
  <blockquote class="yellow">
16
  <p><?php echo esc_html__( 'Dear valued SSB users,', 'simple-share-buttons-adder' ); ?></p>
19
  <p><?php echo esc_html__( 'We plan on moving the "Classic Share Buttons" tab within this plugin to highlight our "Modern Share Buttons." Please make the switch over to the Modern Share Buttons version as soon as possible!', 'simple-share-buttons-adder' ); ?></p>
20
  <p><?php echo esc_html__( 'Thank you :)', 'simple-share-buttons-adder' ); ?></p>
21
  </blockquote>
22
+ <?php if ( isset( $arr_settings['ssba_new_buttons'] ) && 'Y' === $arr_settings['ssba_new_buttons'] ) : ?>
23
  <blockquote class="yellow">
24
  <p>
25
  <?php echo esc_html__( 'The "Modern Share Buttons" are currently active. To use the buttons below you must deactivate the "Modern Share Buttons".', 'simple-share-buttons-adder' ); ?>
80
  <input type="hidden" name="ssba_selected_buttons" id="ssba_selected_buttons" value="<?php esc_attr( $arr_settings['ssba_selected_buttons'] ); ?>"/>
81
  </div>
82
  <?php
83
+ echo $this->forms->ssbp_checkboxes( $opts1 ); // phpcs:ignore
84
+ echo wp_kses_post($this->forms->ssbp_input( $opts2 )); // phpcs:ignore
85
+ echo wp_kses_post($this->forms->ssbp_input( $page_omit )); // phpcs:ignore
86
 
87
+ $line_height = 'below' === $arr_settings['ssba_text_placement'] || 'above' === $arr_settings['ssba_text_placement'] ? 'inherit' : ( (int) $arr_settings['ssba_size'] + (int) $arr_settings['ssba_padding'] + 3 ) . 'px';
88
  $image_line_height = $arr_settings['ssba_size'] . 'px';
89
  ?>
90
 
98
  </div>
99
 
100
  <ul class="ssbp-list">
101
+ <?php
102
+ foreach ( $arr_buttons as $buttons ) :
103
  $button = strtolower( str_replace( ' ', '_', str_replace( '+', '', $buttons['full_name'] ) ) );
104
 
105
+ if ( false === Admin_Panel::show_in_classic( 'classic', $buttons['full_name'] ) ) {
106
  continue;
107
  }
108
 
110
  $img_src = esc_attr( $this->plugin->dir_url ) . 'buttons/' . esc_attr( $arr_settings['ssba_image_set'] ) . '/' . esc_attr( $button ) . '.png';
111
  } else {
112
  $img_src = isset( $custom_buttons[ $button ] ) ? $custom_buttons[ $button ] : '';
113
+ }
114
+ ?>
115
+ <li class="ssbp-li--
116
+ <?php
117
+ echo esc_attr( $button );
118
  if ( ! in_array( $button, explode( ',', $arr_settings['ssba_selected_buttons'] ), true ) ) {
119
  echo esc_attr( ' ssba-hide-button' );
120
  }
121
+ ?>
122
+ ">
123
  <img style="line-height: <?php echo esc_attr( $image_line_height ); ?>; height: <?php echo esc_attr( $arr_settings['ssba_size'] ); ?>px; padding: <?php echo esc_attr( $arr_settings['ssba_padding'] ); ?>px;" src="<?php echo esc_attr( $img_src ); ?>" title="<?php echo esc_attr( $buttons['full_name'] ); ?>" class="ssba ssba-img" alt="Share on <?php echo esc_attr( $button ); ?>" />
124
+ <span style="vertical-align: middle;" class="<?php echo 'Y' === $arr_settings['ssba_show_share_count'] ? esc_attr( 'ssba_sharecount ssba_' . $arr_settings['ssba_share_count_style'] ) : ''; ?> ssbp-total-<?php echo esc_attr( $button ); ?>-shares">1.8k</span>
125
  </li>
126
  <?php endforeach; ?>
127
  </ul>
140
  </div>
141
 
142
  <div class="col-md-6">
143
+ <?php echo wp_kses_post( $this->forms->ssbp_input( $opts4 ) ); ?>
144
 
145
  <div id="ssba-custom-images" <?php echo 'custom' !== $arr_settings['ssba_image_set'] ? 'style="display: none;"' : null; ?>>
146
  <?php
149
  $custom_button = strtolower( str_replace( ' ', '_', str_replace( '+', '', $arr_button['full_name'] ) ) );
150
 
151
  // Enable custom images.
152
+ $opts5 = array(
153
  'form_group' => false,
154
  'type' => 'image_upload',
155
  'name' => 'ssba_custom_' . $custom_button,
157
  'tooltip' => 'Upload a custom ' . $arr_button['full_name'] . ' image',
158
  'value' => isset( $arr_settings[ 'ssba_custom_' . $custom_button ] ) ? $arr_settings[ 'ssba_custom_' . $custom_button ] : '',
159
  );
160
+ echo wp_kses_post( $this->forms->ssbp_input( $opts5 ) );
161
  }
162
  ?>
163
  </div>
164
 
165
+ <?php echo wp_kses_post( $this->forms->ssbp_input( $opts6 ) ); ?>
166
  </div>
167
  <div class="col-md-6">
168
  <?php
169
+ echo wp_kses_post( $this->forms->ssbp_input( $opts7 ) );
170
+ echo wp_kses_post( $this->forms->ssbp_input( $opts8 ) );
171
  ?>
172
  </div>
173
 
176
  </div>
177
  <div class="col-md-6 share-text-prev">
178
  <?php
179
+ echo wp_kses_post( $this->forms->ssbp_input( $opts3 ) );
180
+ echo wp_kses_post( $this->forms->ssbp_input( $opts10 ) );
181
+ echo wp_kses_post( $this->forms->ssbp_input( $opts11 ) );
182
  ?>
183
  </div>
184
  <div class="col-md-6 share-text-prev">
185
  <?php
186
+ echo wp_kses_post( $this->forms->ssbp_input( $opts12 ) );
187
+ echo wp_kses_post( $this->forms->ssbp_input( $opts13 ) );
188
+ echo wp_kses_post( $this->forms->ssbp_input( $opts9 ) );
189
  ?>
190
  </div>
191
 
194
  </div>
195
 
196
  <div class="col-md-12 share-cont-prev">
197
+ <?php echo wp_kses_post( $this->forms->ssbp_input( $opts18 ) ); ?>
198
  </div>
199
 
200
  <div class="col-md-6 share-cont-prev">
201
  <?php
202
+ echo wp_kses_post( $this->forms->ssbp_input( $opts14 ) );
203
+ echo wp_kses_post( $this->forms->ssbp_input( $opts17 ) );
204
  ?>
205
  </div>
206
  <div class="col-md-6 share-cont-prev">
207
  <?php
208
+ echo wp_kses_post( $this->forms->ssbp_input( $opts16 ) );
209
+ echo wp_kses_post( $this->forms->ssbp_input( $opts15 ) );
210
  ?>
211
  </div>
212
  </div>
225
 
226
  <div class="col-md-12 share-count-prev">
227
  <?php
228
+ echo wp_kses_post($this->forms->ssbp_input( $opts19 )); // phpcs:ignore
229
+ echo wp_kses_post($this->forms->ssbp_input( $opts20 )); // phpcs:ignore
230
+ echo wp_kses_post($this->forms->ssbp_input( $opts21 )); // phpcs:ignore
231
  ?>
232
  </div>
233
  </div>
266
 
267
  <div class="col-md-12">
268
  <?php
269
+ echo wp_kses_post( $this->forms->ssbp_input( $opts26 ) ); // phpcs:ignore
270
+ echo wp_kses_post( $this->forms->ssbp_input( $opts27 ) ); // phpcs:ignore
271
+ echo wp_kses_post( $this->forms->ssbp_input( $opts28 ) ); // phpcs:ignore
272
+ echo wp_kses_post( $this->forms->ssbp_input( $opts29 ) ); // phpcs:ignore
273
  ?>
274
  </div>
275
 
276
  <div class="col-md-6">
277
+ <?php echo wp_kses_post( $this->forms->ssbp_input( $opts30 ) ); // phcs:ignore. ?>
278
  </div>
279
 
280
  <div class="col-md-6">
281
+ <?php echo wp_kses_post( $this->forms->ssbp_input( $opts31 ) ); // phcs:ignore. ?>
282
  </div>
283
 
284
  <div class="col-md-12">
286
  </div>
287
 
288
  <div class="col-md-12">
289
+ <?php echo wp_kses_post( $this->forms->ssbp_input( $opts33 ) ); // phcs:ignore. ?>
290
  </div>
291
 
292
  <div class="col-md-12">
293
+ <?php echo wp_kses_post( $this->forms->ssbp_input( $ignore_sdk ) ); // phcs:ignore. ?>
294
  </div>
295
 
296
  <div class="col-md-12">
298
  </div>
299
 
300
  <div class="col-md-12">
301
+ <?php echo wp_kses_post( $this->forms->ssbp_input( $opts32 ) ); // phpcs:ignore. ?>
302
  </div>
303
 
304
  <div class="col-md-6">
305
  <?php
306
+ echo wp_kses_post( $this->forms->ssbp_input( $opts34 ) ); // phpcs:ignore
307
+ echo wp_kses_post( $this->forms->ssbp_input( $opts37 ) ); // phpcs:ignore
308
  ?>
309
  </div>
310
  <div class="col-md-6">
311
  <?php
312
+ echo wp_kses_post($this->forms->ssbp_input( $opts35 )); // phpcs:ignore
313
+ echo wp_kses_post($this->forms->ssbp_input( $opts36 )); // phpcs:ignore
314
  ?>
315
  </div>
316
 
317
  <div class="col-md-12">
318
  <?php
319
+ echo wp_kses_post($this->forms->ssbp_input( $opts38 )); // phpcs:ignore
320
+ echo wp_kses_post($this->forms->ssbp_input( $opts39 )); // phpcs:ignore
321
  ?>
322
  </div>
323
  </div>
341
  </div>
342
 
343
  <div class="col-sm-12">
344
+ <?php echo wp_kses_post($this->forms->ssbp_input( $opts40 )); // phpcs:ignore ?>
345
  </div>
346
 
347
  <div class="col-md-12">
352
 
353
  <div class="col-sm-12">
354
  <?php
355
+ echo wp_kses_post($this->forms->ssbp_input( $opts41 )); // phpcs:ignore
356
+ echo wp_kses_post($this->forms->ssbp_input( $opts42 )); // phpcs:ignore
357
  ?>
358
  </div>
359
  </div>
templates/config/gdpr/appearance.php CHANGED
@@ -1,53 +1,59 @@
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>
1
  <?php
2
  /**
3
  * Appearence display for gdpr config.
4
+ *
5
+ * @package SimpleShareButtonsAdder
6
  */
7
 
8
+ // Get GDPR Config.
9
+ $ssba_settings = get_option( 'ssba_settings', true );
10
+ $gdpr_config = true === isset( $ssba_settings['ssba_gdpr_config'] ) ? $ssba_settings['ssba_gdpr_config'] : array();
11
+
12
  // Template vars.
13
+ $colors = array(
14
+ '#e31010',
15
+ '#000000',
16
+ '#ffffff',
17
+ '#09cd18',
18
+ '#ff6900',
19
+ '#fcb900',
20
+ '#7bdcb5',
21
+ '#00d084',
22
+ '#8ed1fc',
23
+ '#0693e3',
24
+ '#abb8c3',
25
+ '#eb144c',
26
+ '#f78da7',
27
+ '#9900ef',
28
+ '#b80000',
29
+ '#db3e00',
30
+ '#fccb00',
31
+ '#008b02',
32
+ '#006b76',
33
+ '#1273de',
34
+ '#004dcf',
35
+ '#5300eb',
36
+ '#eb9694',
37
+ '#fad0c3',
38
+ '#fef3bd',
39
+ '#c1e1c5',
40
+ '#bedadc',
41
+ '#c4def6',
42
+ '#bed3f3',
43
+ '#d4c4fb',
44
+ );
45
  ?>
46
  <div class="col-md-12">
47
+ <h3><?php echo esc_html__( 'Form Color', 'simple-share-buttons-adder' ); ?></h3>
48
  </div>
49
 
50
  <div id="sharethis-form-color" class="col-md-12">
51
+ <?php foreach ( $colors as $color ) : ?>
52
+ <div class="color<?php echo true === isset( $gdpr_config['color'] ) && $color === $gdpr_config['color'] ? esc_attr( ' selected' ) : ''; ?>"
53
+ data-value="<?php echo esc_attr( $color ); ?>"
54
+ style="max-width: 30px; max-height: 30px; overflow: hidden;"
55
+ >
56
+ <span style="content: ' '; background-color:<?php echo esc_html( $color ); ?>; padding: 40px;"></span>
57
+ </div>
58
+ <?php endforeach; ?>
59
  </div>
templates/config/gdpr/config.php CHANGED
@@ -1,83 +1,93 @@
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
  $languages = array(
13
- 'English' => 'en',
14
- 'German' => 'de',
15
- 'Spanish' => 'es',
16
- 'French' => 'fr'
17
  );
18
 
19
- $publisher_name = !empty($gdpr_config['publisher_name']) ? $gdpr_config['publisher_name'] : '';
20
- $enabled = !empty($gdpr_config['enabled']) ? $gdpr_config['enabled'] : false;
21
  ?>
22
  <label class="control-label">
23
- <?php echo esc_html__('GDPR', 'simple-share-buttons-adder'); ?>
24
  </label>
25
  <div class="input-div">
26
- <input type="checkbox" id="sharethis-enabled" <?php echo checked('true', $enabled); ?>>
27
  </div>
28
  <div class="well">
29
- <label class="control-label">
30
- <?php echo esc_html__('PUBLISHER NAME * (this will be displayed in the consent tool)',
31
- 'sharethis-share-buttons'); ?>
32
- </label>
33
- <div class="input-div">
34
- <input type="text" id="sharethis-publisher-name" placeholder="Enter your company name" value="<?php echo esc_attr($publisher_name); ?>">
35
- </div>
36
- <label class="control-label">
37
- <?php echo esc_html__('WHICH USERS SHOULD BE ASKED FOR CONSENT?',
38
- 'sharethis-share-buttons'); ?>
39
- </label>
40
- <div class="input-div">
41
- <select id="sharethis-user-type">
42
- <?php foreach ($user_types as $user_value => $name) : ?>
43
- <option value="<?php echo esc_attr($user_value); ?>" <?php echo selected($user_value, $gdpr_config['display']); ?>>
44
- <?php echo esc_html($name); ?>
45
- </option>
46
- <?php endforeach; ?>
47
- </select>
48
- </div>
49
- <label class="control-label">
50
- <?php echo esc_html__('SELECT LANGUAGE', 'sharethis-share-buttons'); ?>
51
- </label>
52
- <div class="input-div">
53
- <select id="st-language">
54
- <?php foreach ($languages as $language => $code) : ?>
55
- <option value="<?php echo esc_attr($code); ?>" <?php echo selected($code, $gdpr_config['language']); ?>>
56
- <?php echo esc_html($language); ?>
57
- </option>
58
- <?php endforeach; ?>
59
- </select>
60
- </div>
 
 
 
 
 
 
 
 
61
  </div>
62
  <div class="accor-wrap">
63
- <div class="accor-tab">
64
- <span class="accor-arrow">&#9658;</span>
65
- <?php echo esc_html__( 'Appearance', 'simple-share-buttons-adder' ); ?>
66
- </div>
67
- <div class="accor-content">
68
- <div class="well">
69
- <?php include plugin_dir_path(__FILE__) . 'appearance.php'; ?>
70
- </div>
71
- </div>
72
  </div>
73
  <div class="accor-wrap">
74
- <div class="accor-tab">
75
- <span class="accor-arrow">&#9658;</span>
76
- <?php echo esc_html__( 'Purposes', 'simple-share-buttons-adder' ); ?>
77
- </div>
78
- <div class="accor-content">
79
- <div class="well">
80
- <?php include plugin_dir_path(__FILE__) . 'purposes.php'; ?>
81
- </div>
82
- </div>
83
  </div>
1
  <?php
2
  /**
3
+ * The Config display for GDPR tab.
4
+ *
5
+ * @package SimpleShareButtonsAdder
6
  */
7
 
8
  // User type options.
9
  $user_types = array(
10
+ 'eu' => esc_html__( 'Only visitors in the EU', 'sharethis-custom' ),
11
+ 'always' => esc_html__( 'All visitors globally', 'sharethis-custom' ),
12
  );
13
 
14
  $languages = array(
15
+ 'English' => 'en',
16
+ 'German' => 'de',
17
+ 'Spanish' => 'es',
18
+ 'French' => 'fr',
19
  );
20
 
21
+ $publisher_name = ! empty( $gdpr_config['publisher_name'] ) ? $gdpr_config['publisher_name'] : '';
22
+ $enabled = ! empty( $gdpr_config['enabled'] ) ? $gdpr_config['enabled'] : false;
23
  ?>
24
  <label class="control-label">
25
+ <?php echo esc_html__( 'GDPR', 'simple-share-buttons-adder' ); ?>
26
  </label>
27
  <div class="input-div">
28
+ <input type="checkbox" id="sharethis-enabled" <?php checked( 'true', $enabled ); ?>>
29
  </div>
30
  <div class="well">
31
+ <label class="control-label">
32
+ <?php
33
+ echo esc_html__(
34
+ 'PUBLISHER NAME * (this will be displayed in the consent tool)',
35
+ 'sharethis-share-buttons'
36
+ );
37
+ ?>
38
+ </label>
39
+ <div class="input-div">
40
+ <input type="text" id="sharethis-publisher-name" placeholder="Enter your company name" value="<?php echo esc_attr( $publisher_name ); ?>">
41
+ </div>
42
+ <label class="control-label">
43
+ <?php
44
+ echo esc_html__(
45
+ 'WHICH USERS SHOULD BE ASKED FOR CONSENT?',
46
+ 'sharethis-share-buttons'
47
+ );
48
+ ?>
49
+ </label>
50
+ <div class="input-div">
51
+ <select id="sharethis-user-type">
52
+ <?php foreach ( $user_types as $user_value => $name ) : ?>
53
+ <option value="<?php echo esc_attr( $user_value ); ?>" <?php echo selected( $user_value, $gdpr_config['display'] ); ?>>
54
+ <?php echo esc_html( $name ); ?>
55
+ </option>
56
+ <?php endforeach; ?>
57
+ </select>
58
+ </div>
59
+ <label class="control-label">
60
+ <?php echo esc_html__( 'SELECT LANGUAGE', 'sharethis-share-buttons' ); ?>
61
+ </label>
62
+ <div class="input-div">
63
+ <select id="st-language">
64
+ <?php foreach ( $languages as $language => $code ) : ?>
65
+ <option value="<?php echo esc_attr( $code ); ?>" <?php echo selected( $code, $gdpr_config['language'] ); ?>>
66
+ <?php echo esc_html( $language ); ?>
67
+ </option>
68
+ <?php endforeach; ?>
69
+ </select>
70
+ </div>
71
  </div>
72
  <div class="accor-wrap">
73
+ <div class="accor-tab">
74
+ <span class="accor-arrow">&#9658;</span>
75
+ <?php echo esc_html__( 'Appearance', 'simple-share-buttons-adder' ); ?>
76
+ </div>
77
+ <div class="accor-content">
78
+ <div class="well">
79
+ <?php require plugin_dir_path( __FILE__ ) . 'appearance.php'; ?>
80
+ </div>
81
+ </div>
82
  </div>
83
  <div class="accor-wrap">
84
+ <div class="accor-tab">
85
+ <span class="accor-arrow">&#9658;</span>
86
+ <?php echo esc_html__( 'Purposes', 'simple-share-buttons-adder' ); ?>
87
+ </div>
88
+ <div class="accor-content">
89
+ <div class="well">
90
+ <?php require plugin_dir_path( __FILE__ ) . 'purposes.php'; ?>
91
+ </div>
92
+ </div>
93
  </div>
templates/config/gdpr/landing.php CHANGED
@@ -1,239 +1,295 @@
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>
1
  <?php
2
  /**
3
  * Template for GDPR landing page display.
4
+ *
5
+ * @package SimpleShareButtonsAdder
6
  */
7
+
8
  ?>
9
  <h2 style="text-decoration: underline;">
10
+ <?php esc_html_e( 'Check out our new GDPR Compliance Tool!', 'simple-share-buttons-adder' ); ?>
11
  </h2>
12
  <div class="row">
13
+ <div class="col-md-12">
14
+ <img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../../../images/gdpr-ex.png' ); ?>"/>
15
+ </div>
16
+ <div class="col-md-6">
17
+ <h3><?php esc_html_e( 'Confirm Consent', 'simple-share-buttons-adder' ); ?></h3>
18
+ <p>
19
+ <?php
20
+ esc_html_e(
21
+ 'A simple and streamlined way to confirm a user’s initial acceptance or rejection of cookie collection',
22
+ 'simple-share-buttons-adder'
23
+ );
24
+ ?>
25
+ </p>
26
+ </div>
27
+ <div class="col-md-6">
28
+ <h3><?php esc_html_e( 'Select Purpose', 'simple-share-buttons-adder' ); ?></h3>
29
+ <p>
30
+ <?php
31
+ esc_html_e(
32
+ 'A transparent system of verifying the intent of collecting a user’s cookies, and giving the option to opt in or out',
33
+ 'simple-share-buttons-adder'
34
+ );
35
+ ?>
36
+ </p>
37
+ </div>
38
  </div>
39
  <div class="row">
40
+ <div class="col-md-6">
41
+ <h3><?php esc_html_e( 'Indicate Company', 'simple-share-buttons-adder' ); ?></h3>
42
+ <p>
43
+ <?php
44
+ esc_html_e(
45
+ 'A comprehensive record of company-level information that allows users to monitor and control the recipients of cookie collection',
46
+ 'simple-share-buttons-adder'
47
+ );
48
+ ?>
49
+ </p>
50
+ </div>
51
+ <div class="col-md-6">
52
+ <h3><?php esc_html_e( 'Access Data Rights', 'simple-share-buttons-adder' ); ?></h3>
53
+ <p>
54
+ <?php
55
+ esc_html_e(
56
+ 'A centralized database where users can review the latest privacy policies and information pertaining to their cookie collection',
57
+ 'simple-share-buttons-adder'
58
+ );
59
+ ?>
60
+ </p>
61
+ </div>
62
  </div>
63
  <div class="row register-section">
64
+ <button id="register-selection"><?php esc_html_e( 'Register to enable', 'simple-share-buttons-adder' ); ?></button>
65
  </div>
66
  <div class="row">
67
+ <h2 style="text-decoration: underline;"><?php esc_html_e( 'FAQs', 'simple-share-buttons-adder' ); ?></h2>
68
+ <div class="accor-wrap">
69
+ <div class="accor-tab">
70
+ <span class="accor-arrow">&#9658;</span>
71
+ <?php esc_html_e( 'What is GDPR?', 'simple-share-buttons-adder' ); ?>
72
+ </div>
73
+ <div class="accor-content">
74
+ <div class="well">
75
+ <?php
76
+ esc_html_e(
77
+ '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.',
78
+ 'simple-share-buttons-adder'
79
+ );
80
+ ?>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ <div class="accor-wrap">
85
+ <div class="accor-tab">
86
+ <span class="accor-arrow">&#9658;</span>
87
+ <?php esc_html_e( 'What is “Personal Data” as it relates to GDPR?', 'simple-share-buttons-adder' ); ?>
88
+ </div>
89
+ <div class="accor-content">
90
+ <div class="well">
91
+ <?php
92
+ esc_html_e(
93
+ '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.',
94
+ 'simple-share-buttons-adder'
95
+ );
96
+ ?>
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 esc_html_e( 'What is a Data Protection Officer (DPO)?', 'simple-share-buttons-adder' ); ?>
104
+ </div>
105
+ <div class="accor-content">
106
+ <div class="well">
107
+ <?php
108
+ esc_html_e(
109
+ '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.',
110
+ 'simple-share-buttons-adder'
111
+ );
112
+ ?>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ <div class="accor-wrap">
117
+ <div class="accor-tab">
118
+ <span class="accor-arrow">&#9658;</span>
119
+ <?php esc_html_e( 'What is a CMP?', 'simple-share-buttons-adder' ); ?>
120
+ </div>
121
+ <div class="accor-content">
122
+ <div class="well">
123
+ <?php
124
+ esc_html_e(
125
+ '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.',
126
+ 'simple-share-buttons-adder'
127
+ );
128
+ ?>
129
+ </div>
130
+ </div>
131
+ </div>
132
+ <div class="accor-wrap">
133
+ <div class="accor-tab">
134
+ <span class="accor-arrow">&#9658;</span>
135
+ <?php
136
+ esc_html_e(
137
+ 'Are you a member of any self-regulating organizations? Have you any data-related certification?',
138
+ 'simple-share-buttons-adder'
139
+ );
140
+ ?>
141
+ </div>
142
+ <div class="accor-content">
143
+ <div class="well">
144
+ <?php
145
+ esc_html_e(
146
+ 'ShareThis is a member of the IAB, NAI, and DAA in the North American markets and EDAA in Europe.',
147
+ 'simple-share-buttons-adder'
148
+ );
149
+ ?>
150
+ </div>
151
+ </div>
152
+ </div>
153
+ <div class="accor-wrap">
154
+ <div class="accor-tab">
155
+ <span class="accor-arrow">&#9658;</span>
156
+ <?php
157
+ esc_html_e(
158
+ 'How do you manage requests from individuals regarding their data?',
159
+ 'simple-share-buttons-adder'
160
+ );
161
+ ?>
162
+ </div>
163
+ <div class="accor-content">
164
+ <div class="well">
165
+ <?php
166
+ esc_html_e(
167
+ 'For consumers who wish not to have their data processed, or to request withdrawal of consent or deletion of data, our existing opt-out procedure can be found on our',
168
+ 'simple-share-buttons-adder'
169
+ );
170
+ ?>
171
+ <a href="https://www.sharethis.com/privacy/" target="_blank">
172
+ <?php esc_html_e( 'privacy page', 'simple-share-buttons-adder' ); ?>
173
+ </a>
174
+ <?php
175
+ esc_html_e(
176
+ '&nbsp;or emailed to&nbsp;',
177
+ 'simple-share-buttons-adder'
178
+ );
179
+ ?>
180
+ <a href="mailto:privacy@sharethis.com">privacy@sharethis.com</a>.
181
+ </div>
182
+ </div>
183
+ </div>
184
+ <div class="accor-wrap">
185
+ <div class="accor-tab">
186
+ <span class="accor-arrow">&#9658;</span>
187
+ <?php
188
+ esc_html_e(
189
+ 'How long can you keep personal data?',
190
+ 'simple-share-buttons-adder'
191
+ );
192
+ ?>
193
+ </div>
194
+ <div class="accor-content">
195
+ <div class="well">
196
+ <?php
197
+ esc_html_e(
198
+ '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.',
199
+ 'simple-share-buttons-adder'
200
+ );
201
+ ?>
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
209
+ esc_html_e(
210
+ 'What do I need to do to comply with GDPR?',
211
+ 'simple-share-buttons-adder'
212
+ );
213
+ ?>
214
+ </div>
215
+ <div class="accor-content">
216
+ <div class="well">
217
+ <?php
218
+ esc_html_e(
219
+ '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:',
220
+ 'simple-share-buttons-adder'
221
+ );
222
+ ?>
223
 
224
+ <ul class="bullets max-width">
225
+ <li>
226
+ <?php
227
+ esc_html_e(
228
+ '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.',
229
+ 'simple-share-buttons-adder'
230
+ );
231
+ ?>
232
+ </li>
233
+ <li>
234
+ <?php
235
+ esc_html_e(
236
+ 'To receive consented data, we expect our publishers to have a GDPR compliant consent mechanism of choice on their website.',
237
+ 'simple-share-buttons-adder'
238
+ );
239
+ ?>
240
+ </li>
241
+ <li>
242
+ <?php
243
+ esc_html_e(
244
+ 'ShareThis 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.',
245
+ 'simple-share-buttons-adder'
246
+ );
247
+ ?>
248
+ </li>
249
+ </ul>
250
+ </div>
251
+ </div>
252
+ </div>
253
+ <div class="accor-wrap">
254
+ <div class="accor-tab">
255
+ <span class="accor-arrow">&#9658;</span>
256
+ <?php
257
+ esc_html_e(
258
+ 'If I choose to show the tool to people only in the EU, how can I check to make sure it’s working?',
259
+ 'simple-share-buttons-adder'
260
+ );
261
+ ?>
262
+ </div>
263
+ <div class="accor-content">
264
+ <div class="well">
265
+ <?php
266
+ esc_html_e(
267
+ 'There are many free and paid VPN services that you can use to check the appearance of your site in other geographic regions.',
268
+ 'simple-share-buttons-adder'
269
+ );
270
+ ?>
271
+ </div>
272
+ </div>
273
+ </div>
274
+ <div class="accor-wrap">
275
+ <div class="accor-tab">
276
+ <span class="accor-arrow">&#9658;</span>
277
+ <?php
278
+ esc_html_e(
279
+ 'If I use the Compliance Tool am I compliant with GDPR?',
280
+ 'simple-share-buttons-adder'
281
+ );
282
+ ?>
283
+ </div>
284
+ <div class="accor-content">
285
+ <div class="well">
286
+ <?php
287
+ esc_html_e(
288
+ '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.',
289
+ 'simple-share-buttons-adder'
290
+ );
291
+ ?>
292
+ </div>
293
+ </div>
294
+ </div>
295
  </div>
templates/config/gdpr/purposes.php CHANGED
@@ -1,189 +1,216 @@
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>
1
  <?php
2
  /**
3
  * Purposes display for gdpr config.
4
+ *
5
+ * @package SimpleShareButtonsAdder
6
  */
7
+
8
  ?>
9
  <label>
10
+ <?php echo esc_html__( 'WHY ARE YOU COLLECTING CUSTOMER DATA?', 'simple-share-buttons-adder' ); ?>
11
  </label>
12
 
13
  <div id="publisher-purpose" class="switch">
14
+ <div class="empty-choices col-md-12">
15
+ <a id="see-st-choices" class="st-rc-link medium-btn col-md-6" href="#">
16
+ <?php esc_html_e( 'See Suggested Choices', 'simple-share-buttons-adder' ); ?>
17
+ </a>
18
+ <a id="clear-choices" class="st-rc-link medium-btn col-md-6" href="#">
19
+ <?php esc_html_e( 'Clear Choices', 'simple-share-buttons-adder' ); ?>
20
+ </a>
21
+ </div>
22
+ <div class="purpose-item">
23
+ <div class="title">
24
+ <?php
25
+ echo esc_html__(
26
+ '1) Store and/or access information on a device (Do you collect information on users on your site through cookies or site identifiers?)',
27
+ 'simple-share-buttons-adder'
28
+ );
29
+ ?>
30
+ </div>
31
+ <label>
32
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
33
+ <input data-id="1" type="checkbox" name="purposes[1]" value="consent" checked/>
34
+ </label>
35
+ </div>
36
+ <div class="purpose-item">
37
+ <div class="title">
38
+ <?php
39
+ echo esc_html__(
40
+ '2) Select basic ads (Do you serve ads on your site?)',
41
+ 'simple-share-buttons-adder'
42
+ );
43
+ ?>
44
+ </div>
45
+ <label>
46
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
47
+ <input data-id="2" type="radio" name="purposes[2]" value="consent"/>
48
+ <span class="lever"></span>
49
+ </label>
50
+ <label>
51
+ <?php echo esc_html__( 'Legitimate Interest', 'simple-share-buttons-adder' ); ?>
52
+ <input data-id="2" type="radio" name="purposes[2]" value="legitimate"/>
53
+ <span class="lever"></span>
54
+ </label>
55
+ </div>
56
+ <div class="purpose-item">
57
+ <div class="title">
58
+ <?php
59
+ echo esc_html__(
60
+ '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)?)',
61
+ 'simple-share-buttons-adder'
62
+ );
63
+ ?>
64
+ </div>
65
+ <label>
66
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
67
+ <input data-id="3" type="radio" name="purposes[3]" value="consent" checked/>
68
+ <span class="lever"></span>
69
+ </label>
70
+ <label>
71
+ <?php echo esc_html__( 'Legitimate Interest', 'simple-share-buttons-adder' ); ?>
72
+ <input data-id="3" type="radio" name="purposes[3]" value="legitimate"/>
73
+ <span class="lever"></span>
74
+ </label>
75
+ </div>
76
+ <div class="purpose-item">
77
+ <div class="title">
78
+ <?php
79
+ echo esc_html__(
80
+ '4) Select personalised ads (Do you show ads to users based on this user profile)',
81
+ 'simple-share-buttons-adder'
82
+ );
83
+ ?>
84
+ </div>
85
+ <label>
86
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
87
+ <input data-id="4" type="radio" name="purposes[4]" value="consent"/>
88
+ <span class="lever"></span>
89
+ </label>
90
+ <label>
91
+ <?php echo esc_html__( 'Legitimate Interest', 'simple-share-buttons-adder' ); ?>
92
+ <input data-id="4" type="radio" name="purposes[4]" value="legitimate"/>
93
+ <span class="lever"></span>
94
+ </label>
95
+ </div>
96
+ <div class="purpose-item">
97
+ <div class="title">
98
+ <?php
99
+ echo esc_html__(
100
+ '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?)',
101
+ 'simple-share-buttons-adder'
102
+ );
103
+ ?>
104
+ </div>
105
+ <label>
106
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
107
+ <input data-id="5" type="radio" name="purposes[5]" value="consent" checked />
108
+ <span class="lever"></span>
109
+ </label>
110
+ <label>
111
+ <?php echo esc_html__( 'Legitimate Interest', 'simple-share-buttons-adder' ); ?>
112
+ <input data-id="5" type="radio" name="purposes[5]" value="legitimate"/>
113
+ <span class="lever"></span>
114
+ </label>
115
+ </div>
116
+ <div class="purpose-item">
117
+ <div class="title">
118
+ <?php
119
+ echo esc_html__(
120
+ '6) Select personalised content (Do you serve content to the user on your site based on your recorded content interests)',
121
+ 'simple-share-buttons-adder'
122
+ );
123
+ ?>
124
+ </div>
125
+ <label>
126
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
127
+ <input data-id="6" type="radio" name="purposes[6]" value="consent" checked />
128
+ <span class="lever"></span>
129
+ </label>
130
+ <label>
131
+ <?php echo esc_html__( 'Legitimate Interest', 'simple-share-buttons-adder' ); ?>
132
+ <input data-id="6" type="radio" name="purposes[6]" value="legitimate"/>
133
+ <span class="lever"></span>
134
+ </label>
135
+ </div>
136
+ <div class="purpose-item">
137
+ <div class="title">
138
+ <?php
139
+ echo esc_html__(
140
+ '7) Measure ad performance (Do you measure the performance of advertisements on your site)',
141
+ 'simple-share-buttons-adder'
142
+ );
143
+ ?>
144
+ </div>
145
+ <label>
146
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
147
+ <input data-id="7" type="radio" name="purposes[7]" value="consent"/>
148
+ <span class="lever"></span>
149
+ </label>
150
+ <label>
151
+ <?php echo esc_html__( 'Legitimate Interest', 'simple-share-buttons-adder' ); ?>
152
+ <input data-id="7" type="radio" name="purposes[7]" value="legitimate"/>
153
+ <span class="lever"></span>
154
+ </label>
155
+ </div>
156
+ <div class="purpose-item">
157
+ <div class="title">
158
+ <?php
159
+ echo esc_html__(
160
+ '8) Measure content performance (Do you measure the performance of content served to your site visitors?)',
161
+ 'simple-share-buttons-adder'
162
+ );
163
+ ?>
164
+ </div>
165
+ <label>
166
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
167
+ <input data-id="8" type="radio" name="purposes[8]" value="consent"/>
168
+ <span class="lever"></span>
169
+ </label>
170
+ <label>
171
+ <?php echo esc_html__( 'Legitimate Interest', 'simple-share-buttons-adder' ); ?>
172
+ <input data-id="8" type="radio" name="purposes[8]" value="legitimate"/>
173
+ <span class="lever"></span>
174
+ </label>
175
+ </div>
176
+ <div class="purpose-item">
177
+ <div class="title">
178
+ <?php
179
+ echo esc_html__(
180
+ '9) Apply market research to generate audience insights (Do you aggregate reporting on the ads or content show to your site visitors to advertisers)',
181
+ 'simple-share-buttons-adder'
182
+ );
183
+ ?>
184
+ </div>
185
+ <label>
186
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
187
+ <input data-id="9" type="radio" name="purposes[9]" value="consent"/>
188
+ <span class="lever"></span>
189
+ </label>
190
+ <label>
191
+ <?php echo esc_html__( 'Legitimate Interest', 'simple-share-buttons-adder' ); ?>
192
+ <input data-id="9" type="radio" name="purposes[9]" value="legitimate" checked />
193
+ <span class="lever"></span>
194
+ </label>
195
+ </div>
196
+ <div class="purpose-item">
197
+ <div class="title">
198
+ <?php
199
+ echo esc_html__(
200
+ '10) Develop and improve products (Do you use data collected on your site visitors to improve your systems or software or create new products?)',
201
+ 'simple-share-buttons-adder'
202
+ );
203
+ ?>
204
+ </div>
205
+ <label>
206
+ <?php echo esc_html__( 'Consent', 'simple-share-buttons-adder' ); ?>
207
+ <input data-id="10" type="radio" name="purposes[10]" value="consent"/>
208
+ <span class="lever"></span>
209
+ </label>
210
+ <label>
211
+ <?php echo esc_html__( 'Legitimate Interest', 'simple-share-buttons-adder' ); ?>
212
+ <input data-id="10" type="radio" name="purposes[10]" value="legitimate" checked/>
213
+ <span class="lever"></span>
214
+ </label>
215
+ </div>
216
  </div>
templates/config/gdpr/register.php CHANGED
@@ -1,39 +1,44 @@
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>
1
  <?php
2
  /**
3
  * Create account section of GDPR tab.
4
+ *
5
+ * @package SimpleShareButtonsAdder
6
  */
7
 
8
  ?>
9
  <h3>
10
+ <?php echo esc_html__( 'Create an account', 'sharethis-custom' ); ?>
11
  </h3>
12
 
13
  <div class="sharethis-account-creation">
14
+ <div class="page-content" data-size="small" style="text-align: left;">
15
+ <div class="input">
16
+ <input type="text" id="st-email" name="email" placeholder="john@acme.com">
17
+ </div>
18
+ <div class="input " style="margin-bottom: 10px;">
19
+ <input type="password" id="st-password" name="password" minlength="6"
20
+ placeholder="Create a password">
21
+ </div>
22
+ <div style="margin: 20px 0 50px;" class="item gdpr-check">
23
+ <input id="email-enabled" type="checkbox"/>
24
+ <label class="gdpr">
25
+ <?php echo esc_html__( 'Subscribe to our monthly newsletter for tips and trends to grow your site.', 'sharethis-custom' ); ?>
26
+ </label>
27
+ </div>
28
+ </div>
29
+ <div class="sharethis-login-message">
30
+ <p style="font-size:.9rem;">
31
+ <?php echo esc_html__( 'By clicking "Register," you certify that you are agreeing to our', 'sharethis-custom' ); ?>
32
+ <a href="/privacy/" target="_blank" rel="nofollow">
33
+ <?php esc_html_e( 'Privacy Policy', 'simple-share-buttons-adder' ); ?></a>
34
+ <?php esc_html_e( 'and', 'simple-share-buttons-adder' ); ?> <a
35
+ href="/publisher-terms-of-use/" target="_blank" rel="nofollow">
36
+ <?php esc_html_e( 'Terms of Service', 'simple-share-buttons-adder' ); ?></a>
37
+ <?php esc_html_e( 'for Publishers', 'simple-share-buttons-adder' ); ?>.
38
+ </p>
39
+ </div>
40
 
41
+ <a class="create-account st-rc-link medium-btn" href="#">
42
+ <?php esc_html_e( 'Register', 'sharethis' ); ?>
43
+ </a>
44
  </div>
templates/gdpr-tab.php CHANGED
@@ -7,29 +7,38 @@
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>
7
  * @package SimpleShareButtonsAdder
8
  */
9
 
10
+ $propertyid = get_option( 'ssba_property_id' );
11
+ $ssba_settings = get_option( 'ssba_settings', true );
12
+ $gdpr_config = true === isset( $ssba_settings['ssba_gdpr_config'] ) ? $ssba_settings['ssba_gdpr_config'] : array();
13
+
14
+ if ( false === is_array( $gdpr_config ) ) {
15
+ $gdpr_config = array(
16
+ 'enabled' => false,
17
+ 'color' => '',
18
+ 'display' => '',
19
+ 'language' => '',
20
+ 'publisher_name' => '',
21
+ );
22
+ }
23
+
24
  ?>
25
+ <div class="tab-pane gdpr-platform fade <?php echo 'active' === $gdpr ? esc_attr( $gdpr . ' in' ) : ''; ?>" id="gdpr">
26
+ <div class="col-sm-12 ssba-tab-container">
27
+ <?php if ( empty( $propertyid ) ) : ?>
28
+ <div class="gdpr-landing">
29
+ <?php include plugin_dir_path( __FILE__ ) . 'config/gdpr/landing.php'; ?>
30
+ </div>
31
+ <div style="display:none;" class="gdpr-register">
32
+ <?php include plugin_dir_path( __FILE__ ) . 'config/gdpr/register.php'; ?>
33
+ </div>
34
+ <?php endif; ?>
35
+ <div
36
+ <?php if ( empty( $propertyid ) ) : ?>
37
+ style="display:none;"
38
+ <?php endif; ?>
39
+ class="gdpr-config"
40
+ >
41
+ <?php require plugin_dir_path( __FILE__ ) . 'config/gdpr/config.php'; ?>
42
+ </div>
43
+ </div>
44
  </div>
templates/plus-tab.php CHANGED
@@ -8,9 +8,9 @@
8
  */
9
 
10
  ?>
11
- <div class="tab-pane fade <?php echo 'active' === $modern ? esc_attr( $modern . ' in' ): ''; ?>" id="plus-share-buttons">
12
  <div class="col-sm-12 ssba-tab-container">
13
- <?php echo $this->forms->ssbp_input( $opts43 ); // WPCS: XSS ok. ?>
14
 
15
  <blockquote>
16
  <p>
@@ -33,19 +33,23 @@
33
  </div>
34
 
35
  <ul class="ssbp-list">
36
- <?php if ( is_array( $arr_plus_buttons ) ) : ?>
37
- <?php foreach ( $arr_plus_buttons as $buttons ) :
38
- $button = strtolower( str_replace( ' ', '_', str_replace( '+', '', $buttons['full_name'] ) ) ); ?>
 
 
39
 
40
- <li style="margin-left: <?php echo esc_attr( $arr_settings['ssba_plus_margin'] ); ?>px;" class="ssbp-li--<?php echo esc_attr( $button );
41
- if ( ! in_array( $button, explode( ',', $arr_settings['ssba_selected_plus_buttons'] ), true ) ) {
42
- echo esc_attr( ' ssba-hide-button' );
43
- }
44
- ?>">
 
 
45
  <a href="#" class="ssbp-btn ssbp-<?php echo esc_attr( $button ); ?>" style="height: <?php echo esc_attr( $arr_settings['ssba_plus_height'] ); ?>px; width: <?php echo esc_attr( $arr_settings['ssba_plus_width'] ); ?>px; <?php echo '' !== $arr_settings['ssba_plus_button_color'] ? esc_attr( 'background: ' . $arr_settings['ssba_plus_button_color'] . ';' ) : ''; ?>"><div title="<?php echo esc_attr( $buttons['full_name'] ); ?>" class="ssbp-text"><?php echo esc_html( $buttons['full_name'] ); ?></div></a>
46
  <span class="<?php echo 'Y' !== $arr_settings['ssba_plus_show_share_count'] ? esc_attr( 'ssba-hide-button' ) : ''; ?> ssbp-each-share">1.8k</span>
47
  </li>
48
- <?php endforeach; ?>
49
  <?php endif; ?>
50
  </ul>
51
  </div>
@@ -86,9 +90,9 @@
86
  <input type="hidden" name="ssba_selected_plus_buttons" id="ssba_selected_plus_buttons" value="<?php esc_attr( $arr_settings['ssba_selected_plus_buttons'] ); ?>"/>
87
 
88
  <?php
89
- echo $this->forms->ssbp_checkboxes( $opts48 ); // WPCS: XSS ok.
90
- echo $this->forms->ssbp_input( $opts49 ); // WPCS: XSS ok.
91
- echo $this->forms->ssbp_input( $page_omit_plus ); // WPCS: XSS ok.
92
  ?>
93
 
94
  <div class="accor-wrap">
@@ -103,10 +107,10 @@
103
  </div>
104
 
105
  <div class="col-md-6">
106
- <?php echo $this->forms->ssbp_input( $opts44 ); // WPCS: XSS ok. ?>
107
  </div>
108
  <div class="col-md-6">
109
- <?php echo $this->forms->ssbp_input( $opts7p ); // WPCS: XSS ok. ?>
110
  </div>
111
 
112
  <div class="col-md-12">
@@ -114,12 +118,12 @@
114
  </div>
115
 
116
  <div class="col-md-6">
117
- <?php echo $this->forms->ssbp_input( $plus_height ); // WPCS: XSS ok. ?>
118
- <?php echo $this->forms->ssbp_input( $plus_width ); // WPCS: XSS ok. ?>
119
  </div>
120
  <div class="col-md-6">
121
- <?php echo $this->forms->ssbp_input( $plus_icon_size ); // WPCS: XSS ok. ?>
122
- <?php echo $this->forms->ssbp_input( $plus_margin ); // WPCS: XSS ok. ?>
123
  </div>
124
 
125
  <div class="col-md-12">
@@ -127,12 +131,12 @@
127
  </div>
128
 
129
  <div class="col-md-6">
130
- <?php echo $this->forms->ssbp_input( $plus_button_color ); // WPCS: XSS ok. ?>
131
- <?php echo $this->forms->ssbp_input( $plus_hover_color ); // WPCS: XSS ok. ?>
132
  </div>
133
  <div class="col-md-6">
134
- <?php echo $this->forms->ssbp_input( $plus_icon_color ); // WPCS: XSS ok. ?>
135
- <?php echo $this->forms->ssbp_input( $plus_icon_hover_color ); // WPCS: XSS ok. ?>
136
  </div>
137
 
138
  <div class="col-md-12">
@@ -140,16 +144,16 @@
140
  </div>
141
  <div class="col-md-6 share-text-prev">
142
  <?php
143
- echo $this->forms->ssbp_input( $opts3p ); // WPCS: XSS ok.
144
- echo $this->forms->ssbp_input( $opts10p ); // WPCS: XSS ok.
145
- echo $this->forms->ssbp_input( $opts11p ); // WPCS: XSS ok.
146
  ?>
147
  </div>
148
  <div class="col-md-6 share-text-prev">
149
  <?php
150
- echo $this->forms->ssbp_input( $opts12p ); // WPCS: XSS ok.
151
- echo $this->forms->ssbp_input( $opts13p ); // WPCS: XSS ok.
152
- echo $this->forms->ssbp_input( $opts9p ); // WPCS: XSS ok.
153
  ?>
154
  </div>
155
  </div>
@@ -168,8 +172,8 @@
168
 
169
  <div class="col-md-12 share-count-prev">
170
  <?php
171
- echo $this->forms->ssbp_input( $opts19p ); // WPCS: XSS ok.
172
- echo $this->forms->ssbp_input( $opts20p ); // WPCS: XSS ok.
173
  ?>
174
  </div>
175
  </div>
@@ -188,18 +192,18 @@
188
 
189
  <div class="col-md-12">
190
  <?php
191
- echo $this->forms->ssbp_input( $opts26p ); // WPCS: XSS ok.
192
- echo $this->forms->ssbp_input( $opts28p ); // WPCS: XSS ok.
193
- echo $this->forms->ssbp_input( $opts29p ); // WPCS: XSS ok.
194
  ?>
195
  </div>
196
 
197
  <div class="col-md-6">
198
- <?php echo $this->forms->ssbp_input( $opts30p ); // WPCS: XSS ok. ?>
199
  </div>
200
 
201
  <div class="col-md-6">
202
- <?php echo $this->forms->ssbp_input( $opts31p ); // WPCS: XSS ok. ?>
203
  </div>
204
 
205
  <div class="col-md-12">
@@ -207,11 +211,11 @@
207
  </div>
208
 
209
  <div class="col-md-12">
210
- <?php echo $this->forms->ssbp_input( $opts33p ); // WPCS: XSS ok.?>
211
  </div>
212
 
213
  <div class="col-md-12">
214
- <?php echo $this->forms->ssbp_input( $plus_ignore_sdk ); // WPCS: XSS ok.?>
215
  </div>
216
 
217
  <div class="col-md-12">
@@ -219,26 +223,26 @@
219
  </div>
220
 
221
  <div class="col-md-12">
222
- <?php echo $this->forms->ssbp_input( $opts32p ); // WPCS: XSS ok. ?>
223
  </div>
224
 
225
  <div class="col-md-6">
226
  <?php
227
- echo $this->forms->ssbp_input( $opts34p ); // WPCS: XSS ok.
228
- echo $this->forms->ssbp_input( $opts37p ); // WPCS: XSS ok.
229
  ?>
230
  </div>
231
  <div class="col-md-6">
232
  <?php
233
- echo $this->forms->ssbp_input( $opts35p ); // WPCS: XSS ok.
234
- echo $this->forms->ssbp_input( $opts36p ); // WPCS: XSS ok.
235
  ?>
236
  </div>
237
 
238
  <div class="col-md-12">
239
  <?php
240
- echo $this->forms->ssbp_input( $opts38p ); // WPCS: XSS ok.
241
- echo $this->forms->ssbp_input( $opts39p ); // WPCS: XSS ok.
242
  ?>
243
  </div>
244
  </div>
@@ -262,7 +266,7 @@
262
  </div>
263
 
264
  <div class="col-sm-12">
265
- <?php echo $this->forms->ssbp_input( $opts40p ); // WPCS: XSS ok. ?>
266
  </div>
267
  </div>
268
  </div>
8
  */
9
 
10
  ?>
11
+ <div class="tab-pane fade <?php echo 'active' === $modern ? esc_attr( $modern . ' in' ) : ''; ?>" id="plus-share-buttons">
12
  <div class="col-sm-12 ssba-tab-container">
13
+ <?php echo $this->forms->ssbp_input( $opts43 ); // phpcs:ignore ?>
14
 
15
  <blockquote>
16
  <p>
33
  </div>
34
 
35
  <ul class="ssbp-list">
36
+ <?php if ( true === is_array( $arr_plus_buttons ) ) : ?>
37
+ <?php
38
+ foreach ( $arr_plus_buttons as $buttons ) :
39
+ $button = strtolower( str_replace( ' ', '_', str_replace( '+', '', $buttons['full_name'] ) ) );
40
+ ?>
41
 
42
+ <li style="margin-left: <?php echo esc_attr( $arr_settings['ssba_plus_margin'] ); ?>px;" class="ssbp-li--<?php echo esc_attr( $button ); ?>
43
+ <?php
44
+ if ( false === in_array( $button, explode( ',', $arr_settings['ssba_selected_plus_buttons'] ), true ) ) {
45
+ echo esc_attr( ' ssba-hide-button' );
46
+ }
47
+ ?>
48
+ ">
49
  <a href="#" class="ssbp-btn ssbp-<?php echo esc_attr( $button ); ?>" style="height: <?php echo esc_attr( $arr_settings['ssba_plus_height'] ); ?>px; width: <?php echo esc_attr( $arr_settings['ssba_plus_width'] ); ?>px; <?php echo '' !== $arr_settings['ssba_plus_button_color'] ? esc_attr( 'background: ' . $arr_settings['ssba_plus_button_color'] . ';' ) : ''; ?>"><div title="<?php echo esc_attr( $buttons['full_name'] ); ?>" class="ssbp-text"><?php echo esc_html( $buttons['full_name'] ); ?></div></a>
50
  <span class="<?php echo 'Y' !== $arr_settings['ssba_plus_show_share_count'] ? esc_attr( 'ssba-hide-button' ) : ''; ?> ssbp-each-share">1.8k</span>
51
  </li>
52
+ <?php endforeach; ?>
53
  <?php endif; ?>
54
  </ul>
55
  </div>
90
  <input type="hidden" name="ssba_selected_plus_buttons" id="ssba_selected_plus_buttons" value="<?php esc_attr( $arr_settings['ssba_selected_plus_buttons'] ); ?>"/>
91
 
92
  <?php
93
+ echo $this->forms->ssbp_checkboxes( $opts48 ); // phpcs:ignore
94
+ echo $this->forms->ssbp_input( $opts49 ); // phpcs:ignore
95
+ echo $this->forms->ssbp_input( $page_omit_plus ); // phpcs:ignore
96
  ?>
97
 
98
  <div class="accor-wrap">
107
  </div>
108
 
109
  <div class="col-md-6">
110
+ <?php echo $this->forms->ssbp_input( $opts44 ); // phpcs:ignore ?>
111
  </div>
112
  <div class="col-md-6">
113
+ <?php echo $this->forms->ssbp_input( $opts7p ); // phpcs:ignore ?>
114
  </div>
115
 
116
  <div class="col-md-12">
118
  </div>
119
 
120
  <div class="col-md-6">
121
+ <?php echo $this->forms->ssbp_input( $plus_height ); // phpcs:ignore ?>
122
+ <?php echo $this->forms->ssbp_input( $plus_width ); // phpcs:ignore ?>
123
  </div>
124
  <div class="col-md-6">
125
+ <?php echo $this->forms->ssbp_input( $plus_icon_size ); // phpcs:ignore ?>
126
+ <?php echo $this->forms->ssbp_input( $plus_margin ); // phpcs:ignore ?>
127
  </div>
128
 
129
  <div class="col-md-12">
131
  </div>
132
 
133
  <div class="col-md-6">
134
+ <?php echo $this->forms->ssbp_input( $plus_button_color ); // phpcs:ignore ?>
135
+ <?php echo $this->forms->ssbp_input( $plus_hover_color ); // phpcs:ignore ?>
136
  </div>
137
  <div class="col-md-6">
138
+ <?php echo $this->forms->ssbp_input( $plus_icon_color ); // phpcs:ignore ?>
139
+ <?php echo $this->forms->ssbp_input( $plus_icon_hover_color ); // phpcs:ignore ?>
140
  </div>
141
 
142
  <div class="col-md-12">
144
  </div>
145
  <div class="col-md-6 share-text-prev">
146
  <?php
147
+ echo $this->forms->ssbp_input( $opts3p ); // phpcs:ignore
148
+ echo $this->forms->ssbp_input( $opts10p ); // phpcs:ignore
149
+ echo $this->forms->ssbp_input( $opts11p ); // phpcs:ignore
150
  ?>
151
  </div>
152
  <div class="col-md-6 share-text-prev">
153
  <?php
154
+ echo $this->forms->ssbp_input( $opts12p ); // phpcs:ignore
155
+ echo $this->forms->ssbp_input( $opts13p ); // phpcs:ignore
156
+ echo $this->forms->ssbp_input( $opts9p ); // phpcs:ignore
157
  ?>
158
  </div>
159
  </div>
172
 
173
  <div class="col-md-12 share-count-prev">
174
  <?php
175
+ echo $this->forms->ssbp_input( $opts19p ); // phpcs:ignore
176
+ echo $this->forms->ssbp_input( $opts20p ); // phpcs:ignore
177
  ?>
178
  </div>
179
  </div>
192
 
193
  <div class="col-md-12">
194
  <?php
195
+ echo $this->forms->ssbp_input( $opts26p ); // phpcs:ignore
196
+ echo $this->forms->ssbp_input( $opts28p ); // phpcs:ignore
197
+ echo $this->forms->ssbp_input( $opts29p ); // phpcs:ignore
198
  ?>
199
  </div>
200
 
201
  <div class="col-md-6">
202
+ <?php echo $this->forms->ssbp_input( $opts30p ); // phpcs:ignore ?>
203
  </div>
204
 
205
  <div class="col-md-6">
206
+ <?php echo $this->forms->ssbp_input( $opts31p ); // phpcs:ignore ?>
207
  </div>
208
 
209
  <div class="col-md-12">
211
  </div>
212
 
213
  <div class="col-md-12">
214
+ <?php echo $this->forms->ssbp_input( $opts33p ); // phpcs:ignore ?>
215
  </div>
216
 
217
  <div class="col-md-12">
218
+ <?php echo $this->forms->ssbp_input( $plus_ignore_sdk ); // phpcs:ignore ?>
219
  </div>
220
 
221
  <div class="col-md-12">
223
  </div>
224
 
225
  <div class="col-md-12">
226
+ <?php echo $this->forms->ssbp_input( $opts32p ); // phpcs:ignore ?>
227
  </div>
228
 
229
  <div class="col-md-6">
230
  <?php
231
+ echo $this->forms->ssbp_input( $opts34p ); // phpcs:ignore
232
+ echo $this->forms->ssbp_input( $opts37p ); // phpcs:ignore
233
  ?>
234
  </div>
235
  <div class="col-md-6">
236
  <?php
237
+ echo $this->forms->ssbp_input( $opts35p ); // phpcs:ignore
238
+ echo $this->forms->ssbp_input( $opts36p ); // phpcs:ignore
239
  ?>
240
  </div>
241
 
242
  <div class="col-md-12">
243
  <?php
244
+ echo $this->forms->ssbp_input( $opts38p ); // phpcs:ignore
245
+ echo $this->forms->ssbp_input( $opts39p ); // phpcs:ignore
246
  ?>
247
  </div>
248
  </div>
266
  </div>
267
 
268
  <div class="col-sm-12">
269
+ <?php echo $this->forms->ssbp_input( $opts40p ); // phpcs:ignore ?>
270
  </div>
271
  </div>
272
  </div>
templates/share-bar-tab.php CHANGED
@@ -4,13 +4,15 @@
4
  *
5
  * The template wrapper for the share bar tab.
6
  *
 
 
7
  * @package SimpleShareButtonsAdder
8
  */
9
 
10
  ?>
11
- <div class="tab-pane fade <?php echo 'active' === $bar ? esc_attr( $bar . ' in' ): ''; ?>" id="share-bar">
12
  <div class="col-sm-12 ssba-tab-container">
13
- <?php echo $this->forms->ssbp_input( $share_bar ); // WPCS: XSS ok. ?>
14
 
15
  <blockquote>
16
  <p>
@@ -24,12 +26,21 @@
24
  <div class="ssbp-wrap ssbp--centred ssbp--theme-4">
25
  <div class="ssbp-container">
26
  <ul id="ssbasort3" class="ssbp-list ssbaSortable">
27
- <?php $arr_settings = array_merge( $arr_settings, array(
28
- 'bar_call' => 'Y',
 
 
 
29
  )
30
  );
31
 
32
- echo wp_kses_post( $this->get_available_ssba( $arr_settings['ssba_selected_bar_buttons'], $arr_settings ) ); ?>
 
 
 
 
 
 
33
  </ul>
34
  </div>
35
  </div>
@@ -60,13 +71,17 @@
60
  <div class="ssbp-container">
61
  <ul class="ssbp-list">
62
  <?php if ( is_array( $arr_bar_buttons ) ) : ?>
63
- <?php foreach ( $arr_bar_buttons as $buttons ) :
64
- $button = strtolower( str_replace( ' ', '_', str_replace( '+', '', $buttons['full_name'] ) ) ); ?>
65
- <li style="margin: <?php echo esc_attr( $arr_settings['ssba_bar_margin'] ); ?>px 0;" class="ssbp-li--<?php echo esc_attr( $button );
66
- if ( ! in_array( $button, explode( ',', $arr_settings['ssba_selected_bar_buttons'] ), true ) ) {
67
- echo esc_attr( ' ssba-hide-button' );
68
- }
69
- ?>">
 
 
 
 
70
  <a href="#" class="ssbp-btn ssbp-<?php echo esc_attr( $button ); ?>" style="height: <?php echo esc_attr( $arr_settings['ssba_bar_height'] ); ?>px; width: <?php echo esc_attr( $arr_settings['ssba_bar_width'] ); ?>px; <?php echo '' !== $arr_settings['ssba_bar_button_color'] ? esc_attr( 'background: ' . $arr_settings['ssba_bar_button_color'] . ';' ) : ''; ?>">
71
  <div title="<?php echo esc_attr( $buttons['full_name'] ); ?>" class="ssbp-text">
72
  <?php echo esc_html( $buttons['full_name'] ); ?>
@@ -74,15 +89,15 @@
74
  </a>
75
  <span class="<?php echo 'Y' !== $arr_settings['ssba_bar_show_share_count'] ? esc_attr( 'ssba-hide-button' ) : ''; ?> ssbp-each-share">1.8k</span>
76
  </li>
77
- <?php endforeach; ?>
78
  <?php endif; ?>
79
  </ul>
80
  </div>
81
  </div>
82
  <?php
83
- echo $this->forms->ssbp_checkboxes( $opts45 ); // WPCS: XSS ok.
84
- echo $this->forms->ssbp_checkboxes( $share_bar_display ); // WPCS: XSS ok.
85
- echo $this->forms->ssbp_input( $page_omit_bar ); // WPCS: XSS ok.
86
  ?>
87
  <div class="accor-wrap">
88
  <div class="accor-tab">
@@ -96,14 +111,14 @@
96
  </div>
97
 
98
  <div class="col-md-6">
99
- <?php echo $this->forms->ssbp_input( $opts46 ); // WPCS: XSS ok. ?>
100
  </div>
101
  <div class="col-md-6">
102
- <?php echo $this->forms->ssbp_input( $opts47 ); // WPCS: XSS ok. ?>
103
  </div>
104
 
105
  <div class="col-md-12">
106
- <?php echo $this->forms->ssbp_input( $mobile_breakpoint ); // WPCS: XSS ok. ?>
107
  </div>
108
 
109
  <div class="col-md-12">
@@ -111,12 +126,12 @@
111
  </div>
112
 
113
  <div class="col-md-6">
114
- <?php echo $this->forms->ssbp_input( $share_height ); // WPCS: XSS ok. ?>
115
- <?php echo $this->forms->ssbp_input( $share_width ); // WPCS: XSS ok. ?>
116
  </div>
117
  <div class="col-md-6">
118
- <?php echo $this->forms->ssbp_input( $share_icon_size ); // WPCS: XSS ok. ?>
119
- <?php echo $this->forms->ssbp_input( $share_margin ); // WPCS: XSS ok. ?>
120
  </div>
121
 
122
  <div class="col-md-12">
@@ -124,12 +139,12 @@
124
  </div>
125
 
126
  <div class="col-md-6">
127
- <?php echo $this->forms->ssbp_input( $share_button_color ); // WPCS: XSS ok. ?>
128
- <?php echo $this->forms->ssbp_input( $share_hover_color ); // WPCS: XSS ok. ?>
129
  </div>
130
  <div class="col-md-6">
131
- <?php echo $this->forms->ssbp_input( $share_icon_color ); // WPCS: XSS ok. ?>
132
- <?php echo $this->forms->ssbp_input( $share_icon_hover_color ); // WPCS: XSS ok. ?>
133
  </div>
134
  </div>
135
  </div>
@@ -147,8 +162,8 @@
147
 
148
  <div class="col-md-12 share-count-prev">
149
  <?php
150
- echo $this->forms->ssbp_input( $opts19s ); // WPCS: XSS ok.
151
- echo $this->forms->ssbp_input( $opts20s ); // WPCS: XSS ok.
152
  ?>
153
  </div>
154
  </div>
@@ -167,13 +182,13 @@
167
 
168
  <div class="col-md-12">
169
  <?php
170
- echo $this->forms->ssbp_input( $opts28s ); // WPCS: XSS ok.
171
- echo $this->forms->ssbp_input( $opts29s ); // WPCS: XSS ok.
172
  ?>
173
  </div>
174
 
175
  <div class="col-md-12">
176
- <?php echo $this->forms->ssbp_input( $opts31s ); // WPCS: XSS ok. ?>
177
  </div>
178
 
179
  <div class="col-md-12">
@@ -181,7 +196,7 @@
181
  </div>
182
 
183
  <div class="col-md-12">
184
- <?php echo $this->forms->ssbp_input( $opts33s ); // WPCS: XSS ok.?>
185
  </div>
186
 
187
  <div class="col-md-12">
@@ -189,26 +204,26 @@
189
  </div>
190
 
191
  <div class="col-md-12">
192
- <?php echo $this->forms->ssbp_input( $opts32s ); // WPCS: XSS ok. ?>
193
  </div>
194
 
195
  <div class="col-md-6">
196
  <?php
197
- echo $this->forms->ssbp_input( $opts34s ); // WPCS: XSS ok.
198
- echo $this->forms->ssbp_input( $opts37s ); // WPCS: XSS ok.
199
  ?>
200
  </div>
201
  <div class="col-md-6">
202
  <?php
203
- echo $this->forms->ssbp_input( $opts35s ); // WPCS: XSS ok.
204
- echo $this->forms->ssbp_input( $opts36s ); // WPCS: XSS ok.
205
  ?>
206
  </div>
207
 
208
  <div class="col-md-12">
209
  <?php
210
- echo $this->forms->ssbp_input( $opts38s ); // WPCS: XSS ok.
211
- echo $this->forms->ssbp_input( $opts39s ); // WPCS: XSS ok.
212
  ?>
213
  </div>
214
  </div>
@@ -232,7 +247,7 @@
232
  </div>
233
 
234
  <div class="col-sm-12">
235
- <?php echo $this->forms->ssbp_input( $opts40s ); // WPCS: XSS ok.?>
236
  </div>
237
  </div>
238
  </div>
4
  *
5
  * The template wrapper for the share bar tab.
6
  *
7
+ * @var \SimpleShareButtonsAdder\Admin_Panel $this Admin panel class.
8
+ *
9
  * @package SimpleShareButtonsAdder
10
  */
11
 
12
  ?>
13
+ <div class="tab-pane fade <?php echo 'active' === $bar ? esc_attr( $bar . ' in' ) : ''; ?>" id="share-bar">
14
  <div class="col-sm-12 ssba-tab-container">
15
+ <?php echo $this->forms->ssbp_input( $share_bar ); // phpcs:ignore ?>
16
 
17
  <blockquote>
18
  <p>
26
  <div class="ssbp-wrap ssbp--centred ssbp--theme-4">
27
  <div class="ssbp-container">
28
  <ul id="ssbasort3" class="ssbp-list ssbaSortable">
29
+ <?php
30
+ $arr_settings = array_merge(
31
+ $arr_settings,
32
+ array(
33
+ 'bar_call' => 'Y',
34
  )
35
  );
36
 
37
+ echo wp_kses_post(
38
+ $this->get_available_ssba(
39
+ $arr_settings['ssba_selected_bar_buttons'],
40
+ $arr_settings
41
+ )
42
+ );
43
+ ?>
44
  </ul>
45
  </div>
46
  </div>
71
  <div class="ssbp-container">
72
  <ul class="ssbp-list">
73
  <?php if ( is_array( $arr_bar_buttons ) ) : ?>
74
+ <?php
75
+ foreach ( $arr_bar_buttons as $buttons ) :
76
+ $button = strtolower( str_replace( ' ', '_', str_replace( '+', '', $buttons['full_name'] ) ) );
77
+ ?>
78
+ <li style="margin: <?php echo esc_attr( $arr_settings['ssba_bar_margin'] ); ?>px 0;" class="ssbp-li--<?php echo esc_attr( $button ); ?>
79
+ <?php
80
+ if ( false === in_array( $button, explode( ',', $arr_settings['ssba_selected_bar_buttons'] ), true ) ) {
81
+ echo esc_attr( ' ssba-hide-button' );
82
+ }
83
+ ?>
84
+ ">
85
  <a href="#" class="ssbp-btn ssbp-<?php echo esc_attr( $button ); ?>" style="height: <?php echo esc_attr( $arr_settings['ssba_bar_height'] ); ?>px; width: <?php echo esc_attr( $arr_settings['ssba_bar_width'] ); ?>px; <?php echo '' !== $arr_settings['ssba_bar_button_color'] ? esc_attr( 'background: ' . $arr_settings['ssba_bar_button_color'] . ';' ) : ''; ?>">
86
  <div title="<?php echo esc_attr( $buttons['full_name'] ); ?>" class="ssbp-text">
87
  <?php echo esc_html( $buttons['full_name'] ); ?>
89
  </a>
90
  <span class="<?php echo 'Y' !== $arr_settings['ssba_bar_show_share_count'] ? esc_attr( 'ssba-hide-button' ) : ''; ?> ssbp-each-share">1.8k</span>
91
  </li>
92
+ <?php endforeach; ?>
93
  <?php endif; ?>
94
  </ul>
95
  </div>
96
  </div>
97
  <?php
98
+ echo $this->forms->ssbp_checkboxes( $opts45 ); // phpcs:ignore
99
+ echo $this->forms->ssbp_checkboxes( $share_bar_display ); // phpcs:ignore
100
+ echo $this->forms->ssbp_input( $page_omit_bar ); // phpcs:ignore
101
  ?>
102
  <div class="accor-wrap">
103
  <div class="accor-tab">
111
  </div>
112
 
113
  <div class="col-md-6">
114
+ <?php echo $this->forms->ssbp_input( $opts46 ); // phpcs:ignore ?>
115
  </div>
116
  <div class="col-md-6">
117
+ <?php echo $this->forms->ssbp_input( $opts47 ); // phpcs:ignore ?>
118
  </div>
119
 
120
  <div class="col-md-12">
121
+ <?php echo $this->forms->ssbp_input( $mobile_breakpoint ); // phpcs:ignore ?>
122
  </div>
123
 
124
  <div class="col-md-12">
126
  </div>
127
 
128
  <div class="col-md-6">
129
+ <?php echo $this->forms->ssbp_input( $share_height ); // phpcs:ignore ?>
130
+ <?php echo $this->forms->ssbp_input( $share_width ); // phpcs:ignore ?>
131
  </div>
132
  <div class="col-md-6">
133
+ <?php echo $this->forms->ssbp_input( $share_icon_size ); // phpcs:ignore ?>
134
+ <?php echo $this->forms->ssbp_input( $share_margin ); // phpcs:ignore ?>
135
  </div>
136
 
137
  <div class="col-md-12">
139
  </div>
140
 
141
  <div class="col-md-6">
142
+ <?php echo $this->forms->ssbp_input( $share_button_color ); // phpcs:ignore ?>
143
+ <?php echo $this->forms->ssbp_input( $share_hover_color ); // phpcs:ignore ?>
144
  </div>
145
  <div class="col-md-6">
146
+ <?php echo $this->forms->ssbp_input( $share_icon_color ); // phpcs:ignore ?>
147
+ <?php echo $this->forms->ssbp_input( $share_icon_hover_color ); // phpcs:ignore ?>
148
  </div>
149
  </div>
150
  </div>
162
 
163
  <div class="col-md-12 share-count-prev">
164
  <?php
165
+ echo $this->forms->ssbp_input( $opts19s ); // phpcs:ignore
166
+ echo $this->forms->ssbp_input( $opts20s ); // phpcs:ignore
167
  ?>
168
  </div>
169
  </div>
182
 
183
  <div class="col-md-12">
184
  <?php
185
+ echo $this->forms->ssbp_input( $opts28s ); // phpcs:ignore
186
+ echo $this->forms->ssbp_input( $opts29s ); // phpcs:ignore
187
  ?>
188
  </div>
189
 
190
  <div class="col-md-12">
191
+ <?php echo $this->forms->ssbp_input( $opts31s ); // phpcs:ignore ?>
192
  </div>
193
 
194
  <div class="col-md-12">
196
  </div>
197
 
198
  <div class="col-md-12">
199
+ <?php echo $this->forms->ssbp_input( $opts33s ); // phpcs:ignore ?>
200
  </div>
201
 
202
  <div class="col-md-12">
204
  </div>
205
 
206
  <div class="col-md-12">
207
+ <?php echo $this->forms->ssbp_input( $opts32s ); // phpcs:ignore ?>
208
  </div>
209
 
210
  <div class="col-md-6">
211
  <?php
212
+ echo $this->forms->ssbp_input( $opts34s ); // phpcs:ignore
213
+ echo $this->forms->ssbp_input( $opts37s ); // phpcs:ignore
214
  ?>
215
  </div>
216
  <div class="col-md-6">
217
  <?php
218
+ echo $this->forms->ssbp_input( $opts35s ); // phpcs:ignore
219
+ echo $this->forms->ssbp_input( $opts36s ); // phpcs:ignore
220
  ?>
221
  </div>
222
 
223
  <div class="col-md-12">
224
  <?php
225
+ echo $this->forms->ssbp_input( $opts38s ); // phpcs:ignore
226
+ echo $this->forms->ssbp_input( $opts39s ); // phpcs:ignore
227
  ?>
228
  </div>
229
  </div>
247
  </div>
248
 
249
  <div class="col-sm-12">
250
+ <?php echo $this->forms->ssbp_input( $opts40s ); // phpcs:ignore ?>
251
  </div>
252
  </div>
253
  </div>