WordPress Share Buttons Plugin – AddThis - Version 5.0.5

Version Description

  • Adding all WordPress mode Advanced Options to AddThis mode Advanced Options. These are primarily options to edit the addthis_share and addthis_config JavaScript variables used by AddThis tools, as well as giving you the option to choose whether to load the AddThis script asyncronously.
  • Removing conflicts with WordPress Login Box plugin
  • Removing conflicts with AddThis Follow Widget plugin
  • CSS to remove new lines from br tags between our buttons, because some themes add them and break stuff (Thanks Customizr)
  • Exposing more objects for use with adding sharing buttons to troublesome themes
Download this release

Release Info

Developer jgrodel
Plugin Icon 128x128 WordPress Share Buttons Plugin – AddThis
Version 5.0.5
Comparing to
See all releases

Code changes from version 5.0.4 to 5.0.5

AddThisConfigs.php CHANGED
@@ -25,6 +25,7 @@ if (!class_exists('AddThisConfigs')) {
25
  protected $cmsInterface;
26
  protected $configs = null;
27
  protected $changedConfigs = false;
 
28
  protected $defaultConfigs = array(
29
  'above' => 'large_toolbox',
30
  'above_custom_more' => '',
@@ -42,20 +43,18 @@ if (!class_exists('AddThisConfigs')) {
42
  'addthis_beforecomments' => false,
43
  'addthis_below_enabled' => false,
44
  'addthis_bitly' => false,
45
- 'addthis_brand' => '',
46
  'addthis_config_json' => '',
47
- 'addthis_header_background' => '',
48
- 'addthis_header_color' => '',
49
  'addthis_language' => '',
50
  'addthis_plugin_controls' => 'AddThis',
51
  'addthis_profile' => '',
 
52
  'addthis_share_json' => '',
53
  'addthis_sidebar_count' => '5',
54
  'addthis_sidebar_enabled' => false,
55
  'addthis_sidebar_position' => 'left',
56
  'addthis_twitter_template' => '',
57
  'addthis_environment' => '',
58
- 'atversion' => ADDTHIS_ATVERSION,
59
  'atversion_update_status' => 0,
60
  'below' => 'large_toolbox',
61
  'below_custom_more' => '',
@@ -97,19 +96,56 @@ if (!class_exists('AddThisConfigs')) {
97
  return $defaultConfigs;
98
  }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  public function getConfigs() {
101
  if ($this->cmsInterface->isUpgrade()) {
102
  $this->configs = $this->cmsInterface->upgradeConfigs();
103
  }
104
 
105
  $this->configs = $this->setDefaultConfigs();
 
 
 
 
 
106
  return $this->configs;
107
  }
108
 
109
-
110
  public function saveConfigs($configs = null) {
111
  if (!is_array($this->configs)) {
112
- $this->configs = $this->getConfigs();
113
  }
114
 
115
  if (is_array($configs) && is_array($this->configs)) {
@@ -119,6 +155,12 @@ if (!class_exists('AddThisConfigs')) {
119
  }
120
 
121
  if (!is_null($this->configs)) {
 
 
 
 
 
 
122
  $this->configs = $this->cmsInterface->saveConfigs($this->configs);
123
  }
124
 
@@ -126,6 +168,18 @@ if (!class_exists('AddThisConfigs')) {
126
  return $this->configs;
127
  }
128
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  private function setDefaultConfigs() {
130
  $this->configs = $this->cmsInterface->getConfigs(true);
131
 
@@ -139,6 +193,16 @@ if (!class_exists('AddThisConfigs')) {
139
  $this->changedConfigs = true;
140
  }
141
  }
 
 
 
 
 
 
 
 
 
 
142
  }
143
 
144
  if ($this->changedConfigs) {
@@ -224,5 +288,107 @@ if (!class_exists('AddThisConfigs')) {
224
 
225
  return $this->getAnonymousProfileId();
226
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  }
228
  }
25
  protected $cmsInterface;
26
  protected $configs = null;
27
  protected $changedConfigs = false;
28
+
29
  protected $defaultConfigs = array(
30
  'above' => 'large_toolbox',
31
  'above_custom_more' => '',
43
  'addthis_beforecomments' => false,
44
  'addthis_below_enabled' => false,
45
  'addthis_bitly' => false,
 
46
  'addthis_config_json' => '',
 
 
47
  'addthis_language' => '',
48
  'addthis_plugin_controls' => 'AddThis',
49
  'addthis_profile' => '',
50
+ 'addthis_rate_us' => '',
51
  'addthis_share_json' => '',
52
  'addthis_sidebar_count' => '5',
53
  'addthis_sidebar_enabled' => false,
54
  'addthis_sidebar_position' => 'left',
55
  'addthis_twitter_template' => '',
56
  'addthis_environment' => '',
57
+ 'atversion' => 300,
58
  'atversion_update_status' => 0,
59
  'below' => 'large_toolbox',
60
  'below_custom_more' => '',
96
  return $defaultConfigs;
97
  }
98
 
99
+ public function getDefaultAddThisVersion() {
100
+ $defaultConfigs = $this->cmsInterface->getDefaultConfigs();
101
+ if (!empty($defaultConfigs['atversion'])) {
102
+ $version = $defaultConfigs['atversion'];
103
+ return $version;
104
+ }
105
+
106
+ $defaultConfigs = $this->getDefaultConfigs();
107
+ if (!empty($defaultConfigs['atversion'])) {
108
+ $version = $defaultConfigs['atversion'];
109
+ return $version;
110
+ }
111
+
112
+ return false;
113
+ }
114
+
115
+ public function getAddThisVersion() {
116
+ if (!is_array($this->configs)) {
117
+ $this->getConfigs();
118
+ }
119
+
120
+ if ( isset($this->configs['atversion_update_status'])
121
+ && $this->configs['atversion_update_status']
122
+ && !empty($this->configs['atversion'])
123
+ ) {
124
+ $version = $this->configs['atversion'];
125
+ } else {
126
+ $version = $this->getDefaultAddThisVersion();
127
+ }
128
+
129
+ return $version;
130
+ }
131
+
132
  public function getConfigs() {
133
  if ($this->cmsInterface->isUpgrade()) {
134
  $this->configs = $this->cmsInterface->upgradeConfigs();
135
  }
136
 
137
  $this->configs = $this->setDefaultConfigs();
138
+
139
+ if (!empty($this->configs['addthis_twitter_template'])) {
140
+ $this->configs['addthis_twitter_template'] = $this->getFirstTwitterUsername($this->configs['addthis_twitter_template']);
141
+ }
142
+
143
  return $this->configs;
144
  }
145
 
 
146
  public function saveConfigs($configs = null) {
147
  if (!is_array($this->configs)) {
148
+ $this->getConfigs();
149
  }
150
 
151
  if (is_array($configs) && is_array($this->configs)) {
155
  }
156
 
157
  if (!is_null($this->configs)) {
158
+ if (!empty($this->configs['addthis_twitter_template'])) {
159
+ $this->configs['addthis_twitter_template'] = $this->getFirstTwitterUsername($this->configs['addthis_twitter_template']);
160
+ }
161
+
162
+ $this->configs['atversion'] = $this->getAddThisVersion();
163
+
164
  $this->configs = $this->cmsInterface->saveConfigs($this->configs);
165
  }
166
 
168
  return $this->configs;
169
  }
170
 
171
+ public function saveSubmittedConfigs($input) {
172
+ $configs = $this->cmsInterface->prepareSubmittedConfigs($input);
173
+
174
+ if( isset($options['addthis_plugin_controls'])
175
+ && $this->configs['addthis_plugin_controls'] != "AddThis"
176
+ ) {
177
+ $configs = $this->cmsInterface->prepareCmsModeSubmittedConfigs($input, $configs);
178
+ }
179
+
180
+ return $this->saveConfigs($configs);
181
+ }
182
+
183
  private function setDefaultConfigs() {
184
  $this->configs = $this->cmsInterface->getConfigs(true);
185
 
193
  $this->changedConfigs = true;
194
  }
195
  }
196
+
197
+ $this->configs['atversion'] = $this->getAddThisVersion();
198
+ }
199
+
200
+ $twoWeeksAgo = time() - (60 * 60 * 24 * 7 * 2);
201
+ if ( isset($this->configs['addthis_rate_us_timestamp'])
202
+ && $this->configs['addthis_rate_us_timestamp'] < $twoWeeksAgo
203
+ && $configs['addthis_rate_us'] != 'rated'
204
+ ) {
205
+ $configs['addthis_rate_us'] = '';
206
  }
207
 
208
  if ($this->changedConfigs) {
288
 
289
  return $this->getAnonymousProfileId();
290
  }
291
+
292
+ public function createAddThisShareVariable() {
293
+ if (!is_array($this->configs)) {
294
+ $this->getConfigs();
295
+ }
296
+
297
+ $addThisShareVariable = array();
298
+
299
+ if (!empty($this->configs['addthis_twitter_template'])) {
300
+ $addThisShareVariable['passthrough']['twitter']['via'] = esc_js($this->configs['addthis_twitter_template']);
301
+ }
302
+
303
+ if (!empty($this->configs['addthis_bitly'])) {
304
+ $addThisShareVariable['url_transforms']['shorten']['twitter'] = 'bitly';
305
+ $addThisShareVariable['shorteners']['bitly'] = new stdClass();
306
+ }
307
+
308
+ // this should happen last!
309
+ if (!empty($this->configs['addthis_share_json'])) {
310
+ $json = $this->configs['addthis_share_json'];
311
+ $fromJson = json_decode($json, true);
312
+ $addThisShareVariable = array_merge($addThisShareVariable, $fromJson);
313
+ }
314
+
315
+ return $addThisShareVariable;
316
+ }
317
+
318
+ public function createAddThisConfigVariable() {
319
+ if (!is_array($this->configs)) {
320
+ $this->getConfigs();
321
+ }
322
+
323
+ $addThisConfigVariable = array();
324
+
325
+ if( isset($options['addthis_plugin_controls'])
326
+ && $this->configs['addthis_plugin_controls'] != "AddThis"
327
+ ) {
328
+ $addThisConfigVariable['ignore_server_config'] = true;
329
+ }
330
+
331
+ if (!empty($this->configs['data_ga_property']) ){
332
+ $addThisConfigVariable['data_ga_property'] = $this->configs['data_ga_property'];
333
+ $addThisConfigVariable['data_ga_social'] = true;
334
+ }
335
+
336
+ if ( isset($this->configs['addthis_language'])
337
+ && strlen($this->configs['addthis_language']) == 2
338
+ ) {
339
+ $addThisConfigVariable['ui_language'] = $this->configs['addthis_language'];
340
+ }
341
+
342
+ if (isset($this->configs['atversion'])) {
343
+ $addThisConfigVariable['ui_atversion'] = $this->configs['atversion'];
344
+ }
345
+
346
+ $simpleCheckboxOptions = array(
347
+ array(
348
+ 'cmsConfigName' => 'addthis_append_data',
349
+ 'variableConfigName' => 'data_track_clickback',
350
+ ),
351
+ array(
352
+ 'cmsConfigName' => 'addthis_addressbar',
353
+ 'variableConfigName' => 'data_track_addressbar',
354
+ ),
355
+ array(
356
+ 'cmsConfigName' => 'addthis_508',
357
+ 'variableConfigName' => 'ui_508_compliant',
358
+ ),
359
+ );
360
+
361
+ foreach ($simpleCheckboxOptions as $option) {
362
+ if (!empty($this->configs[$option['cmsConfigName']])) {
363
+ $addThisConfigVariable[$option['variableConfigName']] = true;
364
+ }
365
+ }
366
+
367
+ // this should happen last!
368
+ if (!empty($this->configs['addthis_config_json'])) {
369
+ $json = $this->configs['addthis_config_json'];
370
+ $fromJson = json_decode($json, true);
371
+ $addThisConfigVariable = array_merge($addThisConfigVariable, $fromJson);
372
+ }
373
+
374
+ return $addThisConfigVariable;
375
+ }
376
+
377
+ public function getFirstTwitterUsername($input)
378
+ {
379
+ $twitter_username = '';
380
+ preg_match_all('/@(\w+)\b/i', $input, $twitter_via_matches);
381
+ if (count($twitter_via_matches[1]) == 0) {
382
+ //To handle strings without @
383
+ preg_match_all('/(\w+)\b/i', $input, $twitter_via_refined_matches);
384
+ if (count($twitter_via_refined_matches[1]) > 0) {
385
+ $twitter_username = $twitter_via_refined_matches[1][0];
386
+ }
387
+ } else {
388
+ $twitter_username = $twitter_via_matches[1][0];
389
+ }
390
+
391
+ return $twitter_username;
392
+ }
393
  }
394
  }
AddThisWordPressConnector.php CHANGED
@@ -26,7 +26,7 @@ if (!class_exists('AddThisWordpressConnector')) {
26
  // implements AddThisCmsConnectorInterface {
27
 
28
  static $settingsVariableName = 'addthis_settings';
29
- static $pluginVersion = '5.0.4';
30
  static $settingsPageId = 'addthis_social_widget';
31
  static $anonymousProfileIdPrefix = 'wp';
32
  static $productPrefix = 'wpp';
@@ -166,11 +166,11 @@ if (!class_exists('AddThisWordpressConnector')) {
166
  }
167
 
168
  public function saveConfigs($configs = null) {
169
- if (is_null($configs)) {
170
  $configs = $this->configs;
171
  }
172
 
173
- if (!is_null($configs)) {
174
  update_option(self::$settingsVariableName, $configs);
175
  $this->configs = $this->getConfigs();
176
  }
@@ -521,5 +521,71 @@ if (!class_exists('AddThisWordpressConnector')) {
521
  $url = get_option('home');
522
  return $url;
523
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
  }
525
  }
26
  // implements AddThisCmsConnectorInterface {
27
 
28
  static $settingsVariableName = 'addthis_settings';
29
+ static $pluginVersion = '5.0.5';
30
  static $settingsPageId = 'addthis_social_widget';
31
  static $anonymousProfileIdPrefix = 'wp';
32
  static $productPrefix = 'wpp';
166
  }
167
 
168
  public function saveConfigs($configs = null) {
169
+ if (!is_array($configs)) {
170
  $configs = $this->configs;
171
  }
172
 
173
+ if (is_array($configs)) {
174
  update_option(self::$settingsVariableName, $configs);
175
  $this->configs = $this->getConfigs();
176
  }
521
  $url = get_option('home');
522
  return $url;
523
  }
524
+
525
+ public function prepareSubmittedConfigs($input) {
526
+ if (isset($input['addthis_profile'])) {
527
+ $configs['addthis_profile'] = $input['addthis_profile'];
528
+ }
529
+
530
+ if (isset($input['addthis_environment'])) {
531
+ $configs['addthis_environment'] = $input['addthis_environment'];
532
+ }
533
+
534
+ if (isset($input['addthis_plugin_controls'])) {
535
+ if ($input['addthis_plugin_controls'] == 'WordPress') {
536
+ $configs['addthis_plugin_controls'] = 'WordPress';
537
+ } else {
538
+ $configs['addthis_plugin_controls'] = 'AddThis';
539
+ }
540
+ }
541
+
542
+ if (isset($input['addthis_twitter_template'])) {
543
+ $configs['addthis_twitter_template'] = $input['addthis_twitter_template'];
544
+ }
545
+
546
+ if (isset($input['data_ga_property'])) {
547
+ $configs['data_ga_property'] = $input['data_ga_property'];
548
+ }
549
+
550
+ if (isset($input['addthis_language'])) {
551
+ $configs['addthis_language'] = $input['addthis_language'];
552
+ }
553
+
554
+ if (isset($input['addthis_rate_us'])) {
555
+ $configs['addthis_rate_us'] = $input['addthis_rate_us'];
556
+ $configs['addthis_rate_us_timestamp'] = time();
557
+ }
558
+
559
+ if (isset($input['addthis_config_json'])) {
560
+ $configs['addthis_config_json'] = sanitize_text_field($input['addthis_config_json']);
561
+ }
562
+
563
+ if (isset($input['addthis_share_json'])) {
564
+ $configs['addthis_share_json'] = sanitize_text_field($input['addthis_share_json']);
565
+ }
566
+
567
+ // All the checkbox fields
568
+ $checkboxFields = array(
569
+ 'addthis_508',
570
+ 'addthis_addressbar',
571
+ 'addthis_append_data',
572
+ 'addthis_asynchronous_loading',
573
+ 'addthis_bitly',
574
+ );
575
+
576
+ foreach ($checkboxFields as $field) {
577
+ if (!empty($input[$field])) {
578
+ $configs[$field] = true;
579
+ } else {
580
+ $configs[$field] = false;
581
+ }
582
+ }
583
+
584
+ return $configs;
585
+ }
586
+
587
+ public function prepareCmsModeSubmittedConfigs($input, $configs) {
588
+ return $configs;
589
+ }
590
  }
591
  }
addthis-for-wordpress.php CHANGED
@@ -23,10 +23,6 @@ $pathParts = pathinfo(__FILE__);
23
 
24
  $path = $pathParts['dirname'];
25
 
26
- if (!defined('ADDTHIS_ATVERSION')) {
27
- define('ADDTHIS_ATVERSION', '300');
28
- }
29
-
30
  define('ADDTHIS_PLUGIN_FILE', $path.'/addthis_social_widget.php');
31
  define('ADDTHIS_PUBNAME_LIMIT', 255);
32
 
@@ -51,6 +47,8 @@ class Addthis_Wordpress
51
  private $addThisConfigs;
52
  private $cmsConnector;
53
 
 
 
54
  /**
55
  * Initializes the plugin.
56
  *
@@ -70,7 +68,7 @@ class Addthis_Wordpress
70
  $this->_options = $this->addThisConfigs->getConfigs();
71
 
72
  include_once 'addthis-toolbox.php';
73
- new Addthis_ToolBox($addThisConfigs, $cmsConnector);
74
 
75
  add_action('admin_menu', array($this, 'addToWordpressMenu'));
76
 
@@ -147,28 +145,15 @@ class Addthis_Wordpress
147
  */
148
  public function updateSettings($settings)
149
  {
150
- if(isset($settings['pubid'])){
151
- $this->_options['addthis_profile'] = sanitize_key($settings['pubid']);
152
  }
153
 
154
- if(isset($settings['addthis_settings']['addthis_environment'])){
155
- $this->_options['addthis_environment'] = sanitize_key($settings['addthis_settings']['addthis_environment']);
156
- }
157
-
158
- if( isset($settings['addthis_plugin_controls'])
159
- && $settings['addthis_plugin_controls'] == "WordPress"
160
- ) {
161
- $this->_options['addthis_plugin_controls'] = $settings['addthis_plugin_controls'];
162
- }
163
-
164
- if(isset($settings['async_loading'])){
165
- $this->_options['addthis_asynchronous_loading'] = intval($settings['async_loading']);
166
- }
167
- $this->_options = $this->addThisConfigs->saveConfigs($this->_options);
168
-
169
- return "<div class='addthis_updated wrap' style='margin-top:50px;width:95%'>".
170
- "AddThis Profile Settings updated successfully!!!".
171
- "</div>";
172
  }
173
 
174
  /**
@@ -211,7 +196,7 @@ class Addthis_Wordpress
211
  */
212
  private function _checkAddPubid()
213
  {
214
- $successReturn = isset ($this->_postVariables['pubid'])
215
  && isset ($this->_postVariables['submit'])
216
  && isset( $this->_postVariables['pubid_nonce'] )
217
  && wp_verify_nonce( $this->_postVariables['pubid_nonce'], 'update_pubid' );
@@ -296,7 +281,7 @@ class Addthis_Wordpress
296
  && ($this->_getVariables['advanced_settings'] == 'true'))
297
  ) {
298
  // Get Confirmation form
299
- $html .= addthis_profile_id_csr_confirmation('pubid');
300
  } else {
301
  $html .= $this->_getAddThisLinkButton();
302
  }
@@ -411,8 +396,12 @@ class Addthis_Wordpress
411
  </p>
412
  </div>
413
  </div>
 
414
  </div>
415
  <div id="tabs-2">
 
 
 
416
  ' . _addthis_profile_id_card() . '
417
  ' . _addthis_mode_card() . '
418
  </div>
@@ -445,17 +434,17 @@ add_action('init', 'Addthis_Wordpress_early', 0);
445
  /**
446
  * Include addthis js widget
447
  *
448
- * @global AddThis_addjs $addthis_addjs
449
  * @return null
450
  */
451
  function Addthis_Wordpress_early()
452
  {
453
- global $addthis_addjs;
454
  global $addThisConfigs;
455
  global $cmsConnector;
456
 
457
- if (!isset($addthis_addjs)) {
458
  include 'addthis_addjs_new.php';
459
- $addthis_addjs = new AddThis_addjs($addThisConfigs, $cmsConnector);
460
  }
461
  }
23
 
24
  $path = $pathParts['dirname'];
25
 
 
 
 
 
26
  define('ADDTHIS_PLUGIN_FILE', $path.'/addthis_social_widget.php');
27
  define('ADDTHIS_PUBNAME_LIMIT', 255);
28
 
47
  private $addThisConfigs;
48
  private $cmsConnector;
49
 
50
+ public $addThisToolBox;
51
+
52
  /**
53
  * Initializes the plugin.
54
  *
68
  $this->_options = $this->addThisConfigs->getConfigs();
69
 
70
  include_once 'addthis-toolbox.php';
71
+ $this->addThisToolBox = new Addthis_ToolBox($addThisConfigs, $cmsConnector);
72
 
73
  add_action('admin_menu', array($this, 'addToWordpressMenu'));
74
 
145
  */
146
  public function updateSettings($settings)
147
  {
148
+ if (!empty($settings['addthis_settings'])) {
149
+ $this->_options = $this->addThisConfigs->saveSubmittedConfigs($settings['addthis_settings']);
150
  }
151
 
152
+ return '
153
+ <div class="addthis_updated wrap" style="margin-top:50px;width:95%">
154
+ AddThis Profile Settings updated successfully!!!
155
+ </div>
156
+ ';
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
 
159
  /**
196
  */
197
  private function _checkAddPubid()
198
  {
199
+ $successReturn = isset ($this->_postVariables['addthis_settings']['addthis_profile'])
200
  && isset ($this->_postVariables['submit'])
201
  && isset( $this->_postVariables['pubid_nonce'] )
202
  && wp_verify_nonce( $this->_postVariables['pubid_nonce'], 'update_pubid' );
281
  && ($this->_getVariables['advanced_settings'] == 'true'))
282
  ) {
283
  // Get Confirmation form
284
+ $html .= addthis_profile_id_csr_confirmation();
285
  } else {
286
  $html .= $this->_getAddThisLinkButton();
287
  }
396
  </p>
397
  </div>
398
  </div>
399
+ ' . _addthis_rate_us_card() . '
400
  </div>
401
  <div id="tabs-2">
402
+ ' . _addthis_tracking_card() . '
403
+ ' . _addthis_display_options_card() . '
404
+ ' . _addthis_additional_options_card() . '
405
  ' . _addthis_profile_id_card() . '
406
  ' . _addthis_mode_card() . '
407
  </div>
434
  /**
435
  * Include addthis js widget
436
  *
437
+ * @global AddThis_addjs_sharing_button_plugin $AddThis_addjs_sharing_button_plugin
438
  * @return null
439
  */
440
  function Addthis_Wordpress_early()
441
  {
442
+ global $AddThis_addjs_sharing_button_plugin;
443
  global $addThisConfigs;
444
  global $cmsConnector;
445
 
446
+ if (!isset($AddThis_addjs_sharing_button_plugin)) {
447
  include 'addthis_addjs_new.php';
448
+ $AddThis_addjs_sharing_button_plugin = new AddThis_addjs_sharing_button_plugin($addThisConfigs, $cmsConnector);
449
  }
450
  }
addthis-toolbox.php CHANGED
@@ -59,9 +59,8 @@ class Addthis_ToolBox
59
  $this->cmsConnector = $cmsConnector;
60
 
61
  add_filter('the_content', array($this, 'addWidget'));
62
- if ( has_excerpt()) {
63
- add_filter('the_excerpt', array($this, 'addWidget'));
64
- }
65
  }
66
 
67
  /**
59
  $this->cmsConnector = $cmsConnector;
60
 
61
  add_filter('the_content', array($this, 'addWidget'));
62
+ add_filter('get_the_excerpt', array($this, 'addWidget'));
63
+ //add_filter('the_excerpt', array($this, 'addWidget'));
 
64
  }
65
 
66
  /**
addthis_addjs_new.php CHANGED
@@ -22,7 +22,7 @@
22
  /**
23
  * Class for managing AddThis script includes across all its plugins.
24
  */
25
- Class AddThis_addjs{
26
  /**
27
  * var bool check to see if we have added our JS already. Ensures that we don't add it twice
28
  */
@@ -57,9 +57,7 @@ Class AddThis_addjs{
57
  $this->_options = $addThisConfigs->getConfigs();
58
 
59
  // Version of AddThis code to use
60
- if (is_array($this->_options)) {
61
- $this->atversion = array_key_exists('atversion_update_status', $this->_options) && $this->_options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $this->_options['atversion'] : ADDTHIS_ATVERSION;
62
- }
63
 
64
  // If the footer option isn't set, check for it
65
  if (! isset($this->_options['wpfooter']) && current_user_can('manage_options'))
@@ -166,43 +164,59 @@ Class AddThis_addjs{
166
  function addWidgetToJs(){
167
  if (!is_404()) {
168
  //Load addthis script only if the page is not 404
169
- $addthis_settings_options = get_option('addthis_settings');
170
 
171
  $async = '';
172
- if( isset($addthis_settings_options['addthis_asynchronous_loading'])
173
- && $addthis_settings_options['addthis_asynchronous_loading']
174
- ) {
175
- $async = 'async="async"';
176
  }
177
 
178
  /**
179
  * Load client script based on the enviornment variable
180
  * Admin can enable debug mode in adv settings by adding url param debug=true
181
  */
182
- $at_env = (isset($addthis_settings_options['addthis_environment']))?$addthis_settings_options['addthis_environment']:false;
183
- $firstScriptHalf = '<script type="text/javascript" src="//s7.addthis.com/js/';
184
-
185
- if(isset($at_env) && $at_env != ""){
186
- $firstScriptHalf = '<script type="text/javascript" src="//cache-'.$at_env.'.addthis.com/cachefly/js/';
187
  }
188
 
 
 
 
 
 
 
189
  $addthis_share_js = '';
190
- if ( isset($addthis_settings_options['addthis_plugin_controls'])
191
- && $addthis_settings_options['addthis_plugin_controls'] == "AddThis"
192
- ) {
193
- $addthis_share['url_transforms']['shorten']['twitter'] = 'bitly';
194
- $addthis_share['shorteners']['bitly'] = new stdClass();
195
- $addthis_share_js = 'var addthis_share = ' . json_encode($addthis_share) . ';';
 
 
196
  }
197
 
198
  $this->jsToAdd .= '
199
- <script>
 
 
200
  var wp_product_version = "' . $this->cmsConnector->getProductVersion() . '";
201
  var wp_blog_version = "' . $this->cmsConnector->getCmsVersion() . '";
202
- ' . $addthis_share_js . '
 
 
 
 
 
 
 
 
 
 
 
203
  </script>';
204
-
205
- $this->jsToAdd .= $firstScriptHalf . $this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->addThisConfigs->getUsableProfileId() ).'" ' . $async. '></script>';
206
  }
207
  }
208
 
22
  /**
23
  * Class for managing AddThis script includes across all its plugins.
24
  */
25
+ Class AddThis_addjs_sharing_button_plugin{
26
  /**
27
  * var bool check to see if we have added our JS already. Ensures that we don't add it twice
28
  */
57
  $this->_options = $addThisConfigs->getConfigs();
58
 
59
  // Version of AddThis code to use
60
+ $this->atversion = $this->_options['atversion'];
 
 
61
 
62
  // If the footer option isn't set, check for it
63
  if (! isset($this->_options['wpfooter']) && current_user_can('manage_options'))
164
  function addWidgetToJs(){
165
  if (!is_404()) {
166
  //Load addthis script only if the page is not 404
167
+ $addthis_settings_options = $this->addThisConfigs->getConfigs();
168
 
169
  $async = '';
170
+ if (!empty($addthis_settings_options['addthis_asynchronous_loading'])) {
171
+ $async = 'async="async"';
 
 
172
  }
173
 
174
  /**
175
  * Load client script based on the enviornment variable
176
  * Admin can enable debug mode in adv settings by adding url param debug=true
177
  */
178
+ $script_domain = '//s7.addthis.com/js/';
179
+ if (!empty($addthis_settings_options['addthis_environment'])) {
180
+ $at_env = $addthis_settings_options['addthis_environment'];
181
+ $script_domain = '//cache-'.$at_env.'.addthis.com/cachefly/js/';
 
182
  }
183
 
184
+ $url = $script_domain .
185
+ $this->atversion .
186
+ '/addthis_widget.js#pubid=' .
187
+ urlencode($this->addThisConfigs->getUsableProfileId());
188
+
189
+ $addthis_share = $this->addThisConfigs->createAddThisShareVariable();
190
  $addthis_share_js = '';
191
+ if (!empty($addthis_share)) {
192
+ $addthis_share_js = 'var addthis_share = '. json_encode($addthis_share) .';';
193
+ }
194
+
195
+ $addthis_config = $this->addThisConfigs->createAddThisConfigVariable();
196
+ $addthis_config_js = '';
197
+ if (!empty($addthis_config)) {
198
+ $addthis_config_js = 'var addthis_config = '. json_encode($addthis_config) .';';
199
  }
200
 
201
  $this->jsToAdd .= '
202
+ <!-- AddThis Settings Begin -->
203
+ <script type="text/javascript">
204
+ var addthis_product = "'. $this->cmsConnector->getProductVersion() . '";
205
  var wp_product_version = "' . $this->cmsConnector->getProductVersion() . '";
206
  var wp_blog_version = "' . $this->cmsConnector->getCmsVersion() . '";
207
+ if (typeof(addthis_config) == "undefined") {
208
+ ' . $addthis_config_js . '
209
+ }
210
+ if (typeof(addthis_share) == "undefined") {
211
+ ' . $addthis_share_js . '
212
+ }
213
+ </script>
214
+ <script
215
+ type="text/javascript"
216
+ src="' . $url . ' "
217
+ ' . $async . '
218
+ >
219
  </script>';
 
 
220
  }
221
  }
222
 
addthis_settings_functions.php CHANGED
@@ -403,13 +403,16 @@ function _addthis_print_services_picker($name, $options) {
403
  */
404
  function _addthis_deprecated_fields() {
405
  $deletedFields = array(
406
- 'addthis_bitly_login',
407
  'addthis_bitly_key',
 
 
408
  'addthis_copytracking1',
409
  'addthis_copytracking2',
410
  'addthis_copytrackingremove',
411
  'addthis_fallback_username',
412
  'addthis_for_wordpress',
 
 
413
  'addthis_nag_username_ignore',
414
  'addthis_options',
415
  'addthis_password',
403
  */
404
  function _addthis_deprecated_fields() {
405
  $deletedFields = array(
 
406
  'addthis_bitly_key',
407
+ 'addthis_bitly_login',
408
+ 'addthis_brand',
409
  'addthis_copytracking1',
410
  'addthis_copytracking2',
411
  'addthis_copytrackingremove',
412
  'addthis_fallback_username',
413
  'addthis_for_wordpress',
414
+ 'addthis_header_background',
415
+ 'addthis_header_color',
416
  'addthis_nag_username_ignore',
417
  'addthis_options',
418
  'addthis_password',
addthis_social_widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: AddThis Sharing Buttons
4
  * Plugin URI: http://www.addthis.com
5
  * Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
6
- * Version: 5.0.4
7
  * Author: The AddThis Team
8
  * Author URI: http://www.addthis.com/
9
  * License: GPL2
@@ -31,8 +31,6 @@ if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
31
  else return;
32
 
33
  define( 'addthis_style_default' , 'fb_tw_p1_sc');
34
- define( 'ADDTHIS_ATVERSION', '300');
35
- define( 'ADDTHIS_ATVERSION_REVERTED', 1);
36
  define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
37
 
38
  require_once('AddThisWordPressConnector.php');
@@ -44,6 +42,43 @@ $addthis_options = $addThisConfigs->getConfigs();
44
 
45
  require_once('addthis_settings_functions.php');
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  /**
48
  * Show Plugin activation notice on first installation*
49
  */
@@ -86,13 +121,21 @@ function addthis_activation_hook(){
86
 
87
  register_activation_hook( __FILE__, 'addthis_activation_hook' );
88
 
89
- if ( isset($_POST['addthis_plugin_controls'])
90
- && $_POST['addthis_plugin_controls'] != $addthis_options['addthis_plugin_controls']
 
 
 
 
 
 
91
  ) {
92
- if($_POST['addthis_plugin_controls'] != 'AddThis') {
93
- $addthis_options['addthis_plugin_controls'] = 'WordPress';
 
 
94
  } else {
95
- $addthis_options['addthis_plugin_controls'] = 'AddThis';
96
  }
97
  $addthis_options = $addThisConfigs->saveConfigs($addthis_options);
98
  }
@@ -105,13 +148,13 @@ function addthis_minimal_css() {
105
 
106
  if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
107
  require_once 'addthis-for-wordpress.php';
108
- new Addthis_Wordpress(isset($upgraded), $addThisConfigs, $cmsConnector);
109
  } else {
110
 
111
  // Show old version of the plugin till upgrade button is clicked
112
 
113
  // Add settings link on plugin page
114
- function your_plugin_settings_link($links) {
115
  global $cmsConnector;
116
  $settings_link = '<a href="'.$cmsConnector->getSettingsPageUrl().'">Settings</a>';
117
  array_push($links, $settings_link);
@@ -119,19 +162,19 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
119
  }
120
 
121
  $plugin = plugin_basename(__FILE__);
122
- add_filter("plugin_action_links_$plugin", 'your_plugin_settings_link' );
123
 
124
 
125
  // Setup our shared resources early
126
  // addthis_addjs.php is a standard class shared by the various AddThis plugins to make it easy for us to include our bootstrapping JavaScript only once. Priority should be lowest for Share plugin.
127
  add_action('init', 'addthis_early', 0);
128
  function addthis_early(){
129
- global $addthis_addjs;
130
  global $addThisConfigs;
131
  global $cmsConnector;
132
- if (!isset($addthis_addjs)){
133
  require('addthis_addjs_new.php');
134
- $addthis_addjs = new AddThis_addjs($addThisConfigs, $cmsConnector);
135
  }
136
  }
137
 
@@ -142,11 +185,8 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
142
  $addthis_settings['language'] = 'en';
143
  $addthis_settings['fallback_username'] = '';
144
  $addthis_settings['style'] = 'share';
145
- $addthis_settings['atversion'] = ADDTHIS_ATVERSION;
146
  $addthis_settings['placement'] = ENABLE_ADDITIONAL_PLACEMENT_OPTION;
147
 
148
- $addthis_languages = array(''=>'Automatic','af'=>'Afrikaaner', 'ar'=>'Arabic', 'zh'=>'Chinese', 'cs'=>'Czech', 'da'=>'Danish', 'nl'=>'Dutch', 'en'=>'English', 'fa'=>'Farsi', 'fi'=>'Finnish', 'fr'=>'French', 'ga'=>'Gaelic', 'de'=>'German', 'el'=>'Greek', 'he'=>'Hebrew', 'hi'=>'Hindi', 'it'=>'Italian', 'ja'=>'Japanese', 'ko'=>'Korean', 'lv'=>'Latvian', 'lt'=>'Lithuanian', 'no'=>'Norwegian', 'pl'=>'Polish', 'pt'=>'Portugese', 'ro'=>'Romanian', 'ru'=>'Russian', 'sk'=>'Slovakian', 'sl'=>'Slovenian', 'es'=>'Spanish', 'sv'=>'Swedish', 'th'=>'Thai', 'ur'=>'Urdu', 'cy'=>'Welsh', 'vi'=>'Vietnamese');
149
-
150
  $addthis_menu_types = array('static', 'dropdown', 'toolbox');
151
 
152
  $addthis_styles = array(
@@ -159,7 +199,7 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
159
  );
160
 
161
  $addthis_options = get_option('addthis_settings');
162
- $atversion = is_array($addthis_options) && array_key_exists('atversion_reverted', $addthis_options) && $addthis_options['atversion_reverted'] == 1 ? $addthis_options['atversion'] : ADDTHIS_ATVERSION;
163
 
164
  $addthis_new_styles = array(
165
  'large_toolbox' => array(
@@ -305,12 +345,6 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
305
 
306
  $addthis_new_options['below'] = 'none';
307
 
308
- if ($header_background = get_option('addthis_header_background'))
309
- $addthis_new_options['addthis_header_background'] = $header_background;
310
- if ($header_color = get_option('addthis_header_color'))
311
- $addthis_new_options['addthis_header_color'] = $header_color;
312
- if ($brand = get_option('addthis_brand'))
313
- $addthis_new_options['addthis_brand'] = $brand;
314
  if ($language = get_option('addthis_language'))
315
  $addthis_new_options['addthis_language'] = $language;
316
 
@@ -335,9 +369,6 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
335
  delete_option('addthis_aftertitle');
336
  delete_option('addthis_beforecomments');
337
  delete_option('addthis_style');
338
- delete_option('addthis_header_background');
339
- delete_option('addthis_header_color');
340
- delete_option('addthis_brand');
341
  delete_option('addthis_language');
342
  delete_option('atversion');
343
 
@@ -366,9 +397,6 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
366
  global $addThisConfigs;
367
  $options = $addThisConfigs->getConfigs();
368
 
369
- // Add An option for the AT Version
370
- $options['atversion'] = ADDTHIS_ATVERSION;
371
-
372
  //$options['wpfooter'] = false;
373
  $addThisConfigs->saveConfigs($options);
374
  }
@@ -698,7 +726,7 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
698
  //[addthis_twitter_template]
699
  if ( isset ($data['addthis_twitter_template']) && strlen($data['addthis_twitter_template']) != 0 ) {
700
  //Parse the first twitter username to be used with via
701
- $options['addthis_twitter_template'] = get_first_twitter_username(sanitize_text_field($data['addthis_twitter_template']));
702
  }
703
 
704
  $options['above'] = 'custom_string';
@@ -761,7 +789,6 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
761
  'addthis_addressbar',
762
  'addthis_aftertitle' ,
763
  'addthis_append_data',
764
- 'addthis_append_data',
765
  'addthis_asynchronous_loading',
766
  'addthis_beforecomments',
767
  'addthis_below_enabled',
@@ -792,17 +819,9 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
792
  //[addthis_twitter_template]
793
  if ( isset ($data['addthis_twitter_template'])) {
794
  //Parse the first twitter username to be used with via
795
- $options['addthis_twitter_template'] = get_first_twitter_username(sanitize_text_field($data['addthis_twitter_template']));
796
  }
797
 
798
- if (isset ($data['addthis_bitly']) && strlen($data['addthis_bitly']) != 0 )
799
- $options['addthis_bitly'] = sanitize_text_field($data['addthis_bitly']);
800
-
801
-
802
- //[addthis_brand] =>
803
- if ( isset ($data['addthis_brand']) && strlen($data['addthis_brand']) != 0 )
804
- $options['addthis_brand'] = sanitize_text_field($data['addthis_brand']);
805
-
806
  //[addthis_language] =>
807
  if ( isset ($data['addthis_language']))
808
  $options['addthis_language'] = sanitize_text_field($data['addthis_language']);
@@ -819,22 +838,6 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
819
  if ( isset ($data['credential_validation_status']))
820
  $options['credential_validation_status'] = sanitize_text_field($data['credential_validation_status']);
821
 
822
- if ( isset ($data['addthis_header_background']) && strlen($data['addthis_header_background']) != 0 )
823
- {
824
- if (! strpos($data['addthis_header_background'], '#') === 0)
825
- $options['addthis_header_background'] = '#' . sanitize_text_field($data['addthis_header_background']);
826
- else
827
- $options['addthis_header_background'] = sanitize_text_field($data['addthis_header_background']);
828
- }
829
-
830
- if ( isset ($data['addthis_header_color']) && strlen($data['addthis_header_color']) != 0 )
831
- {
832
- if (! strpos($data['addthis_header_color'], '#') === 0)
833
- $options['addthis_header_color'] = '#' . sanitize_text_field($data['addthis_header_color']);
834
- else
835
- $options['addthis_header_color'] = sanitize_text_field($data['addthis_header_color']);
836
- }
837
-
838
  if (isset($data['addthis_config_json'])) {
839
  $options['addthis_config_json'] = sanitize_text_field($data['addthis_config_json']);
840
  }
@@ -879,7 +882,12 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
879
  $options['addthis_plugin_controls'] = $data['addthis_plugin_controls'];
880
  }
881
 
882
- return $options;
 
 
 
 
 
883
  }
884
 
885
 
@@ -1294,16 +1302,14 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1294
  add_action('wp_head', 'addthis_register_script_in_addjs', 20);
1295
 
1296
  function addthis_register_script_in_addjs(){
1297
- global $addthis_addjs;
1298
  $script = addthis_output_script(true, true);
1299
- $addthis_addjs->addToScript($script);
1300
 
1301
  $addthis_sidebar = addthis_sidebar_script();
1302
- $addthis_addjs->addAfterScript($addthis_sidebar);
1303
  }
1304
 
1305
- //add_action('wp_footer', 'addthis_output_script');
1306
-
1307
  /**
1308
  * Check to see if our Javascript has been outputted yet. If it hasn't, return it. Else, return false.
1309
  *
@@ -1315,97 +1321,69 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1315
  global $cmsConnector;
1316
  $options = $addThisConfigs->getConfigs();
1317
 
1318
- $script = "\n<!-- AddThis Button Begin -->\n"
1319
- .'<script type="text/javascript">'
1320
- ."var addthis_product = '". $cmsConnector->getProductVersion() ."';\n";
1321
-
1322
- $addthis_config = array();
1323
- $addthis_share = array();
1324
-
1325
- $addthis_config["data_track_clickback"] = (isset($options['addthis_append_data']) && $options['addthis_append_data'] == true);
1326
-
1327
- if ( isset($options['data_ga_property']) ){
1328
- $addthis_config['data_ga_property'] = $options['data_ga_property'];
1329
- $addthis_config['data_ga_social'] = true;
1330
  }
1331
 
1332
- $addthis_config["data_track_addressbar"] = (isset($options['addthis_addressbar']) && $options['addthis_addressbar'] == true);
1333
-
1334
- if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1335
- $addthis_config['ui_language'] = $options['addthis_language'];
1336
-
1337
- if ( isset($options['atversion']))
1338
- $addthis_config['ui_atversion'] = isset($options['atversion_update_status']) && $options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $options['atversion'] : ADDTHIS_ATVERSION;
1339
-
1340
- if ( isset($options['addthis_header_background']) )
1341
- $addthis_config['ui_header_background'] = $options['addthis_header_background'];
1342
-
1343
- if ( isset($options['addthis_header_color']) )
1344
- $addthis_config['ui_header_color'] = $options['addthis_header_color'];
1345
-
1346
- if ( isset($options['addthis_brand']) )
1347
- $addthis_config['ui_cobrand'] = $options['addthis_brand'];
1348
-
1349
- if (isset($options['addthis_508']) && $options['addthis_508'] == true)
1350
- $addthis_config['ui_508_compliant'] = true;
1351
-
1352
- $addthis_config = apply_filters('addthis_config_js_var', $addthis_config);
1353
- $addthis_config_json = array_key_exists('addthis_config_json', $options) ? $options['addthis_config_json'] : '';
1354
- $script = merge_config_with_json_config($script, $addthis_config, $addthis_config_json);
1355
-
1356
- if (isset($options['addthis_twitter_template'])){
1357
- //The following twitter template translation is deprecated and replaced with via
1358
- //$addthis_share['templates']['twitter'] = esc_js($options['addthis_twitter_template']);
1359
- $addthis_share['passthrough']['twitter']['via'] = esc_js(get_first_twitter_username($options['addthis_twitter_template']));
1360
-
1361
- }
1362
- if (isset($options['addthis_bitly']) && $options['addthis_bitly']) {
1363
- $addthis_share['url_transforms']['shorten']['twitter'] = 'bitly';
1364
- $addthis_share['shorteners']['bitly'] = new stdClass();
1365
  }
1366
 
1367
- if ($justConfig)
1368
- {
1369
- $return = '';
1370
- $share = apply_filters('addthis_share_js_var', $addthis_share );
1371
- if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '') {
1372
- $addthis_json_share = array_key_exists('addthis_share_json', $options) ? $options['addthis_share_json'] : '';
1373
- $return .= merge_share_with_json_share($addthis_share, $addthis_json_share);
1374
- }
1375
- else
1376
- {
1377
- if (! empty($share) )
1378
- $return .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1379
- }
1380
- $return .= "\n";
1381
-
1382
- $return = merge_config_with_json_config($return, $addthis_config, $addthis_config_json);
1383
-
1384
- $return .= "\n";
1385
-
1386
- if( isset($options['addthis_plugin_controls'])
1387
- && $options['addthis_plugin_controls'] != "AddThis"
1388
- ) {
1389
- $return .= "addthis_config.ignore_server_config = true;";
1390
- $return .= "\n";
1391
- }
1392
 
1393
- return $return;
 
 
1394
  }
1395
 
 
 
 
 
 
 
 
 
 
1396
 
1397
- if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '')
1398
- $script .= merge_share_with_json_share($addthis_share, $addthis_json_share);
1399
- else
1400
- $script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1401
- $script .= '</script>';
1402
 
1403
- $script .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#pubid='. urlencode($addThisConfigs->getUsableProfileId()) . '"></script>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1404
 
1405
- if ( ! is_admin() && ! is_feed() )
1406
  echo $script;
1407
- elseif ($return == true && ! is_admin() && ! is_feed() )
1408
  return $script;
 
1409
  }
1410
 
1411
  function addthis_sidebar_script(){
@@ -1452,49 +1430,6 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1452
  return $return;
1453
  }
1454
 
1455
- /*
1456
- * Merge the AddThis settings with that given using JSON format
1457
- * @param String $appendString - The string to build and return the script
1458
- * @param array $addthis_config - The setting array for AddThis config
1459
- * @param String $addthis_json_config - The JSON String
1460
- * @return String $appendString - The string to build and return the script
1461
- */
1462
- function merge_config_with_json_config($append_string, $addthis_config, $addthis_json_config) {
1463
- if ( isset( $addthis_json_config ) && trim($addthis_json_config) != '') {
1464
- $addthis_config_json_list = json_decode($addthis_json_config, true);
1465
- if (! empty ($addthis_config_json_list) && ! empty ($addthis_config)) {
1466
- foreach($addthis_config_json_list as $key_json => $json_config_value) {
1467
- $addthis_config[$key_json] = $json_config_value;
1468
- }
1469
- }
1470
- }
1471
- if (! empty ($addthis_config) )
1472
- $append_string .= 'var addthis_config = '. json_encode($addthis_config) .';';
1473
- return $append_string;
1474
- }
1475
-
1476
- /*
1477
- * Merge the AddThis settings with that given using JSON format
1478
- * @param String $appendString - The string to build and return the script
1479
- * @param array $addthis_share - The setting array for AddThis share
1480
- * @param String $addthis_json_share - The JSON String
1481
- * @return String $appendString - The string to build and return the script
1482
- */
1483
- function merge_share_with_json_share($addthis_share, $addthis_json_share) {
1484
- $append_string = '';
1485
- if ( isset( $addthis_json_share ) && trim($addthis_json_share) != '') {
1486
- $addthis_share_json_list = json_decode($addthis_json_share, true);
1487
- if (! empty ($addthis_share_json_list) && ! empty ($addthis_share)) {
1488
- foreach($addthis_share_json_list as $key_json => $json_share_value) {
1489
- $addthis_share[$key_json] = $json_share_value;
1490
- }
1491
- }
1492
- }
1493
- if (! empty ($addthis_share) )
1494
- $append_string = 'if (typeof(addthis_share) == "undefined"){ addthis_share = '. json_encode($addthis_share) .';}';
1495
- return $append_string;
1496
- }
1497
-
1498
  /**
1499
  * Appends AddThis button to post content.
1500
  */
@@ -1631,7 +1566,11 @@ EOF;
1631
  <div class="wrap">
1632
  <h2 class='placeholder'>&nbsp;</h2>
1633
 
1634
- <form id="addthis-settings" method="post" action="options.php">
 
 
 
 
1635
  <?php
1636
  // use the old-school settings style in older versions of wordpress
1637
  if ( $cmsConnector->getCmsMinorVersion() >= 2.7
@@ -1671,8 +1610,6 @@ EOF;
1671
  add_action('init', 'addthis_init');
1672
 
1673
  function addthis_wordpress_mode_tabs() {
1674
- global $addthis_styles;
1675
- global $addthis_languages;
1676
  global $addThisConfigs;
1677
  global $cmsConnector;
1678
 
@@ -1857,190 +1794,14 @@ EOF;
1857
  </div>
1858
  </div>
1859
  </div>
 
1860
  </div>
1861
  <div id="tabs-2">
 
1862
 
1863
- <div class="Card">
1864
- <div class="Card-hd">
1865
- <h3 class="Card-hd-title">Tracking</h3>
1866
- </div>
1867
- <div class="Card-bd">
1868
- <ul class="Card-option-list">
1869
- <li>
1870
- <ul>
1871
- <li>
1872
- <input
1873
- id="addthis_append_data"
1874
- type="checkbox"
1875
- name="addthis_settings[addthis_append_data]"
1876
- value="true" <?php echo $options['addthis_append_data'] == true ? 'checked="checked"' : ''; ?>/>
1877
- <label for="addthis_append_data">
1878
- <span class="addthis-checkbox-label">
1879
- <strong><?php _e("Clickbacks", 'addthis_trans_domain' ); ?></strong>
1880
- (Recommended)
1881
- </span>
1882
- </label>
1883
- <span class="at-wp-tooltip" tooltip="AddThis will use this to track how many people come back to your content via links shared with AddThis buttons. This data will be available to you at addthis.com.">?</span>
1884
- </li>
1885
- <li>
1886
- <input
1887
- type="checkbox"
1888
- id="addthis_addressbar"
1889
- name="addthis_settings[addthis_addressbar]"
1890
- value="true" <?php echo ($options['addthis_addressbar'] == true ? 'checked="checked"' : ''); ?>/>
1891
- <label for="addthis_addressbar">
1892
- <span class="addthis-checkbox-label">
1893
- <strong><?php _e("Address bar shares", 'addthis_trans_domain' ); ?></strong>
1894
- </span>
1895
- </label>
1896
- <span class="at-wp-tooltip" tooltip="AddThis will append a code to your site’s URLs (except for the homepage) to track when a visitor comes to your site from a link someone copied out of their browser's address bar.">?</span>
1897
- </li>
1898
- <li>
1899
- <input
1900
- id="addthis_bitly"
1901
- type="checkbox"
1902
- name="addthis_settings[addthis_bitly]"
1903
- value="true" <?php echo ($options['addthis_bitly'] == true ? 'checked="checked"' : ''); ?>/>
1904
- <label for="addthis_bitly">
1905
- <span class="addthis-checkbox-label">
1906
- <strong><?php _e("Bitly URL shortening for Twitter", 'addthis_trans_domain' ); ?></strong>
1907
- </span>
1908
- </label>
1909
- <span class="at-wp-tooltip" tooltip="Your Bitly login and key will need to be setup with your profile on addthis.com before Bitly will begin working with WordPress.">?</span>
1910
- </li>
1911
- </ul>
1912
- </li>
1913
- <li>
1914
- <label for="data_ga_property">
1915
- <strong><?php _e("Google Analytics property ID", 'addthis_trans_domain' ); ?></strong>
1916
- </label>
1917
- <input
1918
- id="data_ga_property"
1919
- type="text"
1920
- name="addthis_settings[data_ga_property]"
1921
- value="<?php echo $options['data_ga_property'] ?>"/>
1922
- </li>
1923
- </ul>
1924
- </div>
1925
- </div>
1926
-
1927
- <div class="Card">
1928
- <div class="Card-hd">
1929
- <h3 class="Card-hd-title">Display Options</h3>
1930
- </div>
1931
- <div class="Card-bd">
1932
- <ul class="Card-option-list">
1933
- <li>
1934
- <ul>
1935
- <li>
1936
- <input
1937
- id="addthis_asynchronous_loading"
1938
- type="checkbox"
1939
- name="addthis_settings[addthis_asynchronous_loading]"
1940
- value="true" <?php echo ($options['addthis_asynchronous_loading'] == true ? 'checked="checked"' : ''); ?>/>
1941
- <label for="addthis_asynchronous_loading">
1942
- <span class="addthis-checkbox-label">
1943
- <strong><?php _e("Asynchronous loading", 'addthis_trans_domain' ); ?></strong>
1944
- (Recommended)
1945
- </span>
1946
- </label>
1947
- <span class="at-wp-tooltip" tooltip="When checked, your site will load before AddThis sharing buttons are added. If unchecked, your site will not load until AddThis buttons (and AddThis JavaScript) have been loaded by your vistors.">?</span>
1948
- </li>
1949
- <li>
1950
- <input
1951
- id="addthis_508"
1952
- type="checkbox"
1953
- name="addthis_settings[addthis_508]" v
1954
- alue="true" <?php echo ($options['addthis_508'] == true ? 'checked="checked"' : ''); ?>/>
1955
- <label for="addthis_508">
1956
- <span class="addthis-checkbox-label">
1957
- <strong><?php _e("Enhanced accessibility", 'addthis_trans_domain' ); ?></strong>
1958
- </span>
1959
- </label>
1960
- <span class="at-wp-tooltip" tooltip="Also known as 508 compliance. If checked, clicking an AddThis sharing button will open a new window to a page that is keyboard navigable for people with disabilities.">?</span>
1961
- </li>
1962
- </ul>
1963
- </li>
1964
- <li>
1965
- <label id="addthis_twitter_template">
1966
- <strong><?php _e("Twitter via", 'addthis_trans_domain' ); ?></strong>
1967
- <span class="at-wp-tooltip" tooltip="When a visitor uses an AddThis button to send a tweet about your page, this will be used within Twitter to identify through whom they found your page. You would usually enter a twitter handle here. For example, Twitter could show a tweet came from jsmith via AddThis.">?</span>
1968
- </label>
1969
- <input
1970
- id="addthis_twitter_template"
1971
- type="text"
1972
- name="addthis_settings[addthis_twitter_template]"
1973
- value="<?php echo get_first_twitter_username($options['addthis_twitter_template']) ; ?>" />
1974
- </li>
1975
- </ul>
1976
- </div>
1977
- </div>
1978
 
1979
- <div class="Card">
1980
- <div class="Card-hd">
1981
- <h3 class="Card-hd-title">Additional Options</h3>
1982
- </div>
1983
- <div class="Card-bd">
1984
- <ul class="Card-option-list">
1985
- <li>
1986
- <p class="Card-description">
1987
- For more details on the following options, see <a href="//support.addthis.com/customer/portal/articles/381263-addthis-client-api">our customization documentation</a>.
1988
- Important: AddThis optimizes displayed services based on popularity and language, and personalizes the list for
1989
- each user. You may decrease sharing by overriding these features.
1990
- </p>
1991
- </li>
1992
- <li>
1993
- <label for="addthis_language">
1994
- <strong><?php _e("Language", 'addthis_trans_domain' ); ?></strong>
1995
- </label>
1996
- <select id="addthis_language" name="addthis_settings[addthis_language]">
1997
- <?php
1998
- $curlng = $options['addthis_language'];
1999
- foreach ($addthis_languages as $lng=>$name)
2000
- {
2001
- echo "<option value=\"$lng\"". ($lng == $curlng ? " selected='selected'":""). ">$name</option>";
2002
- }
2003
- ?>
2004
- </select>
2005
- </li>
2006
- <li>
2007
- <h4><strong>Global Advanced API Configuration</strong></h4>
2008
- <ul>
2009
- <li>
2010
- <label for="addthis_config_json">
2011
- <?php _e("addthis_config values (json format)", 'addthis_trans_domain' ); ?>
2012
- </label>
2013
- <br/>
2014
- <small>ex:- <i>{ "services_exclude": "print" }</i></small>
2015
- <div><p>For more information, please see the AddThis documentation on <a href="http://support.addthis.com/customer/portal/articles/1337994-the-addthis_config-variable">the addthis_config variable</a>.</p></div>
2016
- <textarea
2017
- id="addthis_config_json"
2018
- rows='3'
2019
- type="text"
2020
- name="addthis_settings[addthis_config_json]"
2021
- id="addthis-config-json"/><?php echo $options['addthis_config_json']; ?></textarea>
2022
- <span id="config-error" class="hidden error_text">Invalid JSON format</span>
2023
- </li>
2024
- <li>
2025
- <label for="addthis_share_json">
2026
- <?php _e("addthis_share values (json format)", 'addthis_trans_domain' ); ?>
2027
- </label>
2028
- <br/>
2029
- <small>ex:- <i>{ "url" : "http://www.yourdomain.com", "title" : "Custom Title" }</i></small>
2030
- <div><p>For more information, please see the AddThis documentation on <a href="http://support.addthis.com/customer/portal/articles/1337996-the-addthis_share-variable">the addthis_share variable</a>.</p></div>
2031
- <textarea
2032
- id="addthis_share_json"
2033
- rows='3'
2034
- type="text"
2035
- name="addthis_settings[addthis_share_json]"
2036
- id="addthis-share-json"/><?php echo $options['addthis_share_json']; ?></textarea>
2037
- <span id="share-error" class="hidden error_text">Invalid JSON format</span>
2038
- </li>
2039
- </ul>
2040
- </li>
2041
- </ul>
2042
- </div>
2043
- </div>
2044
 
2045
  <?php echo _addthis_profile_id_card($options['credential_validation_status']); ?>
2046
 
@@ -2114,30 +1875,6 @@ EOF;
2114
 
2115
  }
2116
 
2117
- /**
2118
- * Parse for the first twitter username in the given string
2119
- * @param String $raw_twitter_username Raw string containing twitter usernames
2120
- * @return String twitter username
2121
- */
2122
- if (! function_exists('get_first_twitter_username'))
2123
- {
2124
- function get_first_twitter_username($raw_twitter_username)
2125
- {
2126
- $twitter_username = '';
2127
- preg_match_all('/@(\w+)\b/i', $raw_twitter_username, $twitter_via_matches);
2128
- if (count($twitter_via_matches[1]) == 0) {
2129
- //To handle strings without @
2130
- preg_match_all('/(\w+)\b/i', $raw_twitter_username, $twitter_via_refined_matches);
2131
- if (count($twitter_via_refined_matches[1]) > 0) {
2132
- $twitter_username = $twitter_via_refined_matches[1][0];
2133
- }
2134
- } else {
2135
- $twitter_username = $twitter_via_matches[1][0];
2136
- }
2137
- return $twitter_username;
2138
- }
2139
- }
2140
-
2141
  // check for pro user
2142
  function at_share_is_pro_user() {
2143
  global $addThisConfigs;
@@ -2233,6 +1970,7 @@ function _addthis_profile_id_card($credential_validation_status = false) {
2233
  $noPubIdButtonText = "AddThis profile setup";
2234
  $pubIdDescription = 'To see analytics on social shares from your site, use the button below. It will take you to Analytics on addthis.com.';
2235
  $pubIdButtonText = "Your analytics on addthis.com";
 
2236
 
2237
  $securitySnippet = '';
2238
  if ($credential_validation_status == 1) {
@@ -2241,11 +1979,9 @@ function _addthis_profile_id_card($credential_validation_status = false) {
2241
 
2242
  // because i can't figure out how to bring these two in line... :-(
2243
  if ($addthis_options['addthis_plugin_controls'] != "AddThis") {
2244
- $fieldName = 'addthis_settings[addthis_profile]';
2245
  $security = '';
2246
  } else {
2247
- $fieldName = 'pubid';
2248
- $security = wp_nonce_field('update_' . $fieldName, $fieldName . '_nonce');
2249
  }
2250
 
2251
  if ($addThisConfigs->getProfileId()) {
@@ -2313,16 +2049,15 @@ function _addthis_mode_card() {
2313
 
2314
  $wordPressChecked = '';
2315
  $addThisChecked = '';
 
 
 
2316
  $checked = 'checked="checked"';
2317
  if ($addthis_options['addthis_plugin_controls'] != 'AddThis') {
2318
  $wordPressChecked = $checked;
2319
- $fieldName = 'addthis_settings[addthis_plugin_controls]';
2320
- $fieldId = 'addthis_plugin_controls';
2321
  $tbody = '<tbody></tbody>';
2322
  } else {
2323
  $addThisChecked = $checked;
2324
- $fieldName = 'addthis_plugin_controls';
2325
- $fieldId = 'downgrade-plugin';
2326
  $tbody = '
2327
  <tbody>
2328
  <tr>
@@ -2513,6 +2248,315 @@ function _addthis_mode_card() {
2513
  return $html;
2514
  }
2515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2516
  function _addthis_is_csr_form() {
2517
  global $addThisConfigs;
2518
 
@@ -2575,7 +2619,7 @@ function _addthis_settings_buttons($includePreview = true) {
2575
  *
2576
  * @return string
2577
  */
2578
- function addthis_profile_id_csr_confirmation($fieldName = 'addthis_settings[addthis_profile]')
2579
  {
2580
  global $cmsConnector;
2581
  global $addThisConfigs;
@@ -2586,6 +2630,7 @@ function addthis_profile_id_csr_confirmation($fieldName = 'addthis_settings[addt
2586
  }
2587
 
2588
  $submitButtonValue = "Confirm and Save Changes";
 
2589
 
2590
  $html = '<div class="Card">';
2591
 
@@ -2635,7 +2680,7 @@ function addthis_profile_id_csr_confirmation($fieldName = 'addthis_settings[addt
2635
  <input
2636
  type="hidden"
2637
  value="true"
2638
- name="addthis_settings[addthis_csr_confirmation]"
2639
  </li>
2640
  </ul>
2641
  <ul class="addthis-csr-button-list">
3
  * Plugin Name: AddThis Sharing Buttons
4
  * Plugin URI: http://www.addthis.com
5
  * Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
6
+ * Version: 5.0.5
7
  * Author: The AddThis Team
8
  * Author URI: http://www.addthis.com/
9
  * License: GPL2
31
  else return;
32
 
33
  define( 'addthis_style_default' , 'fb_tw_p1_sc');
 
 
34
  define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
35
 
36
  require_once('AddThisWordPressConnector.php');
42
 
43
  require_once('addthis_settings_functions.php');
44
 
45
+ $addthis_languages = array(
46
+ '' => 'Automatic',
47
+ 'af' => 'Afrikaaner',
48
+ 'ar' => 'Arabic',
49
+ 'zh' => 'Chinese',
50
+ 'cs' => 'Czech',
51
+ 'da' => 'Danish',
52
+ 'nl' => 'Dutch',
53
+ 'en' => 'English',
54
+ 'fa' => 'Farsi',
55
+ 'fi' => 'Finnish',
56
+ 'fr' => 'French',
57
+ 'ga' => 'Gaelic',
58
+ 'de' => 'German',
59
+ 'el' => 'Greek',
60
+ 'he' => 'Hebrew',
61
+ 'hi' => 'Hindi',
62
+ 'it' => 'Italian',
63
+ 'ja' => 'Japanese',
64
+ 'ko' => 'Korean',
65
+ 'lv' => 'Latvian',
66
+ 'lt' => 'Lithuanian',
67
+ 'no' => 'Norwegian',
68
+ 'pl' => 'Polish',
69
+ 'pt' => 'Portugese',
70
+ 'ro' => 'Romanian',
71
+ 'ru' => 'Russian',
72
+ 'sk' => 'Slovakian',
73
+ 'sl' => 'Slovenian',
74
+ 'es' => 'Spanish',
75
+ 'sv' => 'Swedish',
76
+ 'th' => 'Thai',
77
+ 'ur' => 'Urdu',
78
+ 'cy' => 'Welsh',
79
+ 'vi' => 'Vietnamese',
80
+ );
81
+
82
  /**
83
  * Show Plugin activation notice on first installation*
84
  */
121
 
122
  register_activation_hook( __FILE__, 'addthis_activation_hook' );
123
 
124
+ if (isset($_POST['addthis_plugin_controls'])) {
125
+ $newModeValue = $_POST['addthis_plugin_controls'];
126
+ } else if (isset($_POST['addthis_settings']['addthis_plugin_controls'])) {
127
+ $newModeValue = $_POST['addthis_settings']['addthis_plugin_controls'];
128
+ }
129
+
130
+ if ( isset($newModeValue)
131
+ && $newModeValue != $addthis_options['addthis_plugin_controls']
132
  ) {
133
+ if($newModeValue == 'AddThis') {
134
+ // the WordPress mode magically doesn't need this to switch modes appropriately
135
+ // probably because it handles settings correctly (registering them and then adding a hook for their sanitization)
136
+ // $addthis_options['addthis_plugin_controls'] = 'AddThis';
137
  } else {
138
+ $addthis_options['addthis_plugin_controls'] = 'WordPress';
139
  }
140
  $addthis_options = $addThisConfigs->saveConfigs($addthis_options);
141
  }
148
 
149
  if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
150
  require_once 'addthis-for-wordpress.php';
151
+ $addThisWordPress = new Addthis_Wordpress(isset($upgraded), $addThisConfigs, $cmsConnector);
152
  } else {
153
 
154
  // Show old version of the plugin till upgrade button is clicked
155
 
156
  // Add settings link on plugin page
157
+ function addthis_plugin_settings_link($links) {
158
  global $cmsConnector;
159
  $settings_link = '<a href="'.$cmsConnector->getSettingsPageUrl().'">Settings</a>';
160
  array_push($links, $settings_link);
162
  }
163
 
164
  $plugin = plugin_basename(__FILE__);
165
+ add_filter("plugin_action_links_$plugin", 'addthis_plugin_settings_link' );
166
 
167
 
168
  // Setup our shared resources early
169
  // addthis_addjs.php is a standard class shared by the various AddThis plugins to make it easy for us to include our bootstrapping JavaScript only once. Priority should be lowest for Share plugin.
170
  add_action('init', 'addthis_early', 0);
171
  function addthis_early(){
172
+ global $AddThis_addjs_sharing_button_plugin;
173
  global $addThisConfigs;
174
  global $cmsConnector;
175
+ if (!isset($AddThis_addjs_sharing_button_plugin)){
176
  require('addthis_addjs_new.php');
177
+ $AddThis_addjs_sharing_button_plugin = new AddThis_addjs_sharing_button_plugin($addThisConfigs, $cmsConnector);
178
  }
179
  }
180
 
185
  $addthis_settings['language'] = 'en';
186
  $addthis_settings['fallback_username'] = '';
187
  $addthis_settings['style'] = 'share';
 
188
  $addthis_settings['placement'] = ENABLE_ADDITIONAL_PLACEMENT_OPTION;
189
 
 
 
190
  $addthis_menu_types = array('static', 'dropdown', 'toolbox');
191
 
192
  $addthis_styles = array(
199
  );
200
 
201
  $addthis_options = get_option('addthis_settings');
202
+ $atversion = $addThisConfigs->getAddThisVersion();
203
 
204
  $addthis_new_styles = array(
205
  'large_toolbox' => array(
345
 
346
  $addthis_new_options['below'] = 'none';
347
 
 
 
 
 
 
 
348
  if ($language = get_option('addthis_language'))
349
  $addthis_new_options['addthis_language'] = $language;
350
 
369
  delete_option('addthis_aftertitle');
370
  delete_option('addthis_beforecomments');
371
  delete_option('addthis_style');
 
 
 
372
  delete_option('addthis_language');
373
  delete_option('atversion');
374
 
397
  global $addThisConfigs;
398
  $options = $addThisConfigs->getConfigs();
399
 
 
 
 
400
  //$options['wpfooter'] = false;
401
  $addThisConfigs->saveConfigs($options);
402
  }
726
  //[addthis_twitter_template]
727
  if ( isset ($data['addthis_twitter_template']) && strlen($data['addthis_twitter_template']) != 0 ) {
728
  //Parse the first twitter username to be used with via
729
+ $options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
730
  }
731
 
732
  $options['above'] = 'custom_string';
789
  'addthis_addressbar',
790
  'addthis_aftertitle' ,
791
  'addthis_append_data',
 
792
  'addthis_asynchronous_loading',
793
  'addthis_beforecomments',
794
  'addthis_below_enabled',
819
  //[addthis_twitter_template]
820
  if ( isset ($data['addthis_twitter_template'])) {
821
  //Parse the first twitter username to be used with via
822
+ $options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
823
  }
824
 
 
 
 
 
 
 
 
 
825
  //[addthis_language] =>
826
  if ( isset ($data['addthis_language']))
827
  $options['addthis_language'] = sanitize_text_field($data['addthis_language']);
838
  if ( isset ($data['credential_validation_status']))
839
  $options['credential_validation_status'] = sanitize_text_field($data['credential_validation_status']);
840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
841
  if (isset($data['addthis_config_json'])) {
842
  $options['addthis_config_json'] = sanitize_text_field($data['addthis_config_json']);
843
  }
882
  $options['addthis_plugin_controls'] = $data['addthis_plugin_controls'];
883
  }
884
 
885
+ if (isset($data['addthis_rate_us'])) {
886
+ $options['addthis_rate_us'] = $data['addthis_rate_us'];
887
+ $options['addthis_rate_us_timestamp'] = time();
888
+ }
889
+
890
+ return $options;
891
  }
892
 
893
 
1302
  add_action('wp_head', 'addthis_register_script_in_addjs', 20);
1303
 
1304
  function addthis_register_script_in_addjs(){
1305
+ global $AddThis_addjs_sharing_button_plugin;
1306
  $script = addthis_output_script(true, true);
1307
+ $AddThis_addjs_sharing_button_plugin->addToScript($script);
1308
 
1309
  $addthis_sidebar = addthis_sidebar_script();
1310
+ $AddThis_addjs_sharing_button_plugin->addAfterScript($addthis_sidebar);
1311
  }
1312
 
 
 
1313
  /**
1314
  * Check to see if our Javascript has been outputted yet. If it hasn't, return it. Else, return false.
1315
  *
1321
  global $cmsConnector;
1322
  $options = $addThisConfigs->getConfigs();
1323
 
1324
+ $addthis_config = $addThisConfigs->createAddThisConfigVariable();
1325
+ $addthis_config_js = '';
1326
+ if (!empty($addthis_config)) {
1327
+ $addthis_config_js = 'var addthis_config = '. json_encode($addthis_config) .';';
 
 
 
 
 
 
 
 
1328
  }
1329
 
1330
+ $addthis_share = $addThisConfigs->createAddThisShareVariable();
1331
+ $addthis_share_js = '';
1332
+ if (!empty($addthis_share)) {
1333
+ $addthis_share_js = 'var addthis_share = '. json_encode($addthis_share) .';';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1334
  }
1335
 
1336
+ if ($justConfig) {
1337
+ $script = "\n" . $addthis_config_js . "\n" . $addthis_share_js . "\n";
1338
+ return $script;
1339
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1340
 
1341
+ $async = '';
1342
+ if (!empty($addthis_config['addthis_asynchronous_loading'])) {
1343
+ $async = 'async="async"';
1344
  }
1345
 
1346
+ /**
1347
+ * Load client script based on the enviornment variable
1348
+ * Admin can enable debug mode in adv settings by adding url param debug=true
1349
+ */
1350
+ $script_domain = '//s7.addthis.com/js/';
1351
+ if (!empty($addthis_config['addthis_environment'])) {
1352
+ $at_env = $addthis_config['addthis_environment'];
1353
+ $script_domain = '//cache-'.$at_env.'.addthis.com/cachefly/js/';
1354
+ }
1355
 
1356
+ $url = $script_domain .
1357
+ $addthis_config['atversion'] .
1358
+ '/addthis_widget.js#pubid=' .
1359
+ urlencode($addThisConfigs->getUsableProfileId());
 
1360
 
1361
+ $script = '
1362
+ <!-- AddThis Settings Begin -->
1363
+ <script type="text/javascript">
1364
+ var addthis_product = "'. $cmsConnector->getProductVersion() . ';
1365
+ var wp_product_version = "' . $this->cmsConnector->getProductVersion() . ';
1366
+ var wp_blog_version = "' . $this->cmsConnector->getCmsVersion() . ';
1367
+ if (typeof(addthis_config) == "undefined") {
1368
+ ' . $addthis_config_js . '
1369
+ }
1370
+ if (typeof(addthis_share) == "undefined") {
1371
+ ' . $addthis_share_js . '
1372
+ }
1373
+ </script>
1374
+ <script
1375
+ type="text/javascript"
1376
+ src="' . $url . '"
1377
+ ' . $async . '
1378
+ >
1379
+ </script>
1380
+ ';
1381
 
1382
+ if (!is_admin() && !is_feed()) {
1383
  echo $script;
1384
+ } elseif ($return && !is_admin() && !is_feed()) {
1385
  return $script;
1386
+ }
1387
  }
1388
 
1389
  function addthis_sidebar_script(){
1430
  return $return;
1431
  }
1432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1433
  /**
1434
  * Appends AddThis button to post content.
1435
  */
1566
  <div class="wrap">
1567
  <h2 class='placeholder'>&nbsp;</h2>
1568
 
1569
+ <form
1570
+ id="addthis-settings"
1571
+ method="post"
1572
+ action="options.php"
1573
+ >
1574
  <?php
1575
  // use the old-school settings style in older versions of wordpress
1576
  if ( $cmsConnector->getCmsMinorVersion() >= 2.7
1610
  add_action('init', 'addthis_init');
1611
 
1612
  function addthis_wordpress_mode_tabs() {
 
 
1613
  global $addThisConfigs;
1614
  global $cmsConnector;
1615
 
1794
  </div>
1795
  </div>
1796
  </div>
1797
+ <?php echo _addthis_rate_us_card(); ?>
1798
  </div>
1799
  <div id="tabs-2">
1800
+ <?php echo _addthis_tracking_card(); ?>
1801
 
1802
+ <?php echo _addthis_display_options_card(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1803
 
1804
+ <?php echo _addthis_additional_options_card(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1805
 
1806
  <?php echo _addthis_profile_id_card($options['credential_validation_status']); ?>
1807
 
1875
 
1876
  }
1877
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1878
  // check for pro user
1879
  function at_share_is_pro_user() {
1880
  global $addThisConfigs;
1970
  $noPubIdButtonText = "AddThis profile setup";
1971
  $pubIdDescription = 'To see analytics on social shares from your site, use the button below. It will take you to Analytics on addthis.com.';
1972
  $pubIdButtonText = "Your analytics on addthis.com";
1973
+ $fieldName = 'addthis_settings[addthis_profile]';
1974
 
1975
  $securitySnippet = '';
1976
  if ($credential_validation_status == 1) {
1979
 
1980
  // because i can't figure out how to bring these two in line... :-(
1981
  if ($addthis_options['addthis_plugin_controls'] != "AddThis") {
 
1982
  $security = '';
1983
  } else {
1984
+ $security = wp_nonce_field('update_pubid', 'pubid_nonce');
 
1985
  }
1986
 
1987
  if ($addThisConfigs->getProfileId()) {
2049
 
2050
  $wordPressChecked = '';
2051
  $addThisChecked = '';
2052
+ $fieldName = 'addthis_settings[addthis_plugin_controls]';
2053
+ $fieldId = 'addthis_plugin_controls';
2054
+
2055
  $checked = 'checked="checked"';
2056
  if ($addthis_options['addthis_plugin_controls'] != 'AddThis') {
2057
  $wordPressChecked = $checked;
 
 
2058
  $tbody = '<tbody></tbody>';
2059
  } else {
2060
  $addThisChecked = $checked;
 
 
2061
  $tbody = '
2062
  <tbody>
2063
  <tr>
2248
  return $html;
2249
  }
2250
 
2251
+ function _addthis_tracking_card() {
2252
+ global $addThisConfigs;
2253
+ $options = $addThisConfigs->getConfigs();
2254
+
2255
+ $checkedString = 'checked="checked"';
2256
+ $clickbacksChecked = "";
2257
+ $addressBarChecked = "";
2258
+ $bitlyChecked = "";
2259
+ if (!empty($options['addthis_append_data'])) {
2260
+ $clickbacksChecked = $checkedString;
2261
+ }
2262
+ if (!empty($options['addthis_addressbar'])) {
2263
+ $addressBarChecked = $checkedString;
2264
+ }
2265
+ if (!empty($options['addthis_bitly'])) {
2266
+ $bitlyChecked = $checkedString;
2267
+ }
2268
+
2269
+ $html = '
2270
+ <div class="Card">
2271
+ <div class="Card-hd">
2272
+ <h3 class="Card-hd-title">Tracking</h3>
2273
+ </div>
2274
+ <div class="Card-bd">
2275
+ <ul class="Card-option-list">
2276
+ <li>
2277
+ <ul>
2278
+ <li>
2279
+ <input
2280
+ id="addthis_append_data"
2281
+ type="checkbox"
2282
+ name="addthis_settings[addthis_append_data]"
2283
+ value="true"' . $clickbacksChecked . '/>
2284
+ <label for="addthis_append_data">
2285
+ <span class="addthis-checkbox-label">
2286
+ <strong>' . translate("Clickbacks", 'addthis_trans_domain') . '</strong>
2287
+ (Recommended)
2288
+ </span>
2289
+ </label>
2290
+ <span class="at-wp-tooltip" tooltip="AddThis will use this to track how many people come back to your content via links shared with AddThis buttons. This data will be available to you at addthis.com.">?</span>
2291
+ </li>
2292
+ <li>
2293
+ <input
2294
+ type="checkbox"
2295
+ id="addthis_addressbar"
2296
+ name="addthis_settings[addthis_addressbar]"
2297
+ value="true"' . $addressBarChecked . '/>
2298
+ <label for="addthis_addressbar">
2299
+ <span class="addthis-checkbox-label">
2300
+ <strong>' . translate("Address bar shares", 'addthis_trans_domain') . '</strong>
2301
+ </span>
2302
+ </label>
2303
+ <span class="at-wp-tooltip" tooltip="AddThis will append a code to your site’s URLs (except for the homepage) to track when a visitor comes to your site from a link someone copied out of their browser\'s address bar.">?</span>
2304
+ </li>
2305
+ <li>
2306
+ <input
2307
+ id="addthis_bitly"
2308
+ type="checkbox"
2309
+ name="addthis_settings[addthis_bitly]"
2310
+ value="true" ' . $bitlyChecked . '/>
2311
+ <label for="addthis_bitly">
2312
+ <span class="addthis-checkbox-label">
2313
+ <strong>' . translate("Bitly URL shortening for Twitter", 'addthis_trans_domain') . '</strong>
2314
+ </span>
2315
+ </label>
2316
+ <span class="at-wp-tooltip" tooltip="Your Bitly login and key will need to be setup with your profile on addthis.com before Bitly will begin working with WordPress.">?</span>
2317
+ </li>
2318
+ </ul>
2319
+ </li>
2320
+ <li>
2321
+ <label for="data_ga_property">
2322
+ <strong>' . translate("Google Analytics property ID", 'addthis_trans_domain') . '</strong>
2323
+ </label>
2324
+ <input
2325
+ id="data_ga_property"
2326
+ type="text"
2327
+ name="addthis_settings[data_ga_property]"
2328
+ value="' . $options['data_ga_property'] . '"/>
2329
+ </li>
2330
+ </ul>
2331
+ </div>
2332
+ </div>
2333
+ ';
2334
+
2335
+ return $html;
2336
+ }
2337
+
2338
+ function _addthis_display_options_card() {
2339
+ global $addThisConfigs;
2340
+ $options = $addThisConfigs->getConfigs();
2341
+
2342
+ $checkedString = 'checked="checked"';
2343
+ $asyncChecked = "";
2344
+ $a508Checked = "";
2345
+ if (!empty($options['addthis_asynchronous_loading'])) {
2346
+ $asyncChecked = $checkedString;
2347
+ }
2348
+ if (!empty($options['addthis_508'])) {
2349
+ $a508Checked = $checkedString;
2350
+ }
2351
+
2352
+ $html = '
2353
+ <div class="Card">
2354
+ <div class="Card-hd">
2355
+ <h3 class="Card-hd-title">Display Options</h3>
2356
+ </div>
2357
+ <div class="Card-bd">
2358
+ <ul class="Card-option-list">
2359
+ <li>
2360
+ <ul>
2361
+ <li>
2362
+ <input
2363
+ id="addthis_asynchronous_loading"
2364
+ type="checkbox"
2365
+ name="addthis_settings[addthis_asynchronous_loading]"
2366
+ value="true" ' . $asyncChecked . ' />
2367
+ <label for="addthis_asynchronous_loading">
2368
+ <span class="addthis-checkbox-label">
2369
+ <strong>' . translate("Asynchronous loading", 'addthis_trans_domain') . '</strong>
2370
+ (Recommended)
2371
+ </span>
2372
+ </label>
2373
+ <span class="at-wp-tooltip" tooltip="When checked, your site will load before AddThis sharing buttons are added. If unchecked, your site will not load until AddThis buttons (and AddThis JavaScript) have been loaded by your vistors.">?</span>
2374
+ </li>
2375
+ <li>
2376
+ <input
2377
+ id="addthis_508"
2378
+ type="checkbox"
2379
+ name="addthis_settings[addthis_508]" v
2380
+ alue="true" ' . $a508Checked . ' />
2381
+ <label for="addthis_508">
2382
+ <span class="addthis-checkbox-label">
2383
+ <strong>' . translate("Enhanced accessibility", 'addthis_trans_domain') . '</strong>
2384
+ </span>
2385
+ </label>
2386
+ <span class="at-wp-tooltip" tooltip="Also known as 508 compliance. If checked, clicking an AddThis sharing button will open a new window to a page that is keyboard navigable for people with disabilities.">?</span>
2387
+ </li>
2388
+ </ul>
2389
+ </li>
2390
+ <li>
2391
+ <label id="addthis_twitter_template">
2392
+ <strong>' . translate("Twitter via", 'addthis_trans_domain') . '</strong>
2393
+ <span class="at-wp-tooltip" tooltip="When a visitor uses an AddThis button to send a tweet about your page, this will be used within Twitter to identify through whom they found your page. You would usually enter a twitter handle here. For example, Twitter could show a tweet came from jsmith via AddThis.">?</span>
2394
+ </label>
2395
+ <input
2396
+ id="addthis_twitter_template"
2397
+ type="text"
2398
+ name="addthis_settings[addthis_twitter_template]"
2399
+ value="' . $options['addthis_twitter_template'] . '" />
2400
+ </li>
2401
+ </ul>
2402
+ </div>
2403
+ </div>
2404
+ ';
2405
+
2406
+ return $html;
2407
+ }
2408
+
2409
+ function _addthis_additional_options_card() {
2410
+ global $addthis_languages;
2411
+ global $addThisConfigs;
2412
+ $options = $addThisConfigs->getConfigs();
2413
+
2414
+ $curlng = $options['addthis_language'];
2415
+ $languageDropdown = '';
2416
+ foreach ($addthis_languages as $lng=>$name)
2417
+ {
2418
+ $languageDropdown .= '
2419
+ <option
2420
+ value="'. $lng . '"'
2421
+ . ($lng == $curlng ? ' selected="selected"':'') . '"
2422
+ >
2423
+ '.$name.'
2424
+ </option>'."\n";
2425
+ }
2426
+
2427
+ $html = '
2428
+ <div class="Card">
2429
+ <div class="Card-hd">
2430
+ <h3 class="Card-hd-title">Additional Options</h3>
2431
+ </div>
2432
+ <div class="Card-bd">
2433
+ <ul class="Card-option-list">
2434
+ <li>
2435
+ <p class="Card-description">
2436
+ For more details on the following options, see <a href="//support.addthis.com/customer/portal/articles/381263-addthis-client-api">our customization documentation</a>.
2437
+ Important: AddThis optimizes displayed services based on popularity and language, and personalizes the list for
2438
+ each user. You may decrease sharing by overriding these features.
2439
+ </p>
2440
+ </li>
2441
+ <li>
2442
+ <label for="addthis_language">
2443
+ <strong>' . translate("Language", 'addthis_trans_domain') . '</strong>
2444
+ </label>
2445
+ <select id="addthis_language" name="addthis_settings[addthis_language]">
2446
+ ' . $languageDropdown . '
2447
+ </select>
2448
+ </li>
2449
+ <li>
2450
+ <h4><strong>Global Advanced API Configuration</strong></h4>
2451
+ <ul>
2452
+ <li>
2453
+ <label for="addthis_config_json">
2454
+ <?php ' . translate("addthis_config values (json format)", 'addthis_trans_domain') . '
2455
+ </label>
2456
+ <br/>
2457
+ <small>ex:- <i>{ "services_exclude": "print" }</i></small>
2458
+ <div><p>For more information, please see the AddThis documentation on <a href="http://support.addthis.com/customer/portal/articles/1337994-the-addthis_config-variable">the addthis_config variable</a>.</p></div>
2459
+ <textarea
2460
+ id="addthis_config_json"
2461
+ rows="3"
2462
+ type="text"
2463
+ name="addthis_settings[addthis_config_json]"
2464
+ id="addthis-config-json"/>' . $options['addthis_config_json'] . '</textarea>
2465
+ <span id="config-error" class="hidden error_text">Invalid JSON format</span>
2466
+ </li>
2467
+ <li>
2468
+ <label for="addthis_share_json">
2469
+ ' . translate("addthis_share values (json format)", 'addthis_trans_domain') . '
2470
+ </label>
2471
+ <br/>
2472
+ <small>ex:- <i>{ "url" : "http://www.yourdomain.com", "title" : "Custom Title" }</i></small>
2473
+ <div><p>For more information, please see the AddThis documentation on <a href="http://support.addthis.com/customer/portal/articles/1337996-the-addthis_share-variable">the addthis_share variable</a>.</p></div>
2474
+ <textarea
2475
+ id="addthis_share_json"
2476
+ rows="3"
2477
+ type="text"
2478
+ name="addthis_settings[addthis_share_json]"
2479
+ id="addthis-share-json"/>' . $options['addthis_share_json'] . '</textarea>
2480
+ <span id="share-error" class="hidden error_text">Invalid JSON format</span>
2481
+ </li>
2482
+ </ul>
2483
+ </li>
2484
+ </ul>
2485
+ </div>
2486
+ </div>
2487
+ ';
2488
+
2489
+ return $html;
2490
+ }
2491
+
2492
+ function _addthis_rate_us_card() {
2493
+ global $addThisConfigs;
2494
+ $options = $addThisConfigs->getConfigs();
2495
+
2496
+ $html = '
2497
+ <div class="Card" id="addthis_do_you_like_us">
2498
+ <div class="Card-hd">
2499
+ <h3 class="Card-hd-title">Did you find this plugin useful?</h3>
2500
+ </div>
2501
+
2502
+ <div class="Card-bd" id="addthis_like_us_answers">
2503
+ <div class="Btn-container-card">
2504
+ <a class="Btn Btn-blue" id="addthis_dislike_confirm"> Not really </a>
2505
+ <a class="Btn Btn-blue" id="addthis_like_confirm"> Yes! </a>
2506
+ </div>
2507
+
2508
+ <input
2509
+ type="hidden"
2510
+ value="' . $options['addthis_rate_us'] . '"
2511
+ id="addthis_rate_us"
2512
+ name="addthis_settings[addthis_rate_us]" >
2513
+ </div>
2514
+
2515
+ <div class="Card-bd" id="addthis_dislike">
2516
+ <div class="addthis_description">
2517
+ <p class="Card-description">
2518
+ Let us know how we can improve our plugin through our support forum or by emailing <a href="mailto:help@addthis.com">help@addthis.com</a>.
2519
+ </p>
2520
+ </div>
2521
+ <div class="Btn-container-card">
2522
+ <a
2523
+ class="Btn Btn-blue"
2524
+ target="_blank"
2525
+ href="https://wordpress.org/support/plugin/addthis"> Support Forum &#8594;
2526
+ </a>
2527
+ <a
2528
+ class="Btn Btn-blue"
2529
+ target="_blank"
2530
+ href="mailto:help@addthis.com"> Email &#8594;
2531
+ </a>
2532
+ </div>
2533
+ </div>
2534
+
2535
+ <div class="Card-bd" id="addthis_like">
2536
+ <div class="addthis_description">
2537
+ <p class="Card-description">
2538
+ How about rating us?
2539
+ </p>
2540
+ <h3 id="addthis_rating_thank_you">Thank you!</h3>
2541
+ </div>
2542
+ <div class="Btn-container-card">
2543
+ <a
2544
+ class="Btn Btn-blue" id="addthis_not_rating"> No, thanks.
2545
+ </a>
2546
+ <a
2547
+ class="Btn Btn-blue" id="addthis_rating"
2548
+ target="_blank"
2549
+ href="https://wordpress.org/support/view/plugin-reviews/addthis#postform"> Yes, I will rate this plugin &#8594;
2550
+ </a>
2551
+ </div>
2552
+ </div>
2553
+
2554
+ </div>
2555
+ ';
2556
+
2557
+ return $html;
2558
+ }
2559
+
2560
  function _addthis_is_csr_form() {
2561
  global $addThisConfigs;
2562
 
2619
  *
2620
  * @return string
2621
  */
2622
+ function addthis_profile_id_csr_confirmation()
2623
  {
2624
  global $cmsConnector;
2625
  global $addThisConfigs;
2630
  }
2631
 
2632
  $submitButtonValue = "Confirm and Save Changes";
2633
+ $fieldName = 'addthis_settings[addthis_profile]';
2634
 
2635
  $html = '<div class="Card">';
2636
 
2680
  <input
2681
  type="hidden"
2682
  value="true"
2683
+ name="addthis_settings[addthis_csr_confirmation]" >
2684
  </li>
2685
  </ul>
2686
  <ul class="addthis-csr-button-list">
css/output.css CHANGED
@@ -34,4 +34,8 @@
34
  div.addthis_toolbox a,
35
  a.at-share-btn {
36
  border: 0;
 
 
 
 
37
  }
34
  div.addthis_toolbox a,
35
  a.at-share-btn {
36
  border: 0;
37
+ }
38
+
39
+ div.addthis_toolbox br {
40
+ display: none
41
  }
js/options-page.32.js CHANGED
@@ -42,6 +42,45 @@ jQuery(document).ready(function($) {
42
  }
43
  };
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  $('a.thickbox-preview').click( function() {
47
 
42
  }
43
  };
44
 
45
+ $('#addthis_rating_thank_you').hide()
46
+ switch($('#addthis_rate_us').val()) {
47
+ case 'dislike':
48
+ $('#addthis_like_us_answers').hide();
49
+ $('#addthis_dislike').show();
50
+ $('#addthis_like').hide();
51
+ break;
52
+ case 'like':
53
+ $('#addthis_like_us_answers').hide();
54
+ $('#addthis_dislike').hide();
55
+ $('#addthis_like').show();
56
+ break;
57
+ case 'will not rate':
58
+ case 'rated':
59
+ $('#addthis_do_you_like_us').hide()
60
+ break;
61
+ default:
62
+ $('#addthis_dislike').hide();
63
+ $('#addthis_like').hide();
64
+ }
65
+
66
+ $('#addthis_dislike_confirm').click(function() {
67
+ $('#addthis_like_us_answers').hide();
68
+ $('#addthis_dislike').show();
69
+ $('#addthis_rate_us').val('dislike')
70
+ });
71
+ $('#addthis_like_confirm').click(function() {
72
+ $('#addthis_like_us_answers').hide();
73
+ $('#addthis_like').show();
74
+ $('#addthis_rate_us').val('like')
75
+ });
76
+ $('#addthis_not_rating').click(function() {
77
+ $('#addthis_do_you_like_us').hide()
78
+ $('#addthis_rate_us').val('will not rate')
79
+ });
80
+ $('#addthis_rating').click(function() {
81
+ $('#addthis_rating_thank_you').show()
82
+ $('#addthis_rate_us').val('rated')
83
+ });
84
 
85
  $('a.thickbox-preview').click( function() {
86
 
js/options-page.js CHANGED
@@ -39,6 +39,46 @@ jQuery(document).ready(function($) {
39
  }
40
  };
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  $('a.thickbox-preview').click( function() {
44
 
39
  }
40
  };
41
 
42
+ $('#addthis_rating_thank_you').hide()
43
+
44
+ switch($('#addthis_rate_us').val()) {
45
+ case 'dislike':
46
+ $('#addthis_like_us_answers').hide();
47
+ $('#addthis_dislike').show();
48
+ $('#addthis_like').hide();
49
+ break;
50
+ case 'like':
51
+ $('#addthis_like_us_answers').hide();
52
+ $('#addthis_dislike').hide();
53
+ $('#addthis_like').show();
54
+ break;
55
+ case 'will not rate':
56
+ case 'rated':
57
+ $('#addthis_do_you_like_us').hide()
58
+ break;
59
+ default:
60
+ $('#addthis_dislike').hide();
61
+ $('#addthis_like').hide();
62
+ }
63
+
64
+ $('#addthis_dislike_confirm').click(function() {
65
+ $('#addthis_like_us_answers').hide();
66
+ $('#addthis_dislike').show();
67
+ $('#addthis_rate_us').val('dislike')
68
+ });
69
+ $('#addthis_like_confirm').click(function() {
70
+ $('#addthis_like_us_answers').hide();
71
+ $('#addthis_like').show();
72
+ $('#addthis_rate_us').val('like')
73
+ });
74
+ $('#addthis_not_rating').click(function() {
75
+ $('#addthis_do_you_like_us').hide()
76
+ $('#addthis_rate_us').val('will not rate')
77
+ });
78
+ $('#addthis_rating').click(function() {
79
+ $('#addthis_rating_thank_you').show()
80
+ $('#addthis_rate_us').val('rated')
81
+ });
82
 
83
  $('a.thickbox-preview').click( function() {
84
 
readme.txt CHANGED
@@ -1,26 +1,15 @@
1
- === Smart Website Tools by AddThis ===
2
  Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, mkitzman, kirk-at-addthis, addthis_paul, addthis_matt, addthis_elsa, ribin_addthis
3
  Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools
4
  Requires at least: 3.0
5
  Tested up to: 4.2.2
6
- Stable tag: 5.0.4
7
 
8
- AddThis provides the best sharing, social, recommended content, and conversion tools to help you make
9
- your website smarter.
10
 
11
  == Description ==
12
 
13
- Traditionally known as the "sharing tool", AddThis has taken website tools to the next level through the creation of recommended content and conversion tools while also streamlining and evolving their suite of social tools, including sharing and following buttons.
14
-
15
- **Social Tools:** Promote your content easily by sharing to over 200 of the most popular social networking and bookmarking sites (like Facebook, Twitter, Pinterest, Google+, WhatsApp, LinkedIn and more). Clean, customizable and simple social buttons are unobtrusive, quick to load and recognized all over the web.
16
-
17
- **Recommended Content Tools:** Keep visitors on your site longer with the use of our recommended content based on what’s trending, giving your user a unique experience and keeps them engaged with your content longer.
18
-
19
- **Conversion Tools:** Reach business goals quickly with the use of our conversion tools, including email subscriptions, event registration and more.
20
-
21
- **Analytics:** Use the AddThis dashboard to find out how your visitors are sharing content, what content is trending, which services visitors for sharing, how many more followers you’ve gotten, and much, much more.
22
-
23
- Many of our tools are free, but Pro users get the benefit of exclusive widgets, including mobile-friendly tools and retina display buttons, priority support and deeper analytics.
24
 
25
  == Installation ==
26
 
@@ -74,12 +63,11 @@ In the screen options you can enable the AddThis meta box. Check the box and sav
74
 
75
  1. Sharing Tools tab on the plugin settings page (WordPress mode)
76
  2. Sharing Tools tab on the plugin settings page (WordPress mode)
77
- 3. Advanced Options tab on the plugin settings page (WordPress mode)
78
  4. Sharing Tools tab on the plugin settings page (AddThis mode)
79
- 5. Advanced Options tab on the plugin settings page (AddThis mode)
80
- 6. Analytics on the AddThis Dashboard
81
- 7. Tool Gallery on the AddThis Dashboard
82
- 8. Customization options on the AddThis Dashboard
83
 
84
  == PHP Version ==
85
 
@@ -87,6 +75,13 @@ PHP 5+ is preferred; PHP 4 is supported.
87
 
88
  == Changelog ==
89
 
 
 
 
 
 
 
 
90
  = 5.0.4 =
91
  * PHP error fixes for strict modes of PHP
92
 
@@ -337,6 +332,13 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
337
 
338
  == Upgrade Notice ==
339
 
 
 
 
 
 
 
 
340
  = 5.0.3 =
341
  * Two functional modes allowing users to choose whether to control sharing buttons from within the WordPress admin area (with limited features), or through the AddThis Dashboard at addthis.com.
342
  * Sharing sidebar configuration available within WordPress (in addition to the previously available sharing buttons above and below content).
1
+ === AddThis Sharing Buttons ===
2
  Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, mkitzman, kirk-at-addthis, addthis_paul, addthis_matt, addthis_elsa, ribin_addthis
3
  Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools
4
  Requires at least: 3.0
5
  Tested up to: 4.2.2
6
+ Stable tag: 5.0.5
7
 
8
+ AddThis provides the best sharing tools to help you make your website smarter.
 
9
 
10
  == Description ==
11
 
12
+ The best sharing and following tools on the web are now available for your WordPress site. Promote your content easily by sharing to over 200 of the most popular social networking and bookmarking sites (like Facebook, Twitter, Pinterest, Google+, WhatsApp, LinkedIn and more). Clean, customizable and simple social buttons are unobtrusive, quick to load and recognized all over the web.
 
 
 
 
 
 
 
 
 
 
13
 
14
  == Installation ==
15
 
63
 
64
  1. Sharing Tools tab on the plugin settings page (WordPress mode)
65
  2. Sharing Tools tab on the plugin settings page (WordPress mode)
66
+ 3. Advanced Options tab on the plugin settings page
67
  4. Sharing Tools tab on the plugin settings page (AddThis mode)
68
+ 5. Analytics on the AddThis Dashboard
69
+ 6. Tool Gallery on the AddThis Dashboard
70
+ 7. Customization options on the AddThis Dashboard
 
71
 
72
  == PHP Version ==
73
 
75
 
76
  == Changelog ==
77
 
78
+ = 5.0.5 =
79
+ * Adding all WordPress mode Advanced Options to AddThis mode Advanced Options. These are primarily options to edit the addthis_share and addthis_config JavaScript variables used by AddThis tools, as well as giving you the option to choose whether to load the AddThis script asyncronously.
80
+ * Removing conflicts with WordPress Login Box plugin
81
+ * Removing conflicts with AddThis Follow Widget plugin
82
+ * CSS to remove new lines from br tags between our buttons, because some themes add them and break stuff (Thanks Customizr)
83
+ * Exposing more objects for use with adding sharing buttons to troublesome themes
84
+
85
  = 5.0.4 =
86
  * PHP error fixes for strict modes of PHP
87
 
332
 
333
  == Upgrade Notice ==
334
 
335
+ = 5.0.5 =
336
+ * Adding all WordPress mode Advanced Options to AddThis mode Advanced Options. These are primarily options to edit the addthis_share and addthis_config JavaScript variables used by AddThis tools, as well as giving you the option to choose whether to load the AddThis script asyncronously.
337
+ * Removing conflicts with WordPress Login Box plugin
338
+ * Removing conflicts with AddThis Follow Widget plugin
339
+ * CSS to remove new lines from br tags between our buttons, because some themes add them and break stuff (Thanks Customizr)
340
+ * Exposing more objects for use with adding sharing buttons to troublesome themes
341
+
342
  = 5.0.3 =
343
  * Two functional modes allowing users to choose whether to control sharing buttons from within the WordPress admin area (with limited features), or through the AddThis Dashboard at addthis.com.
344
  * Sharing sidebar configuration available within WordPress (in addition to the previously available sharing buttons above and below content).