WordPress Share Buttons Plugin – AddThis - Version 4.0

Version Description

  • Integrated with AddThis Dashboard.
Download this release

Release Info

Developer srijith.v
Plugin Icon 128x128 WordPress Share Buttons Plugin – AddThis
Version 4.0
Comparing to
See all releases

Code changes from version 3.5.10 to 4.0

addthis-for-wordpress.php ADDED
@@ -0,0 +1,530 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2012 Add This, LLC |
5
+ * +--------------------------------------------------------------------------+
6
+ * | This program is free software; you can redistribute it and/or modify |
7
+ * | it under the terms of the GNU General Public License as published by |
8
+ * | the Free Software Foundation; either version 2 of the License, or |
9
+ * | (at your option) any later version. |
10
+ * | |
11
+ * | This program is distributed in the hope that it will be useful, |
12
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
+ * | GNU General Public License for more details. |
15
+ * | |
16
+ * | You should have received a copy of the GNU General Public License |
17
+ * | along with this program; if not, write to the Free Software |
18
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
19
+ * +--------------------------------------------------------------------------+
20
+ *
21
+ * PHP version 5.3.6
22
+ *
23
+ * @category Class
24
+ * @package Wordpress_Plugin
25
+ * @author The AddThis Team <srijith@addthis.com>
26
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
27
+ * @version SVN: 1.0
28
+ * @link http://www.addthis.com/blog
29
+ */
30
+ $pathParts = pathinfo(__FILE__);
31
+
32
+ $path = $pathParts['dirname'];
33
+
34
+ if (!defined('ADDTHIS_PLUGIN_VERSION')) {
35
+ define('ADDTHIS_PLUGIN_VERSION', '3.5.11');
36
+ }
37
+
38
+ if (!defined('ADDTHIS_ATVERSION')) {
39
+ define('ADDTHIS_ATVERSION', '300');
40
+ }
41
+
42
+ define('ADDTHIS_CSS_PATH', 'css/style.css');
43
+ define('ADDTHIS_JS_PATH', 'js/addthis-for-wordpress.js');
44
+ define('ADDTHIS_SETTINGS_PAGE_ID', 'addthis_social_widget');
45
+ define('ADDTHIS_PLUGIN_FILE', $path.'/addthis_social_widget.php');
46
+ define('ADDTHIS_PUBNAME_LIMIT', 255);
47
+
48
+ /**
49
+ * Class for Addthis wordpress
50
+ *
51
+ * @category Class
52
+ * @package Wordpress_Plugin
53
+ * @author The AddThis Team <srijith@addthis.com>
54
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
55
+ * @version Release: 1.0
56
+ * @link http://www.addthis.com/blog
57
+ */
58
+ class Addthis_Wordpress
59
+ {
60
+ const ADDTHIS_PROFILE_SETTINGS_PAGE = 'https://www.addthis.com/settings/publisher';
61
+ const ADDTHIS_SITE_URL = 'https://www.addthis.com/settings/plugin-pubs';
62
+ const ADDTHIS_SITE_URL_WITH_PUB = 'https://www.addthis.com/dashboard#gallery';
63
+ const ADDTHIS_REFERER = 'www.addthis.com';
64
+
65
+ /** PHP $_GET Variables * */
66
+ private $_getVariables;
67
+
68
+ /** PHP $_POST Variables * */
69
+ private $_postVariables;
70
+
71
+ /** check upgrade or fresh installation **/
72
+ private $_upgrade;
73
+
74
+ /**
75
+ * Initializes the plugin.
76
+ *
77
+ * @param boolean $upgrade check upgrade or fresh installation
78
+ *
79
+ * @return null
80
+ * */
81
+ public function __construct($upgrade)
82
+ {
83
+ $this->_upgrade = $upgrade;
84
+ $this->_getVariables = $_GET;
85
+ $this->_postVariables = $_POST;
86
+
87
+ include_once 'addthis-toolbox.php';
88
+ new Addthis_ToolBox;
89
+
90
+ add_action('admin_menu', array($this, 'addthisWordpressMenu'));
91
+
92
+ // Deactivation
93
+ register_deactivation_hook(
94
+ ADDTHIS_PLUGIN_FILE,
95
+ array($this, 'pluginDeactivation')
96
+ );
97
+
98
+ // Settings link in plugins page
99
+ $plugin = 'addthis/addthis_social_widget.php';
100
+ add_filter(
101
+ "plugin_action_links_$plugin",
102
+ array($this, 'addSettingsLink')
103
+ );
104
+ }
105
+
106
+ /*
107
+ * Function to add settings link in plugins page
108
+ *
109
+ * @return null
110
+ */
111
+ public function addSettingsLink($links)
112
+ {
113
+ $settingsLink = '<a href="'.self::getSettingsPageUrl().'">Settings</a>';
114
+ array_push($links, $settingsLink);
115
+ return $links;
116
+ }
117
+
118
+ /**
119
+ * Functions to execute on plugin deactivation
120
+ *
121
+ * @return null
122
+ */
123
+ public function pluginDeactivation()
124
+ {
125
+ if (get_option('addthis_run_once')) {
126
+ delete_option('addthis_run_once');
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Adds sub menu page to the WP settings menu
132
+ *
133
+ * @return null
134
+ */
135
+ public function addthisWordpressMenu()
136
+ {
137
+ add_options_page(
138
+ 'AddThis for Wordpress', 'AddThis for Wordpress',
139
+ 'manage_options', ADDTHIS_SETTINGS_PAGE_ID,
140
+ array($this, 'addthisWordpressOptions')
141
+ );
142
+ }
143
+
144
+ /**
145
+ * Manages the WP settings page
146
+ *
147
+ * @return null
148
+ */
149
+ public function addthisWordpressOptions()
150
+ {
151
+ if (!current_user_can('manage_options')) {
152
+ wp_die(
153
+ __('You do not have sufficient permissions to access this page.')
154
+ );
155
+ }
156
+
157
+ $updateResult = null;
158
+
159
+ if ($this->_checkAddPubid()) {
160
+ $updateResult = $this->updatePubid($this->_postVariables['pubid']);
161
+ }
162
+ wp_enqueue_script(
163
+ 'addThisScript',
164
+ plugins_url(ADDTHIS_JS_PATH, __FILE__)
165
+ );
166
+ wp_enqueue_style(
167
+ 'addThisStylesheet',
168
+ plugins_url(ADDTHIS_CSS_PATH, __FILE__)
169
+ );
170
+ echo $this->_getHTML($updateResult);
171
+ }
172
+
173
+ /**
174
+ * Updates addthis profile id
175
+ *
176
+ * @param string $pubId Addthis public id
177
+ *
178
+ * @return string
179
+ */
180
+ public static function updatePubid($pubId)
181
+ {
182
+ global $addthis_addjs;
183
+ $addthis_addjs->setProfileId($pubId);
184
+ return "<div class='addthis_updated wrap'>".
185
+ "AddThis Profile ID updated successfully!!!".
186
+ "</div>";
187
+ }
188
+
189
+ /**
190
+ * Get addthis profile id
191
+ *
192
+ * @return string
193
+ */
194
+ public static function getPubid()
195
+ {
196
+ $settings = get_option('addthis_settings');
197
+ if (isset($settings) && isset($settings['profile'])) {
198
+ return $settings['profile'];
199
+ } else {
200
+ return null;
201
+ }
202
+ }
203
+
204
+ /**
205
+ * Get referer url
206
+ *
207
+ * @return string
208
+ */
209
+ private function _getReferelUrl()
210
+ {
211
+ $referer = '';
212
+ if (isset($_SERVER['HTTP_REFERER'])) {
213
+ $parse = parse_url($_SERVER['HTTP_REFERER']);
214
+ $referer = $parse['host'];
215
+ }
216
+
217
+ // return $referer;
218
+ return self::ADDTHIS_REFERER;
219
+ }
220
+
221
+ /**
222
+ * Check if there is an addthis profile id return from addthis.com
223
+ *
224
+ * @return boolean
225
+ */
226
+ private function _checkPubidFromAddThis()
227
+ {
228
+ $referer = $this->_getReferelUrl();
229
+ $successReturn = isset ($this->_getVariables['pubid']) &&
230
+ isset ($this->_getVariables['complete']) &&
231
+ $this->_getVariables['complete'] == 'true' &&
232
+ $referer == self::ADDTHIS_REFERER;
233
+
234
+ return $successReturn;
235
+ }
236
+
237
+ /**
238
+ * Check if there is request to add addthis profile id
239
+ *
240
+ * @return boolean
241
+ */
242
+ private function _checkAddPubid()
243
+ {
244
+ $successReturn = isset ($this->_postVariables['pubid'])
245
+ && isset ($this->_postVariables['submit']);
246
+
247
+ return $successReturn;
248
+ }
249
+
250
+ /**
251
+ * Check pubid from addthis failure
252
+ *
253
+ * @return boolean
254
+ */
255
+ private function _checkAddPubidFailure()
256
+ {
257
+ $referer = $this->_getReferelUrl();
258
+ $successReturn = (isset ($this->_getVariables['complete']) &&
259
+ $this->_getVariables['complete'] != 'true') ||
260
+ (isset ($this->_getVariables['complete']) &&
261
+ $referer !== self::ADDTHIS_REFERER);
262
+
263
+ return $successReturn;
264
+ }
265
+
266
+ /**
267
+ * Get the HTML for addthis settings page
268
+ *
269
+ * @param string $updateResult Updated message
270
+ *
271
+ * @return string
272
+ */
273
+ private function _getHTML($updateResult)
274
+ {
275
+ $html = '<div class="addthis_wrap">'.
276
+ '<p>'.
277
+ '<img class="header-img" '.
278
+ 'src="//cache.addthis.com/icons/v1/thumbs/32x32/more.png" '.
279
+ 'alt="Addthis">'.
280
+ '<span class="addthis-title">AddThis <sup>*</sup></span>'.
281
+ '<span class="addthis-name">for WordPress</span>'.
282
+ '</p>';
283
+ if ($this->_upgrade && !self::getPubid()) {
284
+ $html .= $this->_getupdateSuccessMessage();
285
+ }
286
+
287
+ if ($this->_checkAddPubidFailure()) {
288
+ $html .= $this->_getPubIdFromAddthisFailureMessage();
289
+ }
290
+
291
+ if ($updateResult) {
292
+ $html .= $updateResult;
293
+ }
294
+
295
+ if ($this->_checkPubidFromAddThis()
296
+ || (isset($this->_getVariables['advanced_settings'])
297
+ && ($this->_getVariables['advanced_settings'] == 'true'))
298
+ ) {
299
+ // Get Confirmation form
300
+ $html .= $this->_getConfirmationForm();
301
+ } else {
302
+ $html .= $this->_getAddThisLinkButton();
303
+ $html .= "</div>";
304
+ }
305
+
306
+ return $html;
307
+ }
308
+
309
+ /**
310
+ * Get pubid failure message
311
+ *
312
+ * @return <string>
313
+ */
314
+ private static function _getPubIdFromAddthisFailureMessage()
315
+ {
316
+ return "<div class='addthis_error wrap'>".
317
+ "Failed to add AddThis Profile ID".
318
+ "</div>";
319
+ }
320
+
321
+ /**
322
+ * Get Update Success Message when updating from old plugin
323
+ *
324
+ * @return null
325
+ */
326
+ private function _getupdateSuccessMessage()
327
+ {
328
+ return "<div class='addthis_updated wrap'>".
329
+ "Click on the link below to finish setting up your AddThis tools.".
330
+ "</div>";
331
+ }
332
+
333
+ /**
334
+ * Get Link to addthis site
335
+ *
336
+ * @return string
337
+ */
338
+ private function _getAddThisLinkButton()
339
+ {
340
+ $html = '';
341
+ if (!self::getPubid()) {
342
+ $html = "<h2>You're almost done!</h2>";
343
+ }
344
+ $html .= "<div class='addthis_description'>".
345
+ "Beautiful simple website tools designed to help you get ".
346
+ "likes, get shares, get follows and get discovered. </div>";
347
+
348
+ if (!self::getPubid()) {
349
+ // Get pub name
350
+ $pubName = self::_getPubName();
351
+ $html .= "<a class='addthis_button next' ".
352
+ "href='".self::ADDTHIS_SITE_URL.
353
+ "?cms=wp&pubname=".urlencode($pubName)."&wp_redirect=".
354
+ str_replace('.', '%2E', urlencode(self::getSettingsPageUrl())).
355
+ "'>Next</a>";
356
+ } else {
357
+
358
+ $addthis_options = get_option('addthis_settings');
359
+ if(isset($addthis_options['above']) && isset($addthis_options['profile'])){
360
+
361
+ $html .= "<a class='addthis_button' target='_blank'".
362
+ "href='".self::ADDTHIS_SITE_URL."?cms=wp&pubid=".self::getPubid().
363
+ "'>".
364
+ "To control your AddThis plugins, click here &#8594;".
365
+ "</a>";
366
+
367
+ } else {
368
+ $html .= "<a class='addthis_button' target='_blank'".
369
+ "href='".self::ADDTHIS_SITE_URL_WITH_PUB."/".self::getPubid().
370
+ "'>".
371
+ "To control your AddThis plugins, click here &#8594;".
372
+ "</a>";
373
+ }
374
+ }
375
+
376
+ $html .= "<div class='addthis_seperator'>&nbsp;</div>";
377
+ $html .= "<a href = '".
378
+ self::getSettingsPageUrl()."&advanced_settings=true'".
379
+ " class='addthis_reset_button'>Edit Profile Settings</a>";
380
+
381
+ return $html;
382
+ }
383
+
384
+ /**
385
+ * Get the pubname for addthis
386
+ *
387
+ * @return string
388
+ */
389
+ private static function _getPubName()
390
+ {
391
+ $pubName = get_bloginfo('name');
392
+
393
+ if (!preg_match('/^[A-Za-z0-9 _\-\(\)]*$/', $pubName)) {
394
+ // if title not match, get domain
395
+ $domain = self::getDomain();
396
+ if (preg_match(
397
+ '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i',
398
+ $domain, $regs
399
+ )) {
400
+ $domainArray = explode(".", $regs['domain']);
401
+ $pubName = $domainArray[0];
402
+ } else {
403
+ $pubName = '';
404
+ }
405
+ $pubName = str_replace('.', '', $pubName);
406
+ }
407
+
408
+ if (!preg_match('/^[A-Za-z0-9 _\-\(\)]*$/', $pubName) || $pubName == '') {
409
+ // if domain not match, get loggedin username
410
+ $currentUser = wp_get_current_user();
411
+ $pubName = $currentUser->user_login;
412
+ }
413
+
414
+ $pubName = substr($pubName, 0, ADDTHIS_PUBNAME_LIMIT);
415
+ return $pubName;
416
+ }
417
+
418
+ /**
419
+ * Get HTML for new users with confirmation
420
+ *
421
+ * @return string
422
+ */
423
+ private function _getConfirmationForm()
424
+ {
425
+ if (isset($this->_getVariables['advanced_settings'])) {
426
+ $html = "<div>";
427
+ $html .= "Here you can manually set your AddThis Profile ID - ".
428
+ "you can get this from your ".
429
+ "<a target='_blank' ".
430
+ "href='".self::ADDTHIS_PROFILE_SETTINGS_PAGE."'>".
431
+ "Profile Settings</a>";
432
+ $html .= "</div>";
433
+ } else {
434
+ $html = "<h2>You're almost done!</h2>";
435
+ $html .= "<div>".
436
+ "It's time to connect your AddThis account with Wordpress.".
437
+ "</div>";
438
+ }
439
+ $html .= '<form id="addthis-form" method="post" action="'.
440
+ self::getSettingsPageUrl().'">';
441
+ $html .= "<div class='addthis_pub_id'>".
442
+ "<div class='icons wp_div'>".
443
+ "<img src='".plugins_url('images/wordpress.png', __FILE__).
444
+ "'>".
445
+ "<span>Your WordPress Site:</span>".
446
+ "<input type='text' value='" . get_bloginfo('name') . "'".
447
+ "name='pub_id' readonly=true onfocus='this.blur()'/>".
448
+ "</div>".
449
+ "<div class='icons arrow_div'>".
450
+ "<img src='".plugins_url('images/arrow_right.png', __FILE__).
451
+ "'>".
452
+ "<img src='".plugins_url('images/arrow_left.png', __FILE__).
453
+ "'>".
454
+ "</div>".
455
+ "<div class='icons addthis_div'>".
456
+ "<img src='".plugins_url('images/addthis.png', __FILE__).
457
+ "'>".
458
+ "<span>AddThis Profile ID:</span>";
459
+
460
+ if (isset($this->_getVariables['pubid'])) {
461
+ $pubId = $this->_getVariables['pubid'];
462
+ } else {
463
+ $pubId = self::getPubid();
464
+ }
465
+
466
+ $html .= "<input type='text' value='".$pubId."' ".
467
+ "name='pubid' id='addthis-pubid'/>";
468
+ $html .= "</div></div>";
469
+ $submitButtonValue = "Confirm and Save";
470
+
471
+ if (isset($this->_getVariables['advanced_settings'])) {
472
+ $submitButtonValue = "Update";
473
+ }
474
+
475
+ $html .= '<input type="submit" value="'.$submitButtonValue.'"'.
476
+ ' name="submit" class="addthis_confirm_button">';
477
+ $html .= '<button class="addthis_cancel_button" type="button"'
478
+ . ' onclick="window.location=\''.self::getSettingsPageUrl()
479
+ .'\';return false;">Cancel</button>';
480
+ $html .= "</form>";
481
+
482
+ return $html;
483
+ }
484
+
485
+ /**
486
+ * Get the plugin's settings page url
487
+ *
488
+ * @return string
489
+ */
490
+ public static function getSettingsPageUrl()
491
+ {
492
+ return admin_url("options-general.php?page=" . ADDTHIS_SETTINGS_PAGE_ID);
493
+ }
494
+
495
+ /**
496
+ * Get the wp domain
497
+ *
498
+ * @return string
499
+ */
500
+ public static function getDomain()
501
+ {
502
+ $url = get_option('siteurl');
503
+ $urlobj = parse_url($url);
504
+ $domain = $urlobj['host'];
505
+ return $domain;
506
+ }
507
+
508
+ }
509
+
510
+ // Setup our shared resources early
511
+ // addthis_addjs.php is a standard class shared by the various AddThis plugins
512
+ // to make it easy for us to include our bootstrapping JavaScript only once.
513
+ // Priority should be lowest for Share plugin.
514
+ add_action('init', 'Addthis_Wordpress_early', 0);
515
+
516
+ /**
517
+ * Include addthis js widget
518
+ *
519
+ * @global AddThis_addjs $addthis_addjs
520
+ * @return null
521
+ */
522
+ function Addthis_Wordpress_early()
523
+ {
524
+ global $addthis_addjs;
525
+ if (!isset($addthis_addjs)) {
526
+ include 'includes/addthis_addjs_new.php';
527
+ $addthis_options = get_option('addthis_settings');
528
+ $addthis_addjs = new AddThis_addjs($addthis_options);
529
+ }
530
+ }
addthis-toolbox.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2012 Add This, LLC |
5
+ * +--------------------------------------------------------------------------+
6
+ * | This program is free software; you can redistribute it and/or modify |
7
+ * | it under the terms of the GNU General Public License as published by |
8
+ * | the Free Software Foundation; either version 2 of the License, or |
9
+ * | (at your option) any later version. |
10
+ * | |
11
+ * | This program is distributed in the hope that it will be useful, |
12
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
+ * | GNU General Public License for more details. |
15
+ * | |
16
+ * | You should have received a copy of the GNU General Public License |
17
+ * | along with this program; if not, write to the Free Software |
18
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
19
+ * +--------------------------------------------------------------------------+
20
+ *
21
+ * PHP version 5.3.6
22
+ *
23
+ * @category Class
24
+ * @package Wordpress_Plugin
25
+ * @author The AddThis Team <srijith@addthis.com>
26
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
27
+ * @version SVN: 1.0
28
+ * @link http://www.addthis.com/blog
29
+ */
30
+
31
+ define('AT_API_URL', 'http://adt00:8080/live/red_lojson');
32
+
33
+ /**
34
+ * Class for output addthis tool box
35
+ *
36
+ * @category Class
37
+ * @package Wordpress_Plugin
38
+ * @author The AddThis Team <srijith@addthis.com>
39
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
40
+ * @version Release: 1.0
41
+ * @link http://www.addthis.com/blog
42
+ */
43
+ class Addthis_ToolBox
44
+ {
45
+
46
+ const AT_ABOVE_POST_HOME = "at-above-post-homepage";
47
+ const AT_BELOW_POST_HOME = "at-below-post-homepage";
48
+ const AT_ABOVE_POST_PAGE = "at-above-post-page";
49
+ const AT_BELOW_POST_PAGE = "at-below-post-page";
50
+ const AT_ABOVE_POST = "at-above-post";
51
+ const AT_BELOW_POST = "at-below-post";
52
+ const AT_CONTENT_BELOW_POST_HOME = "at-below-post-homepage-recommended";
53
+ const AT_CONTENT_BELOW_POST_PAGE = "at-below-post-page-recommended";
54
+ const AT_CONTENT_BELOW_POST = "at-below-post-recommended";
55
+ const AT_CONTENT_ABOVE_POST_HOME = "at-above-post-homepage-recommended";
56
+ const AT_CONTENT_ABOVE_POST_PAGE = "at-above-post-page-recommended";
57
+ const AT_CONTENT_ABOVE_POST = "at-above-post-recommended";
58
+
59
+ /**
60
+ * Initializes the widget class.
61
+ * */
62
+ public function __construct()
63
+ {
64
+ add_filter('the_content', array($this, 'addWidget'));
65
+ add_filter('the_excerpt', array($this, 'addWidget'));
66
+ }
67
+
68
+ /**
69
+ * Adds toolbox to wp pages
70
+ *
71
+ * @param string $content Page contents
72
+ *
73
+ * @return string
74
+ */
75
+ public function addWidget($content)
76
+ {
77
+ if (Addthis_Wordpress::getPubid()) {
78
+ if (is_home() || is_front_page()) {
79
+ $content = self::_buildDiv(self::AT_ABOVE_POST_HOME) .
80
+ self::_buildDiv(self::AT_CONTENT_ABOVE_POST_HOME) .
81
+ $content;
82
+ $content .= self::_buildDiv(self::AT_BELOW_POST_HOME);
83
+ $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_HOME);
84
+ } else if (is_page()) {
85
+ $content = self::_buildDiv(self::AT_ABOVE_POST_PAGE) .
86
+ self::_buildDiv(self::AT_CONTENT_ABOVE_POST_PAGE) .
87
+ $content;
88
+ $content .= self::_buildDiv(self::AT_BELOW_POST_PAGE);
89
+ $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_PAGE);
90
+ } else if (is_single()) {
91
+ $content = self::_buildDiv(self::AT_ABOVE_POST) .
92
+ self::_buildDiv(self::AT_CONTENT_ABOVE_POST) .
93
+ $content;
94
+ $content .= self::_buildDiv(self::AT_BELOW_POST);
95
+ $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST);
96
+ }
97
+ }
98
+
99
+ return $content;
100
+ }
101
+
102
+ /**
103
+ * Build toolbox div
104
+ *
105
+ * @param string $class Class name
106
+ *
107
+ * @return string
108
+ */
109
+ private static function _buildDiv($class)
110
+ {
111
+ $title = get_the_title();
112
+ $url = get_permalink();
113
+ return "<div class='".$class." addthis-toolbox'".
114
+ " data-title='".$title."' data-url='".$url."'>".
115
+ "</div>";
116
+ }
117
+
118
+ /**
119
+ * Get user's activated tools in addthis
120
+ *
121
+ * @return array
122
+ */
123
+ public static function getUserTools()
124
+ {
125
+ $curl = curl_init();
126
+ $url = AT_API_URL . '?pub='. Addthis_Wordpress::getPubid();
127
+ $url .= '&dp=' . Addthis_Wordpress::getDomain();
128
+
129
+ curl_setopt($curl, CURLOPT_URL, $url);
130
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
131
+
132
+ $response = curl_exec($curl);
133
+
134
+ curl_close($curl);
135
+
136
+ $response = json_decode($response);
137
+ $activatedTools = null;
138
+
139
+ if ($response) {
140
+ foreach ($response as $key => $value) {
141
+ if ($key == 'pc') {
142
+ $activatedTools = $value;
143
+ break;
144
+ }
145
+ }
146
+ }
147
+ return $activatedTools ? explode(',', $activatedTools) : array();
148
+ }
149
+ }
addthis-widget.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2012 Add This, LLC |
5
+ * +--------------------------------------------------------------------------+
6
+ * | This program is free software; you can redistribute it and/or modify |
7
+ * | it under the terms of the GNU General Public License as published by |
8
+ * | the Free Software Foundation; either version 2 of the License, or |
9
+ * | (at your option) any later version. |
10
+ * | |
11
+ * | This program is distributed in the hope that it will be useful, |
12
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
+ * | GNU General Public License for more details. |
15
+ * | |
16
+ * | You should have received a copy of the GNU General Public License |
17
+ * | along with this program; if not, write to the Free Software |
18
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
19
+ * +--------------------------------------------------------------------------+
20
+ *
21
+ * PHP version 5.3.6
22
+ *
23
+ * @category Class
24
+ * @package Wordpress_Widget
25
+ * @author The AddThis Team <srijith@addthis.com>
26
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
27
+ * @version SVN: 1.0
28
+ * @link http://www.addthis.com/blog
29
+ */
30
+
31
+ /**
32
+ * Class for Widget for Horizontal Recommended Content
33
+ *
34
+ * @category Class
35
+ * @package Wordpress_Widget
36
+ * @author The AddThis Team <srijith@addthis.com>
37
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
38
+ * @version Release: 1.0
39
+ * @link http://www.addthis.com/blog
40
+ */
41
+ class Addthis_Horizontal_Recommended_Content_Widget extends WP_Widget
42
+ {
43
+
44
+ const HORIZONTAL_RECOMMENDED_CONTENT = "addthis_recommended_horizontal";
45
+
46
+ /**
47
+ * Register widget with WordPress.
48
+ *
49
+ * @return null
50
+ */
51
+ function __construct()
52
+ {
53
+ parent::__construct(
54
+ 'addthis_horizontal_recommended_content_widget', // Base ID
55
+ __(
56
+ 'Addthis Horizontal Recommended Content',
57
+ 'hor_recomended_widget_domain'
58
+ ), // Name
59
+ array( 'description' =>
60
+ __(
61
+ 'An Addthis Widget to add horizontal recommended content',
62
+ 'hor_recomended_widget_domain'
63
+ )
64
+ ) // Args
65
+ );
66
+ }
67
+
68
+ /**
69
+ * Front-end display of widget.
70
+ *
71
+ * @param array $args Widget arguments.
72
+ * @param array $instance Saved values from database.
73
+ *
74
+ * @return null
75
+ */
76
+ public function widget($args, $instance)
77
+ {
78
+ echo $args['before_widget'];
79
+ $title = apply_filters('widget_title', $instance['title']);
80
+ if (! empty($title)) {
81
+ echo $args['before_title'] . $title . $args['after_title'];
82
+ }
83
+
84
+ echo "<div class='".self::HORIZONTAL_RECOMMENDED_CONTENT."'></div>";
85
+
86
+ echo $args['after_widget'];
87
+ }
88
+
89
+ /**
90
+ * Back-end widget form.
91
+ *
92
+ * @param array $instance Previously saved values from database.
93
+ *
94
+ * @return null
95
+ */
96
+ public function form($instance)
97
+ {
98
+ if (isset($instance['title'])) {
99
+ $title = $instance['title'];
100
+ } else {
101
+ $title = __('Addthis', 'hor_recomended_widget_domain');
102
+ }
103
+ echo "<p>".
104
+ '<label for="'.$this->get_field_id('title').'">'.
105
+ _e('Title:').
106
+ '</label>'.
107
+ '<input id="'.$this->get_field_id('title').'" '.
108
+ 'name="'.$this->get_field_name('title').'" '.
109
+ 'type="text" value="'.esc_attr($title).'">'.
110
+ "</p>";
111
+ }
112
+
113
+ /**
114
+ * Sanitize widget form values as they are saved.
115
+ *
116
+ * @param array $new_instance Values just sent to be saved.
117
+ * @param array $old_instance Previously saved values from database.
118
+ *
119
+ * @return array Updated safe values to be saved.
120
+ */
121
+ public function update($new_instance, $old_instance)
122
+ {
123
+ $new_instance['title'] = (! empty($new_instance['title'])) ?
124
+ mysql_real_escape_string($new_instance['title'])
125
+ : '';
126
+ return $new_instance;
127
+ }
128
+
129
+ }
130
+
131
+ /**
132
+ * Class for Widget for Vertical Recommended Content
133
+ *
134
+ * @category Class
135
+ * @package Wordpress_Widget
136
+ * @author The AddThis Team <srijith@addthis.com>
137
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
138
+ * @version Release: 1.0
139
+ * @link http://www.addthis.com/blog
140
+ */
141
+ class Addthis_Vertical_Recommended_Content_Widget extends WP_Widget
142
+ {
143
+
144
+ const VERTICAL_RECOMMENDED_CONTENT = "addthis_recommended_vertical";
145
+
146
+ /**
147
+ * Register widget with WordPress.
148
+ *
149
+ * @return null
150
+ */
151
+ function __construct()
152
+ {
153
+ parent::__construct(
154
+ 'addthis_vertical_recommended_content_widget', // Base ID
155
+ __(
156
+ 'Addthis Vertical Recommended Content',
157
+ 'vertical_recomended_widget_domain'
158
+ ), // Name
159
+ array( 'description' =>
160
+ __(
161
+ 'An Addthis Widget to add vertical recommended content',
162
+ 'vertical_recomended_widget_domain'
163
+ )
164
+ ) // Args
165
+ );
166
+ }
167
+
168
+ /**
169
+ * Front-end display of widget.
170
+ *
171
+ * @param array $args Widget arguments.
172
+ * @param array $instance Saved values from database.
173
+ *
174
+ * @return null
175
+ */
176
+ public function widget($args, $instance)
177
+ {
178
+ echo $args['before_widget'];
179
+ $title = apply_filters('widget_title', $instance['title']);
180
+ if (! empty($title)) {
181
+ echo $args['before_title'] . $title . $args['after_title'];
182
+ }
183
+
184
+ echo "<div class='".self::VERICAL_RECOMMENDED_CONTENT."'></div>";
185
+
186
+ echo $args['after_widget'];
187
+ }
188
+
189
+ /**
190
+ * Back-end widget form.
191
+ *
192
+ * @param array $instance Previously saved values from database.
193
+ *
194
+ * @return null
195
+ */
196
+ public function form($instance)
197
+ {
198
+ if (isset($instance['title'])) {
199
+ $title = $instance['title'];
200
+ } else {
201
+ $title = __('Addthis', 'vertical_recomended_widget_domain');
202
+ }
203
+ echo "<p>".
204
+ '<label for="'.$this->get_field_id('title').'">'.
205
+ _e('Title:').
206
+ '</label>'.
207
+ '<input id="'.$this->get_field_id('title').'" '.
208
+ 'name="'.$this->get_field_name('title').'" '.
209
+ 'type="text" value="'.esc_attr($title).'">'.
210
+ "</p>";
211
+ }
212
+
213
+ /**
214
+ * Sanitize widget form values as they are saved.
215
+ *
216
+ * @param array $new_instance Values just sent to be saved.
217
+ * @param array $old_instance Previously saved values from database.
218
+ *
219
+ * @return array Updated safe values to be saved.
220
+ */
221
+ public function update($new_instance, $old_instance)
222
+ {
223
+ $new_instance['title'] = (! empty($new_instance['title'])) ?
224
+ mysql_real_escape_string($new_instance['title'])
225
+ : '';
226
+ return $new_instance;
227
+ }
228
+
229
+ }
230
+
231
+ /**
232
+ * Register widgets
233
+ *
234
+ * @return null
235
+ */
236
+ function register_addthis_widget()
237
+ {
238
+ register_widget('Addthis_Horizontal_Recommended_Content_Widget');
239
+ register_widget('Addthis_Vertical_Recommended_Content_Widget');
240
+ }
241
+
242
+ add_action('widgets_init', 'register_addthis_widget');
addthis_social_widget.php CHANGED
@@ -20,10 +20,10 @@
20
  * +--------------------------------------------------------------------------+
21
  */
22
  /**
23
- * Plugin Name: AddThis Social Bookmarking Widget
24
  * Plugin URI: http://www.addthis.com
25
- * Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
26
- * Version: 3.5.10
27
  *
28
  * Author: The AddThis Team
29
  * Author URI: http://www.addthis.com/blog
@@ -31,6 +31,105 @@
31
  if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
32
  else return;
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  // Setup our shared resources early
36
  // 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.
@@ -44,16 +143,6 @@ function addthis_early(){
44
  }
45
  }
46
 
47
-
48
- define( 'addthis_style_default' , 'fb_tw_p1_sc');
49
- define( 'ADDTHIS_PLUGIN_VERSION' , '3.5.8');
50
- define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-3.5.9');
51
- define( 'ADDTHIS_ATVERSION', '300');
52
- define( 'ADDTHIS_ATVERSION_MANUAL_UPDATE', -1);
53
- define( 'ADDTHIS_ATVERSION_AUTO_UPDATE', 0);
54
- define( 'ADDTHIS_ATVERSION_REVERTED', 1);
55
- define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
56
-
57
  $addthis_settings = array();
58
  $addthis_settings['isdropdown'] = 'true';
59
  $addthis_settings['customization'] = '';
@@ -466,34 +555,34 @@ function addthis_print_script() {
466
  add_action('admin_notices', 'addthis_admin_notices');
467
 
468
  function addthis_admin_notices(){
469
- if (! current_user_can('manage_options') ||( defined('ADDTHIS_NO_NOTICES') && ADDTHIS_NO_NOTICES == true ) )
470
  return;
471
-
472
  global $current_user ;
473
  $user_id = $current_user->ID;
474
- $options = get_option('addthis_settings');
475
 
476
  if ($options == false && ! get_user_meta($user_id, 'addthis_ignore_notices'))
477
  {
478
- echo '<div class="updated addthis_setup_nag"><p>';
479
- printf(__('Configure the AddThis plugin to enable users to share your content around the web.<br /> <a href="%1$s">Configuration options</a> | <a href="%2$s" id="php_below_min_nag-no">Ignore this notice</a>'),
480
  admin_url('options-general.php?page=' . basename(__FILE__) ),
481
- '?addthis_nag_ignore=0');
482
  echo "</p></div>";
483
  }
484
-
485
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
486
  {
487
- echo '<div class="updated addthis_setup_nag"><p>';
488
- printf( __('Sign up for AddThis and add your username/password to receive analytics about how people are sharing your content.<br /> <a href="%1$s">Enter username and password</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s" target="_blank">Sign Up</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%3$s">Ignore this notice</a>'),
489
- admin_url('options-general.php?page=' . basename(__FILE__) ),
490
- 'https://www.addthis.com/register?profile=wpp',
491
- '?addthis_nag_username_ignore=0');
492
- echo "</p></div>";
493
  }
494
- elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
495
  {
496
- echo '<div class="updated addthis_setup_nag"><p>';
497
  printf( __('We have updated the options for the AddThis plugin. Check out the <a href="%1$s">AddThis settings page</a> to see the new styles and options.<br /> <a href="%1$s">See New Options</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s">Ignore this notice</a>'),
498
  admin_url('options-general.php?page=' . basename(__FILE__) ),
499
  '?addthis_nag_updated_ignore=0');
@@ -2035,18 +2124,16 @@ function addthis_plugin_options_php4() {
2035
  extract($options);
2036
  ?>
2037
 
2038
- <p>
2039
- <?php if(!at_share_is_pro_user()) { ?>
2040
- <div class="updated addthis_setup_nag">
2041
- <p>AddThis Pro now available - start your trial at
2042
- <a href="http://www.addthis.com" target="_blank">www.addthis.com</a>
2043
- and get premium widgets, personalized content recommendations,
2044
- advanced customization options and priority support.
2045
- </p>
2046
- </div>
2047
- <?php } ?>
2048
- <?php echo $addthis_addjs->getAtPluginPromoText(); ?>
2049
- </p>
2050
  <img alt='addthis' src="//cache.addthis.com/icons/v1/thumbs/32x32/more.png" class="header-img"/>
2051
  <span class="addthis-title">AddThis</span> <span class="addthis-plugin-name">Share</span>
2052
  <div class="page-header" id="tabs">
@@ -2382,20 +2469,6 @@ if (! function_exists('esc_textarea'))
2382
 
2383
  }
2384
 
2385
-
2386
- /**
2387
- * Make sure the option gets added on registration
2388
- * @since 2.0.6
2389
- */
2390
-
2391
- function addthis_activation_hook(){
2392
- if ( get_option('addthis_settings') == false)
2393
- add_option('addthis_settings', array() );
2394
-
2395
- }
2396
-
2397
- register_activation_hook( __FILE__, 'addthis_activation_hook' );
2398
-
2399
  /**
2400
  * Parse for the first twitter username in the given string
2401
  * @param String $raw_twitter_username Raw string containing twitter usernames
@@ -2424,13 +2497,13 @@ if (! function_exists('get_first_twitter_username'))
2424
  function at_share_is_pro_user() {
2425
  $isPro = false;
2426
  $options = get_option('addthis_settings');
2427
- $profile = $options['profile'];
2428
  if ($profile) {
2429
  $request = wp_remote_get( "http://q.addthis.com/feeds/1.0/config.json?pubid=" . $profile );
2430
  $server_output = wp_remote_retrieve_body( $request );
2431
  $array = json_decode($server_output);
2432
  // check for pro user
2433
- if (array_key_exists('_default',$array)) {
2434
  $isPro = true;
2435
  } else {
2436
  $isPro = false;
@@ -2440,3 +2513,15 @@ function at_share_is_pro_user() {
2440
  }
2441
 
2442
  require_once('addthis_post_metabox.php');
 
 
 
 
 
 
 
 
 
 
 
 
20
  * +--------------------------------------------------------------------------+
21
  */
22
  /**
23
+ * Plugin Name: AddThis for WordPress
24
  * Plugin URI: http://www.addthis.com
25
+ * 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.
26
+ * Version: 4.0
27
  *
28
  * Author: The AddThis Team
29
  * Author URI: http://www.addthis.com/blog
31
  if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
32
  else return;
33
 
34
+ define( 'addthis_style_default' , 'fb_tw_p1_sc');
35
+ define( 'ADDTHIS_PLUGIN_VERSION' , '4.0');
36
+ define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-4.0');
37
+ define( 'ADDTHIS_ATVERSION', '300');
38
+ define( 'ADDTHIS_ATVERSION_MANUAL_UPDATE', -1);
39
+ define( 'ADDTHIS_ATVERSION_AUTO_UPDATE', 0);
40
+ define( 'ADDTHIS_ATVERSION_REVERTED', 1);
41
+ define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
42
+
43
+ $addthis_options = get_option('addthis_settings');
44
+
45
+ if(isset($_GET['upgrade']) && $_GET['upgrade'] == 'addthis_for_wordpress'){
46
+ if(isset($addthis_options)){
47
+ $addthis_options['addthis_for_wordpress'] = true;
48
+ } else {
49
+ $addthis_options = array('addthis_for_wordpress' => true);
50
+ }
51
+
52
+ $upgraded = true;
53
+ $addthis_options['addthis_wordpress_version'] = ADDTHIS_PLUGIN_VERSION;
54
+ update_option('addthis_settings', $addthis_options);
55
+
56
+ }
57
+
58
+ /**
59
+ * Show Plugin activation notice on first installation*
60
+ */
61
+ function pluginActivationNotice()
62
+ {
63
+ $run_once = get_option('addthis_run_once');
64
+
65
+ if (!$run_once) {
66
+ wp_enqueue_style(
67
+ 'addThisStylesheet',
68
+ plugins_url('css/style.css', __FILE__)
69
+ );
70
+ $html = '<div class="addthis_updated wrap">';
71
+ $html .= '<span>'.
72
+ 'Congrats! You\'ve Installed Addthis for Wordpress'.
73
+ '</span>';
74
+ $html .= '<span><a class="addthis_configure" href="'
75
+ . 'options-general.php?page=addthis_social_widget' .
76
+ '">Configure it now</a> >></span>';
77
+ $html .= '</div><!-- /.updated -->';
78
+ echo '<style>div#message.updated{ display: none; }</style>';
79
+ echo $html;
80
+ update_option('addthis_run_once', true);
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Make sure the option gets added on registration
86
+ * @since 2.0.6
87
+ */
88
+ add_action('admin_notices', 'pluginActivationNotice');
89
+ function addthis_activation_hook(){
90
+ /* Check if it is an upgrade or new intallation */
91
+ if ( get_option('addthis_settings') == false) {
92
+ // Fresh instlallation
93
+ $option = array('addthis_for_wordpress' => true);
94
+ } else {
95
+ $option = get_option('addthis_settings');
96
+ if(isset($option['addthis_for_wordpress'])) {
97
+ $option['addthis_for_wordpress'] = true;
98
+ } else if(isset($option['above']) || isset($option['below'])){
99
+ //check if any share buttons already included in old plugin
100
+ $option['addthis_for_wordpress'] = false;
101
+ } else if(get_option('widget_addthis-widget') == true){
102
+ //check if button widgets already included in old plugin
103
+ $option['addthis_for_wordpress'] = false;
104
+ } else {
105
+ // Fresh instlallation or old plugin not used
106
+ $option['addthis_for_wordpress'] = true;
107
+ }
108
+ }
109
+ $option['addthis_wordpress_version'] = ADDTHIS_PLUGIN_VERSION;
110
+ update_option('addthis_settings', $option );
111
+
112
+ }
113
+
114
+ register_activation_hook( __FILE__, 'addthis_activation_hook' );
115
+
116
+ if(isset($addthis_options) && isset($addthis_options['addthis_for_wordpress']) && ($addthis_options['addthis_for_wordpress'] == true)){
117
+ require_once 'addthis-for-wordpress.php';
118
+ new Addthis_Wordpress(isset($upgraded));
119
+ } else {
120
+
121
+ // Show old version of the plugin till upgrade button is clicked
122
+
123
+ // Add settings link on plugin page
124
+ function your_plugin_settings_link($links) {
125
+ $settings_link = '<a href="options-general.php?page=addthis_social_widget">Settings</a>';
126
+ array_push($links, $settings_link);
127
+ return $links;
128
+ }
129
+
130
+ $plugin = plugin_basename(__FILE__);
131
+ add_filter("plugin_action_links_$plugin", 'your_plugin_settings_link' );
132
+
133
 
134
  // Setup our shared resources early
135
  // 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.
143
  }
144
  }
145
 
 
 
 
 
 
 
 
 
 
 
146
  $addthis_settings = array();
147
  $addthis_settings['isdropdown'] = 'true';
148
  $addthis_settings['customization'] = '';
555
  add_action('admin_notices', 'addthis_admin_notices');
556
 
557
  function addthis_admin_notices(){
558
+ if (! current_user_can('manage_options') ||( defined('ADDTHIS_NO_NOTICES') && ADDTHIS_NO_NOTICES == true ) )
559
  return;
560
+
561
  global $current_user ;
562
  $user_id = $current_user->ID;
563
+ $options = get_option('addthis_settings');
564
 
565
  if ($options == false && ! get_user_meta($user_id, 'addthis_ignore_notices'))
566
  {
567
+ echo '<div class="updated addthis_setup_nag"><p>';
568
+ printf(__('Configure the AddThis plugin to enable users to share your content around the web.<br /> <a href="%1$s">Configuration options</a> | <a href="%2$s" id="php_below_min_nag-no">Ignore this notice</a>'),
569
  admin_url('options-general.php?page=' . basename(__FILE__) ),
570
+ '?addthis_nag_ignore=0');
571
  echo "</p></div>";
572
  }
573
+
574
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
575
  {
576
+ // echo '<div class="updated addthis_setup_nag"><p>';
577
+ // printf( __('Sign up for AddThis and add your username/password to receive analytics about how people are sharing your content.<br /> <a href="%1$s">Enter username and password</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s" target="_blank">Sign Up</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%3$s">Ignore this notice</a>'),
578
+ // admin_url('options-general.php?page=' . basename(__FILE__) ),
579
+ // 'https://www.addthis.com/register?profile=wpp',
580
+ // '?addthis_nag_username_ignore=0');
581
+ // echo "</p></div>";
582
  }
583
+ elseif ( (get_user_meta($user_id, 'addthis_nag_updated_options') == true ) )
584
  {
585
+ echo '<div class="updated addthis_setup_nag"><p>';
586
  printf( __('We have updated the options for the AddThis plugin. Check out the <a href="%1$s">AddThis settings page</a> to see the new styles and options.<br /> <a href="%1$s">See New Options</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s">Ignore this notice</a>'),
587
  admin_url('options-general.php?page=' . basename(__FILE__) ),
588
  '?addthis_nag_updated_ignore=0');
2124
  extract($options);
2125
  ?>
2126
 
2127
+ <?php if(isset($addthis_options) && !isset($addthis_options['addthis_for_wordpress'])) { ?>
2128
+
2129
+ <div class="addthis_upgrade">
2130
+ <b>You've upgraded successfully. </b>
2131
+ &nbsp;Now sign in to the dashboard to access the full suite of tools from AddThis.
2132
+ &nbsp; <a href="?page=<?php echo basename(__FILE__); ?>&upgrade=addthis_for_wordpress">Get Started</a>
2133
+ </div>
2134
+
2135
+ <?php } ?>
2136
+
 
 
2137
  <img alt='addthis' src="//cache.addthis.com/icons/v1/thumbs/32x32/more.png" class="header-img"/>
2138
  <span class="addthis-title">AddThis</span> <span class="addthis-plugin-name">Share</span>
2139
  <div class="page-header" id="tabs">
2469
 
2470
  }
2471
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2472
  /**
2473
  * Parse for the first twitter username in the given string
2474
  * @param String $raw_twitter_username Raw string containing twitter usernames
2497
  function at_share_is_pro_user() {
2498
  $isPro = false;
2499
  $options = get_option('addthis_settings');
2500
+ $profile = (isset($options['profile'])) ? $options['profile'] : null;
2501
  if ($profile) {
2502
  $request = wp_remote_get( "http://q.addthis.com/feeds/1.0/config.json?pubid=" . $profile );
2503
  $server_output = wp_remote_retrieve_body( $request );
2504
  $array = json_decode($server_output);
2505
  // check for pro user
2506
+ if (is_array($array) && array_key_exists('_default',$array)) {
2507
  $isPro = true;
2508
  } else {
2509
  $isPro = false;
2513
  }
2514
 
2515
  require_once('addthis_post_metabox.php');
2516
+
2517
+ function addthis_deactivation_hook()
2518
+ {
2519
+ if (get_option('addthis_run_once')) {
2520
+ delete_option('addthis_run_once');
2521
+ }
2522
+ }
2523
+
2524
+ // Deactivation
2525
+ register_deactivation_hook(__FILE__, 'addthis_deactivation_hook');
2526
+
2527
+ }
css/options-page.css CHANGED
@@ -317,4 +317,17 @@ div#preview_floater {
317
  .customize-message-section {
318
  font-size: 11px;
319
  text-decoration: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  }
317
  .customize-message-section {
318
  font-size: 11px;
319
  text-decoration: none;
320
+ }
321
+
322
+ .addthis_upgrade {
323
+ background-color: #FB765A;
324
+ padding: 15px;
325
+ width: 80%;
326
+ color: #ffffff;
327
+ margin-bottom: 15px;
328
+ }
329
+
330
+ .addthis_upgrade a,
331
+ .addthis_upgrade a:hover {
332
+ color: #ffffff;
333
  }
css/style.css ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ p {
2
+ font-size: 13px;
3
+ line-height: 1.5;
4
+ }
5
+
6
+ .addthis_header{
7
+ padding: 5px;
8
+ }
9
+
10
+ img.header-img {
11
+ height: 32px;
12
+ width: 32px;
13
+ }
14
+
15
+ .addthis-title {
16
+ color: black;
17
+ font-family: "HelveticaNeueBold","HelveticaNeue-Bold","Helvetica Neue",Helvetica,"open sans",arial,sans-serif;
18
+ font-size: 36px;
19
+ font-weight: normal;
20
+ padding-left: 3px;
21
+ }
22
+
23
+ .addthis-name {
24
+ color: #F4845D;
25
+ font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,"open sans",arial,sans-serif;
26
+ font-size: 36px;
27
+ font-weight: normal;
28
+ padding-left: 10px;
29
+ }
30
+
31
+ .addthis-wrap {
32
+ margin: 20px;
33
+ }
34
+
35
+ .addthis-title sup{
36
+ font-size: 20px;
37
+ color: grey;
38
+ margin-left: -10px;
39
+ }
40
+
41
+ .addthis_description{
42
+ font-size: 14px;
43
+ width: 50%;
44
+ }
45
+
46
+ a.addthis_button, a.addthis_button:hover, a.addthis_button:focus {
47
+ background-color: #279AF9;
48
+ color: white;
49
+ font-size: 24px;
50
+ text-decoration: none;
51
+ display: block;
52
+ width: 560px;
53
+ text-align: center;
54
+ border-radius: 3px;
55
+ margin-top: 20px;
56
+ height:62px;
57
+ padding-top: 38px;
58
+ }
59
+
60
+ a.addthis_button.next {
61
+ width: 200px;
62
+ }
63
+
64
+ input.addthis_confirm_button,
65
+ input.addthis_confirm_button:hover,
66
+ input.addthis_confirm_button:focus {
67
+ background-color: #DD4F4C;
68
+ border-radius: 3px 3px 3px 3px;
69
+ color: white;
70
+ display: block;
71
+ margin-top: 20px;
72
+ padding: 5px;
73
+ text-align: center;
74
+ text-decoration: none;
75
+ clear: both;
76
+ width: 155px;
77
+ text-decoration: none;
78
+ font-size: 12px;
79
+ font-weight: normal;
80
+ line-height: 0;
81
+ cursor: pointer;
82
+ border: none;
83
+ min-height: 30px;
84
+ float: left;
85
+ }
86
+
87
+ button.addthis_confirm_button,
88
+ button.addthis_confirm_button:hover,
89
+ button.addthis_confirm_button:focus {
90
+ background-color: #DD4F4C;
91
+ border-radius: 3px 3px 3px 3px;
92
+ color: white;
93
+ display: block;
94
+ margin-top: 20px;
95
+ padding: 5px;
96
+ text-align: center;
97
+ text-decoration: none;
98
+ width: 155px;
99
+ text-decoration: none;
100
+ font-size: 12px;
101
+ font-weight: normal;
102
+ line-height: 0;
103
+ cursor: pointer;
104
+ border: none;
105
+ min-height: 30px;
106
+ float: left;
107
+ margin-left: 15px;
108
+ }
109
+
110
+ button.addthis_cancel_button,
111
+ button.addthis_cancel_button:hover,
112
+ button.addthis_cancel_button:focus {
113
+ background-color: #B2B2B2;
114
+ border-radius: 3px 3px 3px 3px;
115
+ color: white;
116
+ display: block;
117
+ margin-top: 20px;
118
+ padding: 5px;
119
+ text-align: center;
120
+ text-decoration: none;
121
+ width: 155px;
122
+ text-decoration: none;
123
+ font-size: 12px;
124
+ font-weight: normal;
125
+ line-height: 0;
126
+ cursor: pointer;
127
+ border: none;
128
+ min-height: 30px;
129
+ float: left;
130
+ margin-left: 15px;
131
+ }
132
+
133
+ .addthis_confirm_button a {
134
+ text-decoration: none;
135
+ font-size: 12px;
136
+ font-weight: normal;
137
+ line-height: 0;
138
+ color: white;
139
+ }
140
+
141
+ .addthis_seperator{
142
+ width: 100%;
143
+ height: 1px;
144
+ background-color: #D9D9D9;
145
+ margin: 20px 0;
146
+ }
147
+
148
+ .addthis_pub_id{
149
+ background-color: #F2EDD9;
150
+ border: 2px solid #EEE4B5;
151
+ display: block;
152
+ float: left;
153
+ margin: 15px 0;
154
+ padding: 15px;
155
+ text-align: center;
156
+ font-weight: bold;
157
+ }
158
+
159
+ .addthis_updated {
160
+ background-color: #AACE3B;
161
+ padding: 10px;
162
+ color: #fff;
163
+ font-weight: bold;
164
+ margin-bottom: 15px;
165
+ }
166
+
167
+ .addthis_error {
168
+ background-color: #CE0000;
169
+ padding: 10px;
170
+ color: #fff;
171
+ font-weight: bold;
172
+ margin-bottom: 15px;
173
+ }
174
+
175
+ a.addthis_configure, a.addthis_configure:hover {
176
+ color: #fff;
177
+ font-weight: bold;
178
+ text-decoration: underline;
179
+ margin-left: 10px;
180
+ }
181
+
182
+ .addthis_wrap {
183
+ width: 85%;
184
+ font-size: 12px;
185
+ }
186
+
187
+ .icons {
188
+ float: left;
189
+ }
190
+
191
+ .wp_div, .addthis_div {
192
+ width: 160px;
193
+ text-align: center;
194
+ }
195
+ .wp_div span, .addthis_div span {
196
+ display: block;
197
+ margin: 5px;
198
+ }
199
+ .addthis_wrap input[type="text"] {
200
+ border: 1px solid #EEE4B5;
201
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07) inset;
202
+ transition: border-color 0.05s ease-in-out 0s;
203
+ width: 145px;
204
+ color: #AF6B63;
205
+ font-size: 10px;
206
+ font-style: normal;
207
+ font-weight: normal;
208
+ text-align: center;
209
+ }
210
+ .addthis_wrap input[readonly] {
211
+ background-color: #FFFFFF;
212
+ }
213
+
214
+ .arrow_div{
215
+ padding-top: 25px;
216
+ }
217
+ .arrow_div img{
218
+ display: block;
219
+ }
220
+
221
+ .addthis_reset_button{
222
+ border: 1px solid gray;
223
+ border-radius: 2px 2px 2px 2px;
224
+ color: #000000;
225
+ background-color: inherit;
226
+ display: block;
227
+ float: left;
228
+ margin-right: 25px;
229
+ padding: 3px;
230
+ text-align: center;
231
+ width: 155px;
232
+ text-decoration: none;
233
+ font-size: inherit;
234
+ line-height: none;
235
+ cursor: pointer;
236
+ }
237
+
238
+ .addthis_confirm_div {
239
+ margin-top: 15px;
240
+ font-size: 14px;
241
+ font-weight: bold;
242
+ }
243
+
244
+ .addthis_confirm_div span{
245
+ margin-right: 10px;
246
+ }
247
+
248
+ .addthis_confirm_div input[type="text"] {
249
+ font-size: 12px;
250
+ }
images/addthis.png ADDED
Binary file
images/arrow_left.png ADDED
Binary file
images/arrow_right.png ADDED
Binary file
images/wordpress.png ADDED
Binary file
includes/addthis_addjs.php CHANGED
@@ -216,45 +216,6 @@ Class AddThis_addjs{
216
  _doing_it_wrong('getAtPluginPromoText', 'This function should only be called on an admin page load and no earlier the admin_init', 1);
217
  return null;
218
  }
219
- if (apply_filters('addthis_crosspromote', '__return_true'))
220
- {
221
- $plugins = get_plugins();
222
- if (empty($this->_atInstalled))
223
- {
224
- foreach($plugins as $plugin)
225
- {
226
- if (substr($plugin['Name'], 0, 7) === 'AddThis')
227
- array_push($this->_atInstalled, $plugin['Name']);
228
- }
229
- }
230
- $keys = array_keys($this->_atPlugins);
231
- $uninstalled = array_diff( $keys, $this->_atInstalled);
232
- if (empty($uninstalled))
233
- return false;
234
-
235
- // Get rid of our keys, we just want the names which are the keys elsewhere
236
- $uninstalled = array_values($uninstalled);
237
-
238
- $string = __('Want to increase your site traffic? AddThis also has ');
239
- $count = count($uninstalled);
240
- if ($count == 1){
241
- $string .= __('a plugin for ', 'addthis');
242
- $string .= __( sprintf('<a href="%s" target="_blank">' .$this->_atPlugins[$uninstalled[0]][1] .'</a>', $this->_atPlugins[$uninstalled[0]][0]), 'addthis');
243
- } else {
244
- $string . __('plugins for ');
245
-
246
- for ($i = 0; $i < $count; $i++) {
247
- $string .= __( sprintf('<strong><a href="%s" target="_blank" >' .$this->_atPlugins[$uninstalled[$i]][1] .'</a></strong>', $this->_atPlugins[$uninstalled[$i]][0]), 'addthis');
248
- if ($i < ($count - 2))
249
- $string .= ', ';
250
- else if ($i == ($count -2))
251
- $string .= ' and ';
252
- else if ($i == ($count -1))
253
- $string .= ' plugins available.';
254
- }
255
- }
256
-
257
- return '<p class="addthis_more_promo">' .$string . '</p>';
258
- }
259
  }
260
  }
216
  _doing_it_wrong('getAtPluginPromoText', 'This function should only be called on an admin page load and no earlier the admin_init', 1);
217
  return null;
218
  }
219
+ return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  }
221
  }
includes/addthis_addjs_new.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class for managing AddThis script includes across all its plugins.
5
+ */
6
+ Class AddThis_addjs{
7
+ /**
8
+ * var bool check to see if we have added our JS already. Ensures that we don't add it twice
9
+ */
10
+ private $_js_added;
11
+
12
+ private $_options;
13
+
14
+ private $_cuid;
15
+
16
+ var $pubid;
17
+
18
+ var $jsToAdd;
19
+
20
+ var $jsAfterAdd;
21
+
22
+ var $atversion;
23
+
24
+ var $productCode;
25
+
26
+ const addjs_version = 1;
27
+
28
+ /**
29
+ *
30
+ */
31
+ public function __construct ($options){
32
+ if ( did_action('addthis_addjs_created') !== 0){
33
+ _doing_it_wrong( 'addthis_addjs', 'Only one instance of this class should be initialized. Look for the $addthis_addjs global first',1 );
34
+ }
35
+
36
+ $this->productCode = ADDTHIS_PRODUCT_VERSION;
37
+
38
+ // We haven't added our JS yet. Or at least better not have.
39
+ $this->_js_added = false;
40
+
41
+ $this->_options = $options;
42
+
43
+ // Version of AddThis code to use
44
+ if (is_array($options)) {
45
+ $this->atversion = array_key_exists('atversion_update_status', $options) && $options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $options['atversion'] : ADDTHIS_ATVERSION;
46
+ }
47
+ // set the cuid
48
+ $base = get_option('home');
49
+ $cuid = hash_hmac('md5', $base, 'addthis');
50
+ $this->_cuid = $cuid;
51
+
52
+ // If the footer option isn't set, check for it
53
+ if (! isset($this->_options['wpfooter']) && current_user_can('manage_options'))
54
+ {
55
+ add_action('admin_init',array($this, 'update_wpfooter'));
56
+ }
57
+
58
+ $this->pubid = $this->getProfileId();
59
+
60
+ // on theme swich, check for footer again
61
+ add_action('switch_theme', array($this, 'switch_theme'),15);
62
+
63
+ // In order for our wp_footer magic to work, we need to sometimes add our stuff
64
+ add_action('init', array($this, 'maybe_add_footer_comment'));
65
+
66
+
67
+ // Footer
68
+ if ( isset($this->_options['wpfooter']) && $this->_options['wpfooter'])
69
+ add_action('wp_footer', array($this, 'output_script') );
70
+ else
71
+ add_filter('the_content', array($this, 'output_script_filter') );
72
+
73
+ do_action('addthis_addjs_created');
74
+ }
75
+
76
+ function switch_theme(){
77
+ $footer = $this->check_for_footer();
78
+ $this->_options['wpfooter'] = $footer;
79
+ update_option( 'addthis_settings', $this->_options);
80
+ }
81
+
82
+ function output_script(){
83
+ if ($this->_js_added != true)
84
+ {
85
+ $this->wrapJs();
86
+ $this->addWidgetToJs();
87
+ $this->addAfterToJs();
88
+ echo $this->jsToAdd;
89
+ $this->_js_added = true;
90
+ $this->jsToAdd = false;
91
+ } else {
92
+ $this->addAfterToJs();
93
+ echo $this->jsToAdd;
94
+ $this->jsToAdd = false;
95
+ }
96
+ }
97
+
98
+ function output_script_filter($content){
99
+ if ($this->_js_added != true && ! is_admin() && ! is_feed() )
100
+ {
101
+ $this->wrapJs();
102
+ $this->addWidgetToJs();
103
+ $this->addAfterToJs();
104
+ $content = $content . $this->jsToAdd;
105
+ $this->_js_added = true;
106
+ }
107
+ return $content;
108
+ }
109
+
110
+ function wrapJs(){
111
+ $this->jsToAdd .= "var addthis_for_wordpress = '".$this->productCode."';\n";
112
+ $this->jsToAdd = '<script type="text/javascript">' . $this->jsToAdd . '</script>';
113
+ }
114
+
115
+ /* testing for wp_footer in a theme stuff */
116
+ function update_wpfooter(){
117
+ $footer = $this->check_for_footer();
118
+ $options = $this->_options;
119
+ $options['wpfooter'] = $footer;
120
+ update_option( 'addthis_settings', $options);
121
+ $this->_options = $options;
122
+ }
123
+
124
+ function check_for_footer(){
125
+ $url = home_url();
126
+ $response = wp_remote_get( $url, array( 'sslverify' => false ) );
127
+ $code = (int) wp_remote_retrieve_response_code( $response );
128
+ if ( $code == 200 ) {
129
+ $html = preg_replace( '/[
130
+ s]/', '', wp_remote_retrieve_body( $response ) );
131
+ return (bool)( strstr( $html, '<!--wp_footer-->' ) );
132
+ }
133
+ }
134
+
135
+ function maybe_add_footer_comment(){
136
+ add_action( 'wp_footer', array($this, 'test_footer' ), 99999 ); // Some obscene priority, make sure we run last
137
+ }
138
+
139
+ /* END testing for wp_footer in a theme stuff */
140
+ function addToScript($newData){
141
+ $this->jsToAdd .= $newData;
142
+ }
143
+
144
+ function addAfterScript($newData){
145
+ if ( $this->_js_added != true )
146
+ {
147
+ $this->jsAfterAdd .= $newData;
148
+ } else {
149
+ $this->jsAfterAdd = $newData;
150
+ }
151
+ }
152
+
153
+ function addWidgetToJs(){
154
+ $addthis_settings_options = get_option('addthis_settings');
155
+ $addthis_asynchronous_loading = (isset($addthis_settings_options['addthis_asynchronous_loading']))?$addthis_settings_options['addthis_asynchronous_loading']:false;
156
+ if(isset($addthis_asynchronous_loading) && $addthis_asynchronous_loading) {
157
+ $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'&async=1"></script>';
158
+ //$this->jsToAdd .= '<script type="text/javascript" src="http://cache-dev.addthis.com/cachefly/js/300/addthis_widget.js&async=1"></script>';
159
+ $this->jsToAdd .= '<script type="text/javascript">jQuery(document).ready(function($) { addthis.init(); }); </script>';
160
+ } else {
161
+ //$this->jsToAdd .= '<script type="text/javascript" src="http://cache-dev.addthis.com/cachefly/js/300/addthis_widget.js#pubid='. urlencode( $this->pubid ).'"></script>';
162
+ $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'"></script>';
163
+ }
164
+ }
165
+
166
+ function addAfterToJs(){
167
+ if (! empty($this->jsAfterAdd)) {
168
+ $this->jsToAdd .= '<script type="text/javascript">' . $this->jsAfterAdd . '</script>';
169
+ $this->jsAfterAdd = NULL;
170
+ }
171
+ }
172
+
173
+ function getProfileId(){
174
+ return( isset( $this->_options['profile'] ) && ! empty($this->_options['profile']) )? $this->_options['profile'] : null;
175
+ }
176
+
177
+ function setProfileId($profile){
178
+ $this->_options['profile'] = sanitize_text_field($profile);
179
+ update_option( 'addthis_settings', $this->_options);
180
+ }
181
+
182
+ function test_footer(){
183
+ echo '<!--wp_footer-->';
184
+ }
185
+
186
+ function getAtPluginPromoText(){
187
+ // Included not to break the other plugins(smartlayer)
188
+ if (! did_action('admin_init') && ! current_filter('admin_init'))
189
+ {
190
+ _doing_it_wrong('getAtPluginPromoText', 'This function should only be called on an admin page load and no earlier the admin_init', 1);
191
+ return null;
192
+ }
193
+ return null;
194
+ }
195
+ }
js/addthis-for-wordpress.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Javascript for Addthis for Wordpress plugin
3
+ */
4
+
5
+ jQuery(document).ready(function($) {
6
+
7
+ jQuery('#addthis-pubid').focus();
8
+
9
+ jQuery('#addthis-form').submit(function(){
10
+ if (jQuery('#addthis-pubid').val() === '') {
11
+ jQuery('#addthis-pubid').css('border', '1px solid red');
12
+ jQuery('#addthis-pubid').attr('title', 'Please fill Profile Id');
13
+ return false;
14
+ }
15
+ });
16
+
17
+ jQuery('#addthis-pubid').keyup(function(){
18
+ if(jQuery(this).val().length > 0) {
19
+ jQuery(this).css('border', 'none');
20
+ jQuery(this).attr('title', '');
21
+ } else {
22
+ jQuery(this).css('border', '1px solid red');
23
+ jQuery(this).attr('title', 'Please fill Profile Id');
24
+ }
25
+ });
26
+ });
readme.txt CHANGED
@@ -1,20 +1,26 @@
1
- === Share Buttons by AddThis ===
2
  Contributors: srijith.v, solchea, _mjk_, addthis_paul
3
- Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz, pintrest, widget
4
  Requires at least: 3.0
5
- Tested up to: 3.8.1
6
- Stable tag: 3.5.10
7
 
8
- AddThis Share Buttons help drive traffic to your site by helping visitors share, bookmark and email your content to over 330 services.
 
9
 
10
  == Description ==
11
- Get more traffic back to your site by installing the AddThis WordPress plugin. With AddThis, your users can promote your content by sharing to over 330 of the most popular social networking and bookmarking sites (like Facebook, Twitter, Pinterest, Google+ and LinkedIn). We also support address bar sharing in modern browsers. Our button is small, unobtrusive, quick to load and recognized all over the web.
12
 
13
- Optionally, sign up for a free AddThis.com account to see how your visitors are sharing your content: which services they're using for sharing, which content is shared the most, and more.
14
 
15
- We also have plugins available for <a href='http://wordpress.org/extend/plugins/addthis-follow/'>increasing followers on social networks</a>, <a href='http://wordpress.org/extend/plugins/addthis-welcome/'>welcoming users based on social behavior</a>, <a href='http://wordpress.org/extend/plugins/addthis-social-sign-in'>adding social authentication</a> and <a href='http://wordpress.org/extend/plugins/addthis-trending-content/'>showing your trending content</a> to your WordPress blog.
16
 
17
- <a href="http://www.addthis.com/blog">AddThis Blog</a> | <a href="http://www.addthis.com/privacy">Privacy Policy</a>
 
 
 
 
 
 
18
 
19
  == Installation ==
20
 
@@ -37,44 +43,48 @@ To upload the plugin through WordPress, instead of FTP:
37
 
38
  = Is AddThis free? =
39
 
40
- Yep! The features you see today on AddThis will always be free of charge.
 
41
 
42
  = Do I need to create an account? =
43
 
44
- No. You only need to create an account if you want to see how your users are sharing your blog; the sharing itself works the same either way.
45
 
46
  = Is JavaScript required? =
47
 
48
  All of the options required through this plugin require javascript. JavaScript must be enabled. We load the actual interface via JavaScript at run-time, which allows us to upgrade the core functionality of the menu itself automatically everywhere.
49
 
50
  = Why use AddThis? =
51
- 1. Ease of use. AddThis is easy to install, customize and localize. We've worked hard to make it the simplest, most recognized sharing tool on the internet.
52
  1. Performance. The AddThis menu code is tiny and fast. We constantly optimize its behavior and design to make sharing a snap.
53
  1. Peace of mind. AddThis gathers the best services on the internet so you don't have to, and backs them up with industrial strength analytics, code caching, active tech support and a thriving developer community.
54
- 1. Flexibility. AddThis can be customized via API, and served securely via SSL. You can roll your own sharing toolbars with our toolbox. Share just about anything, anywhere -- your way.
55
  1. Global reach. AddThis sends content to 295+ sharing services 60+ languages, to over half a billion unique users in countries all over the world.
56
- 1. It's free!
57
 
58
  = Who else uses AddThis? =
59
- Over 14,000,000 sites have installed AddThis. With over a billion unique users, AddThis is helping share content all over the world, in more than sixty languages.
60
 
61
  = What services does AddThis support? =
62
- We currently support over 330 services, from email and blogging platforms to social networks and news aggregators, and we add new services every month. Want to know if your favorite service is supported? This list is accurate up to the minute: <a href="http://www.addthis.com/services">http://www.addthis.com/services</a>.
63
 
64
  = How do I remove AddThis from a page =
65
- In the screen options you can enable the AddThis meta box. Check the box and save if you've already published that page or post to disable AddThis on that page or post.
66
 
67
  == Screenshots ==
68
 
69
- 1. The admin dashboard widget
70
- 2. Previewing how your options look
71
- 3. The settings interface.
72
 
73
  == PHP Version ==
74
 
75
  PHP 5+ is preferred; PHP 4 is supported.
76
 
77
  == Changelog ==
 
 
 
 
78
  = 3.5.10 =
79
  * Minor bug fix
80
 
@@ -262,6 +272,8 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
262
 
263
 
264
  == Upgrade Notice ==
 
 
265
 
266
  = 3.5.10 =
267
  * Minor bug fix
1
+ === Smart Website Tools by AddThis ===
2
  Contributors: srijith.v, solchea, _mjk_, addthis_paul
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.0
6
+ Stable tag: 4.0
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 330 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
 
43
 
44
  = Is AddThis free? =
45
 
46
+ Many of our tools are free, but Pro users get the benefit of exclusive widgets, including mobile­friendly tools
47
+ and retina icons, priority support and deeper analytics.
48
 
49
  = Do I need to create an account? =
50
 
51
+ Yes. In order to use and manage the AddThis tools you will need to create an account with AddThis. It requires an email address and name, but that's it.
52
 
53
  = Is JavaScript required? =
54
 
55
  All of the options required through this plugin require javascript. JavaScript must be enabled. We load the actual interface via JavaScript at run-time, which allows us to upgrade the core functionality of the menu itself automatically everywhere.
56
 
57
  = Why use AddThis? =
58
+ 1. Ease of use. AddThis is easy to install, customize and localize. We've worked hard to make a suite of simple and beautiful website tools on the internet.
59
  1. Performance. The AddThis menu code is tiny and fast. We constantly optimize its behavior and design to make sharing a snap.
60
  1. Peace of mind. AddThis gathers the best services on the internet so you don't have to, and backs them up with industrial strength analytics, code caching, active tech support and a thriving developer community.
61
+ 1. Flexibility. AddThis can be customized via API, and served securely via SSL. You can roll your own sharing toolbars with our toolbox. Share just about anything, anywhere ­­ your way.
62
  1. Global reach. AddThis sends content to 295+ sharing services 60+ languages, to over half a billion unique users in countries all over the world.
 
63
 
64
  = Who else uses AddThis? =
65
+ Over 13,000,000 sites have installed AddThis. With over a billion unique users, AddThis is helping share content all over the world, in more than sixty languages.
66
 
67
  = What services does AddThis support? =
68
+ We currently support over 300 services, from email and blogging platforms to social networks and news aggregators, and we add new services every month. Want to know if your favorite service is supported? This list is accurate up to the minute: <a href="http://www.addthis.com/services">http://www.addthis.com/services</a>.
69
 
70
  = How do I remove AddThis from a page =
71
+ In the screen options you can enable the AddThis meta box. Check the box and save if you've already published that page or post to disable AddThis on that page or post.
72
 
73
  == Screenshots ==
74
 
75
+ 1. Analytics
76
+ 2. Tool Gallery
77
+ 3. Customization options
78
 
79
  == PHP Version ==
80
 
81
  PHP 5+ is preferred; PHP 4 is supported.
82
 
83
  == Changelog ==
84
+
85
+ = 4.0 =
86
+ * Integrated with AddThis Dashboard.
87
+
88
  = 3.5.10 =
89
  * Minor bug fix
90
 
272
 
273
 
274
  == Upgrade Notice ==
275
+ = 4.0 =
276
+ * WordPress Plugin Upgraded with AddThis Dashboard integration and Access To Pro Tools.
277
 
278
  = 3.5.10 =
279
  * Minor bug fix
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
uninstall.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ $option = get_option('addthis_settings');
3
+ if ($option && isset($option['addthis_wordpress_version'])) {
4
+ unset($option['addthis_wordpress_version']);
5
+ update_option('addthis_settings', $option);
6
+ }