WordPress Share Buttons Plugin – AddThis - Version 5.0

Version Description

  • 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.
  • Sharing sidebar configuration available within WordPress (in addition to the previously available sharing buttons above and below content).
  • Seperate preferences for what sharing buttons appear on what templates.
  • Cleaned up plugin and removed deprecated AddThis config options.
  • Added beauty.
  • Removed the global configuration for custom service list.
  • Removed support for themes that use the get_the_excerpt method because of inconsistent results across themes.
Download this release

Release Info

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

Code changes from version 4.0.7 to 5.0

AddThisCmsConnectorInterface.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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
+
22
+ if (!interface_exists('AddThisCmsConnectorInterface')) {
23
+ interface AddThisCmsConnectorInterface
24
+ {
25
+ public function getSharingButtonLocations();
26
+ public function getConfigs();
27
+ public function getContentTypes();
28
+ public function saveConfigs($configs);
29
+ }
30
+ }
AddThisConfigs.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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
+
22
+ if (!class_exists('AddThisConfigs')) {
23
+ Class AddThisConfigs {
24
+
25
+ protected $cmsInterface;
26
+ protected $configs = null;
27
+ protected $changedConfigs = false;
28
+ protected $defaultConfigs = array(
29
+ 'above' => 'large_toolbox',
30
+ 'above_custom_more' => '',
31
+ 'above_custom_preferred' => '',
32
+ 'above_custom_services' => '',
33
+ 'above_custom_size' => '',
34
+ 'above_custom_string' => '',
35
+ 'above_sharing' => 'above-enable-smart-sharing',
36
+ 'addthis_508' => '',
37
+ 'addthis_above_enabled' => false,
38
+ 'addthis_addressbar' => false,
39
+ 'addthis_aftertitle' => false,
40
+ 'addthis_append_data' => true,
41
+ 'addthis_asynchronous_loading' => true,
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' => '',
62
+ 'below_custom_preferred' => '',
63
+ 'below_custom_services' => '',
64
+ 'below_custom_size' => '',
65
+ 'below_custom_string' => '',
66
+ 'below_sharing' => 'below-enable-smart-sharing',
67
+ 'credential_validation_status' => 0,
68
+ 'data_ga_property' => '',
69
+ 'location' => 'below',
70
+ 'style' => addthis_style_default ,
71
+ 'toolbox' => '',
72
+ );
73
+
74
+ public function __construct($cmsInterface) {
75
+ $this->cmsInterface = $cmsInterface;
76
+ }
77
+
78
+ public function getDefaultConfigs() {
79
+ $defaultConfigs = array();
80
+
81
+ // add all share button location template settings to default to true
82
+ $locationContentTypeLocationFields = $this->getFieldsForContentTypeSharingLocations();
83
+
84
+ foreach ($locationContentTypeLocationFields as $field) {
85
+ $optionName = $field['fieldName'];
86
+ $defaultValue = $field['default'];
87
+ settype($defaultValue, $field['dataType']);
88
+ $defaultConfigs[$optionName] = $defaultValue;
89
+ }
90
+
91
+ $defaultConfigs = array_merge(
92
+ $this->defaultConfigs,
93
+ $defaultConfigs,
94
+ $this->cmsInterface->getDefaultConfigs()
95
+ );
96
+
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)) {
116
+ $this->configs = array_merge($this->configs, $configs);
117
+ } elseif (is_array($configs) && !is_array($this->configs)) {
118
+ $this->configs = $configs;
119
+ }
120
+
121
+ if (!is_null($this->configs)) {
122
+ $this->configs = $this->cmsInterface->saveConfigs($this->configs);
123
+ }
124
+
125
+ $this->changedConfigs = false;
126
+ return $this->configs;
127
+ }
128
+
129
+ private function setDefaultConfigs() {
130
+ $this->configs = $this->cmsInterface->getConfigs();
131
+
132
+ if (!is_array($this->configs)) {
133
+ $this->configs = $this->getDefaultConfigs();
134
+ $this->changedConfigs = true;
135
+ } else {
136
+ foreach($this->getDefaultConfigs() as $fieldName => $defaultValue) {
137
+ if (!isset($this->configs[$fieldName])) {
138
+ $this->configs[$fieldName] = $defaultValue;
139
+ $this->changedConfigs = true;
140
+ }
141
+ }
142
+ }
143
+
144
+ if ($this->changedConfigs) {
145
+ $this->configs = $this->saveConfigs();
146
+ }
147
+
148
+ return $this->configs;
149
+ }
150
+
151
+ public function getFieldsForContentTypeSharingLocations($requestedContentType = null, $requestedLocation = null) {
152
+ $buttonLocations = $this->cmsInterface->getSharingButtonLocations();
153
+ $contentTypes = $this->cmsInterface->getContentTypes();
154
+ $fields = array();
155
+
156
+ foreach ($buttonLocations as $location) {
157
+ if ($requestedLocation !== null && $requestedLocation !== $location) {
158
+ continue;
159
+ }
160
+
161
+ foreach ($contentTypes as $template) {
162
+ if ($requestedContentType !== null && $requestedContentType !== $template['fieldName']) {
163
+ continue;
164
+ }
165
+
166
+ if ($location == 'sidebar' && $template['fieldName'] == 'excerpts') {
167
+ continue;
168
+ }
169
+
170
+ $fieldName = "addthis_" . $location . "_showon_" . $template['fieldName'];
171
+ $variableName = $location . "_" . $template['fieldName'];
172
+ $displayName = $template['displayName'];
173
+ $explanation = $template['explanation'];
174
+
175
+ $fieldInfo = array(
176
+ 'fieldName' => $fieldName,
177
+ 'variableName' => $variableName,
178
+ 'displayName' => $displayName,
179
+ 'explanation' => $explanation,
180
+ 'location' => $location,
181
+ 'template' => $template,
182
+ 'fieldType' => 'checkbox',
183
+ 'dataType' => 'boolean',
184
+ 'default' => true,
185
+ );
186
+ $fields[] = $fieldInfo;
187
+ }
188
+ }
189
+
190
+ return $fields;
191
+ }
192
+ }
193
+ }
AddThisWordPressConnector.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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
+
22
+ require_once('AddThisCmsConnectorInterface.php');
23
+
24
+ if (!class_exists('AddthisWordpressConnector')) {
25
+ Class AddthisWordpressConnector implements AddThisCmsConnectorInterface {
26
+
27
+ static $settingsVariableName = 'addthis_settings';
28
+ static $pluginVersion = '5.0';
29
+ protected $configs = null;
30
+
31
+ protected $defaultConfigs = array(
32
+ 'addthis_plugin_controls' => 'WordPress',
33
+ );
34
+
35
+ public $simpleConfigUpgradeMappings = array(
36
+ array(
37
+ 'current' => array('addthis_above_showon_home', 'addthis_below_showon_home'),
38
+ 'deprecated' => array('addthis_showonhome'),
39
+ ),
40
+ array(
41
+ 'current' => array('addthis_above_showon_pages', 'addthis_below_showon_pages'),
42
+ 'deprecated' => array('addthis_showonpages'),
43
+ ),
44
+ array(
45
+ 'current' => array('addthis_above_showon_categories', 'addthis_below_showon_categories'),
46
+ 'deprecated' => array('addthis_showoncats'),
47
+ ),
48
+ array(
49
+ 'current' => array('addthis_above_showon_archives', 'addthis_below_showon_archives'),
50
+ 'deprecated' => array('addthis_showonarchives'),
51
+ ),
52
+ array(
53
+ 'current' => array('addthis_above_showon_posts', 'addthis_below_showon_posts'),
54
+ 'deprecated' => array('addthis_showonposts'),
55
+ ),
56
+ array(
57
+ 'current' => array('addthis_addressbar'),
58
+ 'deprecated' => array('addthis_copytracking2', 'addthis_copytracking1'),
59
+ ),
60
+ array(
61
+ 'current' => array('addthis_profile'),
62
+ 'deprecated' => array('profile', 'pubid'),
63
+ ),
64
+ );
65
+
66
+ static function getPluginVersion() {
67
+ return self::$pluginVersion;
68
+ }
69
+
70
+ public function getDefaultConfigs() {
71
+ return $this->defaultConfigs;
72
+ }
73
+
74
+ public function getConfigs($cache = false) {
75
+ if ($this->isPreviewMode()) {
76
+ $this->configs = get_transient(self::$settingsVariableName);
77
+ } elseif (!$cache || is_null($this->configs)) {
78
+ $this->configs = get_option(self::$settingsVariableName);
79
+ }
80
+
81
+ if (!is_array($this->configs)) {
82
+ $this->configs = null;
83
+ }
84
+
85
+ return $this->configs;
86
+ }
87
+
88
+ public function saveConfigs($configs = null) {
89
+ if (is_null($configs)) {
90
+ $configs = $this->configs;
91
+ }
92
+
93
+ if (!is_null($configs)) {
94
+ update_option(self::$settingsVariableName, $configs);
95
+ $this->configs = $this->getConfigs();
96
+ }
97
+
98
+ return $this->configs;
99
+ }
100
+
101
+ /**
102
+ * checks if you're in preview mode
103
+ * @return boolean true if in preview, false otherwise
104
+ */
105
+ public function isPreviewMode() {
106
+ if (isset($_GET['preview']) && $_GET['preview'] == 1) {
107
+ return true;
108
+ }
109
+
110
+ return false;
111
+ }
112
+
113
+ public function getSharingButtonLocations() {
114
+ $types = array(
115
+ 'above',
116
+ 'below',
117
+ 'sidebar',
118
+ );
119
+ return $types;
120
+ }
121
+
122
+ /**
123
+ * Returns an array of template options generlized without location info
124
+ * @return array[] an array of associative arrays
125
+ */
126
+
127
+ public function getContentTypes() {
128
+ $options = array(
129
+ array(
130
+ 'fieldName' => 'home',
131
+ 'displayName' => 'Homepage',
132
+ 'explanation' => 'Includes both the blog post index page (home.php or index.php) and any static page set to be your front page under Settings->Reading->Front page displays.',
133
+ ),
134
+ array(
135
+ 'fieldName' => 'posts',
136
+ 'displayName' => 'Posts',
137
+ 'explanation' => 'Also known as articles or blog posts.',
138
+ ),
139
+ array(
140
+ 'fieldName' => 'pages',
141
+ 'displayName' => 'Pages',
142
+ 'explanation' => 'Often used to present static information about yourself or your site where the date published is less revelant than with posts.',
143
+ ),
144
+ array(
145
+ 'fieldName' => 'archives',
146
+ 'displayName' => 'Archives',
147
+ 'explanation' => 'A Category, Tag, Author or Date based view.',
148
+ ),
149
+ array(
150
+ 'fieldName' => 'categories',
151
+ 'displayName' => 'Categories',
152
+ 'explanation' => 'A view that displays costs filled under a specific category.',
153
+ ),
154
+ array(
155
+ 'fieldName' => 'excerpts',
156
+ 'displayName' => 'Excerpts',
157
+ 'explanation' => 'A condensed description of your post or page. These are often displayed in search results, RSS feeds, and sometimes on Archive or Category views. Important: Excerpts will only work some of the time with some themes, depending on how that theme retrieves your content.',
158
+ ),
159
+ );
160
+ return $options;
161
+ }
162
+
163
+ public function isUpgrade() {
164
+ $this->getConfigs(true);
165
+ if ( !isset($this->configs['addthis_plugin_version'])
166
+ || $this->configs['addthis_plugin_version'] != self::$pluginVersion
167
+ ) {
168
+ return true;
169
+ }
170
+
171
+ return false;
172
+ }
173
+
174
+ public function upgradeConfigs() {
175
+ $this->getConfigs(true);
176
+ if (is_null($this->configs)) {
177
+ return $this->configs;
178
+ }
179
+
180
+ $this->configs['addthis_plugin_version'] = self::$pluginVersion;
181
+
182
+ foreach ($this->simpleConfigUpgradeMappings as $configUpgradeMapping) {
183
+ foreach ($configUpgradeMapping['current'] as $currentFieldName) {
184
+ foreach ($configUpgradeMapping['deprecated'] as $deprecatedFieldName) {
185
+ $this->getFromPreviousConfig($deprecatedFieldName, $currentFieldName);
186
+ }
187
+ }
188
+ }
189
+
190
+ // if AddThis above button was enabled
191
+ if ( !isset($this->configs['addthis_above_enabled'])
192
+ && isset($this->configs['above'])
193
+ ) {
194
+ if ($this->configs['above'] == 'none' || $this->configs['above'] == 'disable') {
195
+ $this->configs['addthis_above_enabled'] = false;
196
+ } else {
197
+ $this->configs['addthis_above_enabled'] = true;
198
+ }
199
+ }
200
+
201
+ // if AddThis below button was enabled
202
+ if ( !isset($this->configs['addthis_below_enabled'])
203
+ && isset($this->configs['below'])
204
+ ) {
205
+ if ($this->configs['below'] == 'none' || $this->configs['below'] == 'disable') {
206
+ $this->configs['addthis_below_enabled'] = false;
207
+ } else {
208
+ $this->configs['addthis_below_enabled'] = true;
209
+ }
210
+ }
211
+
212
+ if ( isset($this->configs['addthis_for_wordpress'])
213
+ && $this->configs['addthis_for_wordpress']
214
+ && !isset($this->configs['addthis_plugin_controls'])
215
+ ) {
216
+ $this->configs['addthis_plugin_controls'] = "AddThis";
217
+ }
218
+
219
+ $this->saveConfigs();
220
+ return $this->configs;
221
+ }
222
+
223
+ private function getFromPreviousConfig($deprecatedFieldName, $currentFieldName) {
224
+ // if we don't have this value, get from a the depricated field
225
+ if ( is_array($this->configs)
226
+ && isset($this->configs[$deprecatedFieldName])
227
+ && !empty($this->configs[$deprecatedFieldName])
228
+ && !isset($this->configs[$currentFieldName])
229
+ ) {
230
+ $deprecatedValue = $this->configs[$deprecatedFieldName];
231
+ $this->configs[$currentFieldName] = $deprecatedValue;
232
+ }
233
+ }
234
+ }
235
+ }
COPYING ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
addthis-for-wordpress.php CHANGED
@@ -1,7 +1,7 @@
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 |
@@ -17,24 +17,12 @@
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', '4.0.1');
36
- }
37
-
38
  if (!defined('ADDTHIS_ATVERSION')) {
39
  define('ADDTHIS_ATVERSION', '300');
40
  }
@@ -45,23 +33,16 @@ 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
 
@@ -70,13 +51,15 @@ class Addthis_Wordpress
70
 
71
  /** check upgrade or fresh installation **/
72
  private $_upgrade;
73
-
74
  /** Addthis Profile id **/
75
  private $_pubid;
76
-
77
  /** Addthis Settings **/
78
  private $_options;
79
 
 
 
80
  /**
81
  * Initializes the plugin.
82
  *
@@ -84,22 +67,27 @@ class Addthis_Wordpress
84
  *
85
  * @return null
86
  * */
87
- public function __construct($upgrade)
88
  {
 
89
  // Save async load settings via ajax request
90
  add_action( 'wp_ajax_at_async_loading', array($this, 'addthisAsyncLoading'));
91
  $this->_upgrade = $upgrade;
92
  $this->_getVariables = $_GET;
93
  $this->_postVariables = $_POST;
94
- $this->_options = $this->getSettings();
95
-
96
- $this->_pubid = (isset($this->_options)
97
- && isset($this->_options['profile']))
98
- ? $this->_options['profile'] : null;
 
 
 
 
99
 
100
  include_once 'addthis-toolbox.php';
101
  new Addthis_ToolBox;
102
-
103
  add_action('admin_menu', array($this, 'addthisWordpressMenu'));
104
 
105
  // Deactivation
@@ -107,30 +95,30 @@ class Addthis_Wordpress
107
  ADDTHIS_PLUGIN_FILE,
108
  array($this, 'pluginDeactivation')
109
  );
110
-
111
  // Settings link in plugins page
112
  $plugin = 'addthis/addthis_social_widget.php';
113
  add_filter(
114
- "plugin_action_links_$plugin",
115
  array($this, 'addSettingsLink')
116
  );
117
  }
118
-
119
  /*
120
  * Function to add settings link in plugins page
121
- *
122
  * @return null
123
  */
124
  public function addSettingsLink($links)
125
  {
126
  $settingsLink = '<a href="'.self::getSettingsPageUrl().'">Settings</a>';
127
  array_push($links, $settingsLink);
128
- return $links;
129
  }
130
 
131
  /**
132
  * Functions to execute on plugin deactivation
133
- *
134
  * @return null
135
  */
136
  public function pluginDeactivation()
@@ -142,21 +130,23 @@ class Addthis_Wordpress
142
 
143
  /**
144
  * Adds sub menu page to the WP settings menu
145
- *
146
  * @return null
147
  */
148
  public function addthisWordpressMenu()
149
  {
150
  add_options_page(
151
- 'AddThis for Wordpress', 'AddThis for Wordpress',
152
- 'manage_options', ADDTHIS_SETTINGS_PAGE_ID,
 
 
153
  array($this, 'addthisWordpressOptions')
154
  );
155
  }
156
 
157
  /**
158
  * Manages the WP settings page
159
- *
160
  * @return null
161
  */
162
  public function addthisWordpressOptions()
@@ -176,80 +166,87 @@ class Addthis_Wordpress
176
  'addThisScript',
177
  plugins_url(ADDTHIS_JS_PATH, __FILE__)
178
  );
 
 
179
  wp_enqueue_style(
180
  'addThisStylesheet',
181
  plugins_url(ADDTHIS_CSS_PATH, __FILE__)
182
  );
 
183
  echo $this->_getHTML($updateResult);
184
  }
185
 
186
  /**
187
  * Updates addthis profile id
188
- *
189
  * @param string $pubId Addthis public id
190
- *
191
  * @return string
192
  */
193
  public function updateSettings($settings)
194
  {
195
  if(isset($settings['pubid'])){
196
- $this->_options['profile'] = $settings['pubid'];
197
  }
 
 
 
 
 
 
 
 
 
 
 
198
  if(isset($settings['async_loading'])){
199
- $this->_options['addthis_asynchronous_loading'] = $settings['async_loading'];
200
  }
201
- update_option('addthis_settings', $this->_options);
202
- $this->_pubid = $this->_options['profile'];
203
- return "<div class='addthis_updated wrap'>".
 
 
204
  "AddThis Profile Settings updated successfully!!!".
205
  "</div>";
206
  }
207
 
208
  /**
209
  * Get addthis profile id
210
- *
211
  * @return string
212
  */
213
  public static function getPubid()
214
  {
215
- $settings = get_option('addthis_settings');
216
- if (isset($settings) && isset($settings['profile'])) {
217
- return $settings['profile'];
 
218
  } else {
219
  return null;
220
  }
221
  }
222
-
223
- /**
224
- * Get addthis settings array
225
- *
226
- * @return string
227
- */
228
- public function getSettings()
229
- {
230
- return get_option('addthis_settings');
231
- }
232
 
233
  /**
234
  * Get referer url
235
- *
236
  * @return string
237
  */
238
  private function _getReferelUrl()
239
  {
240
- $referer = '';
241
  if (isset($_SERVER['HTTP_REFERER'])) {
242
  $parse = parse_url($_SERVER['HTTP_REFERER']);
243
  $referer = $parse['host'];
244
  }
245
-
246
  // return $referer;
247
  return self::ADDTHIS_REFERER;
248
  }
249
 
250
  /**
251
  * Check if there is an addthis profile id return from addthis.com
252
- *
253
  * @return boolean
254
  */
255
  private function _checkPubidFromAddThis()
@@ -271,11 +268,13 @@ class Addthis_Wordpress
271
  private function _checkAddPubid()
272
  {
273
  $successReturn = isset ($this->_postVariables['pubid'])
274
- && isset ($this->_postVariables['submit']);
 
 
275
 
276
  return $successReturn;
277
  }
278
-
279
  /**
280
  * Check if there is request to update async loading
281
  *
@@ -287,10 +286,10 @@ class Addthis_Wordpress
287
 
288
  return $successReturn;
289
  }
290
-
291
  public function addthisAsyncLoading()
292
  {
293
- if ($this->_checkAsyncLoading()) {
294
  $updateResult = $this->updateSettings($this->_postVariables);
295
  }
296
  die; //exit from the ajax request
@@ -314,21 +313,28 @@ class Addthis_Wordpress
314
 
315
  /**
316
  * Get the HTML for addthis settings page
317
- *
318
  * @param string $updateResult Updated message
319
- *
320
  * @return string
321
  */
322
  private function _getHTML($updateResult)
323
  {
324
- $html = '<div class="addthis_wrap">'.
325
- '<p>'.
326
- '<img class="header-img" '.
327
- 'src="//cache.addthis.com/icons/v1/thumbs/32x32/more.png" '.
328
- 'alt="Addthis">'.
329
- '<span class="addthis-title">AddThis <sup>*</sup></span>'.
330
- '<span class="addthis-name">for WordPress</span>'.
331
- '</p>';
 
 
 
 
 
 
 
332
  if ($this->_upgrade && !$this->_pubid) {
333
  $html .= $this->_getupdateSuccessMessage();
334
  }
@@ -346,10 +352,17 @@ class Addthis_Wordpress
346
  && ($this->_getVariables['advanced_settings'] == 'true'))
347
  ) {
348
  // Get Confirmation form
349
- $html .= $this->_getConfirmationForm();
350
  } else {
351
  $html .= $this->_getAddThisLinkButton();
352
- $html .= "</div>";
 
 
 
 
 
 
 
353
  }
354
 
355
  return $html;
@@ -386,148 +399,87 @@ class Addthis_Wordpress
386
  */
387
  private function _getAddThisLinkButton()
388
  {
389
- $html = '';
390
- if (!$this->_pubid) {
391
- $html = "<h2>You're almost done!</h2>";
392
- }
393
- $html .= "<div class='addthis_description'>".
394
- "Beautiful simple website tools designed to help you get ".
395
- "likes, get shares, get follows and get discovered. </div>";
396
-
397
- if (!$this->_pubid) {
398
- // Get pub name
399
- $pubName = self::_getPubName();
400
- $html .= "<a class='addthis_button next' ".
401
- "href='".self::ADDTHIS_SITE_URL.
402
- "?cms=wp&pubname=".urlencode($pubName)."&wp_redirect=".
403
- str_replace('.', '%2E', urlencode(self::getSettingsPageUrl())).
404
- "'>Next</a>";
405
- } else {
406
-
407
- $html .= "<a class='addthis_button' target='_blank'".
408
- "href='".self::ADDTHIS_SITE_URL."?cms=wp&pubid=".$this->_pubid.
409
- "'>".
410
- "To control your AddThis plugins, click here &#8594;".
411
- "</a>";
412
- }
413
-
414
- $html .="<p class='addthis_support'> If you don’t see your tools after configuring them in the dashboard, please contact ".
415
- "<a href='http://support.addthis.com/'>AddThis Support</a></p>";
416
-
417
-
418
- $html .= "<div class='addthis_seperator'>&nbsp;</div>";
419
- $html .= "<a href = '".
420
- self::getSettingsPageUrl()."&advanced_settings=true'".
421
- " class='addthis_reset_button'>Edit Profile Settings</a>";
422
 
423
- return $html;
424
- }
 
 
 
 
 
 
 
 
 
425
 
426
- /**
427
- * Get the pubname for addthis
428
- *
429
- * @return string
430
- */
431
- private static function _getPubName()
432
- {
433
- $pubName = get_bloginfo('name');
434
-
435
- if (!preg_match('/^[A-Za-z0-9 _\-\(\)]*$/', $pubName)) {
436
- // if title not match, get domain
437
- $domain = self::getDomain();
438
- if (preg_match(
439
- '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i',
440
- $domain, $regs
441
- )) {
442
- $domainArray = explode(".", $regs['domain']);
443
- $pubName = $domainArray[0];
444
- } else {
445
- $pubName = '';
446
- }
447
- $pubName = str_replace('.', '', $pubName);
448
  }
449
 
450
- if (!preg_match('/^[A-Za-z0-9 _\-\(\)]*$/', $pubName) || $pubName == '') {
451
- // if domain not match, get loggedin username
452
- $currentUser = wp_get_current_user();
453
- $pubName = $currentUser->user_login;
454
  }
455
 
456
- $pubName = substr($pubName, 0, ADDTHIS_PUBNAME_LIMIT);
457
- return $pubName;
458
- }
459
-
460
- /**
461
- * Get HTML for new users with confirmation
462
- *
463
- * @return string
464
- */
465
- private function _getConfirmationForm()
466
- {
467
- if (isset($this->_getVariables['advanced_settings'])) {
468
- $html = "<div>";
469
- $html .= "Here you can manually set your AddThis Profile ID - ".
470
- "you can get this from your ".
471
- "<a target='_blank' ".
472
- "href='".self::ADDTHIS_PROFILE_SETTINGS_PAGE."'>".
473
- "Profile Settings</a>";
474
- $html .= "</div>";
475
- } else {
476
- $html = "<h2>You're almost done!</h2>";
477
- $html .= "<div>".
478
- "It's time to connect your AddThis account with Wordpress.".
479
- "</div>";
480
- }
481
- $html .= '<form id="addthis-form" method="post" action="'.
482
- self::getSettingsPageUrl().'">';
483
- $html .= "<div class='addthis_pub_id'>".
484
- "<div class='icons wp_div'>".
485
- "<img src='".plugins_url('images/wordpress.png', __FILE__).
486
- "'>".
487
- "<span>Your WordPress Site:</span>".
488
- "<input type='text' value='" . get_bloginfo('name') . "'".
489
- "name='pub_id' readonly=true onfocus='this.blur()'/>".
490
- "</div>".
491
- "<div class='icons arrow_div'>".
492
- "<img src='".plugins_url('images/arrow_right.png', __FILE__).
493
- "'>".
494
- "<img src='".plugins_url('images/arrow_left.png', __FILE__).
495
- "'>".
496
- "</div>".
497
- "<div class='icons addthis_div'>".
498
- "<img src='".plugins_url('images/addthis.png', __FILE__).
499
- "'>".
500
- "<span>AddThis Profile ID:</span>";
501
-
502
- if (isset($this->_getVariables['pubid'])) {
503
- $pubId = $this->_getVariables['pubid'];
504
- } else {
505
- $pubId = $this->_pubid;
506
- }
507
-
508
- $html .= "<input type='text' value='".$pubId."' ".
509
- "name='pubid' id='addthis-pubid'/>";
510
- $html .= "</div></div>";
511
-
512
- $submitButtonValue = "Confirm and Save";
513
-
514
- if (isset($this->_getVariables['advanced_settings'])) {
515
- $submitButtonValue = "Update";
516
- }
517
-
518
- $html .= '<input type="submit" value="'.$submitButtonValue.'"'.
519
- ' name="submit" class="addthis_confirm_button">';
520
- $html .= '<button class="addthis_cancel_button" type="button"'
521
- . ' onclick="window.location=\''.self::getSettingsPageUrl()
522
- .'\';return false;">Cancel</button>';
523
- $html .= "</form>";
524
 
525
  return $html;
526
  }
527
 
528
  /**
529
  * Get the plugin's settings page url
530
- *
531
  * @return string
532
  */
533
  public static function getSettingsPageUrl()
@@ -537,7 +489,7 @@ class Addthis_Wordpress
537
 
538
  /**
539
  * Get the wp domain
540
- *
541
  * @return string
542
  */
543
  public static function getDomain()
@@ -565,9 +517,10 @@ add_action('init', 'Addthis_Wordpress_early', 0);
565
  function Addthis_Wordpress_early()
566
  {
567
  global $addthis_addjs;
 
 
568
  if (!isset($addthis_addjs)) {
569
  include 'includes/addthis_addjs_new.php';
570
- $addthis_options = get_option('addthis_settings');
571
- $addthis_addjs = new AddThis_addjs($addthis_options);
572
  }
573
- }
1
  <?php
2
  /**
3
  * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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 |
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
+
22
  $pathParts = pathinfo(__FILE__);
23
 
24
  $path = $pathParts['dirname'];
25
 
 
 
 
 
26
  if (!defined('ADDTHIS_ATVERSION')) {
27
  define('ADDTHIS_ATVERSION', '300');
28
  }
33
  define('ADDTHIS_PLUGIN_FILE', $path.'/addthis_social_widget.php');
34
  define('ADDTHIS_PUBNAME_LIMIT', 255);
35
 
36
+ require_once('addthis_settings_functions.php');
37
+
 
 
 
 
 
 
 
 
38
  class Addthis_Wordpress
39
  {
40
  const ADDTHIS_PROFILE_SETTINGS_PAGE = 'https://www.addthis.com/settings/publisher';
41
  const ADDTHIS_SITE_URL = 'https://www.addthis.com/settings/plugin-pubs';
42
  const ADDTHIS_SITE_URL_WITH_PUB = 'https://www.addthis.com/dashboard#gallery';
43
+ const ADDTHIS_SITE_URL_ANALYTICS = 'https://www.addthis.com/dashboard#analytics';
44
  const ADDTHIS_REFERER = 'www.addthis.com';
45
+
46
  /** PHP $_GET Variables * */
47
  private $_getVariables;
48
 
51
 
52
  /** check upgrade or fresh installation **/
53
  private $_upgrade;
54
+
55
  /** Addthis Profile id **/
56
  private $_pubid;
57
+
58
  /** Addthis Settings **/
59
  private $_options;
60
 
61
+ private $addThisConfigs;
62
+
63
  /**
64
  * Initializes the plugin.
65
  *
67
  *
68
  * @return null
69
  * */
70
+ public function __construct($upgrade, $addThisConfigs)
71
  {
72
+ $this->addThisConfigs = $addThisConfigs;
73
  // Save async load settings via ajax request
74
  add_action( 'wp_ajax_at_async_loading', array($this, 'addthisAsyncLoading'));
75
  $this->_upgrade = $upgrade;
76
  $this->_getVariables = $_GET;
77
  $this->_postVariables = $_POST;
78
+ $this->_options = $this->addThisConfigs->getConfigs();
79
+
80
+ $this->_pubid = null;
81
+ if ( isset($this->_options)
82
+ && isset($this->_options['addthis_profile'])
83
+ && !empty($this->_options['addthis_profile'])
84
+ ) {
85
+ $this->_pubid = $this->_options['addthis_profile'];
86
+ }
87
 
88
  include_once 'addthis-toolbox.php';
89
  new Addthis_ToolBox;
90
+
91
  add_action('admin_menu', array($this, 'addthisWordpressMenu'));
92
 
93
  // Deactivation
95
  ADDTHIS_PLUGIN_FILE,
96
  array($this, 'pluginDeactivation')
97
  );
98
+
99
  // Settings link in plugins page
100
  $plugin = 'addthis/addthis_social_widget.php';
101
  add_filter(
102
+ "plugin_action_links_$plugin",
103
  array($this, 'addSettingsLink')
104
  );
105
  }
106
+
107
  /*
108
  * Function to add settings link in plugins page
109
+ *
110
  * @return null
111
  */
112
  public function addSettingsLink($links)
113
  {
114
  $settingsLink = '<a href="'.self::getSettingsPageUrl().'">Settings</a>';
115
  array_push($links, $settingsLink);
116
+ return $links;
117
  }
118
 
119
  /**
120
  * Functions to execute on plugin deactivation
121
+ *
122
  * @return null
123
  */
124
  public function pluginDeactivation()
130
 
131
  /**
132
  * Adds sub menu page to the WP settings menu
133
+ *
134
  * @return null
135
  */
136
  public function addthisWordpressMenu()
137
  {
138
  add_options_page(
139
+ 'AddThis Sharing Buttons',
140
+ 'AddThis Sharing Buttons',
141
+ 'manage_options',
142
+ ADDTHIS_SETTINGS_PAGE_ID,
143
  array($this, 'addthisWordpressOptions')
144
  );
145
  }
146
 
147
  /**
148
  * Manages the WP settings page
149
+ *
150
  * @return null
151
  */
152
  public function addthisWordpressOptions()
166
  'addThisScript',
167
  plugins_url(ADDTHIS_JS_PATH, __FILE__)
168
  );
169
+ wp_enqueue_script('atTabs',plugins_url('js/options-page.32.js', __FILE__));
170
+ wp_enqueue_script('jquery-ui-tabs');
171
  wp_enqueue_style(
172
  'addThisStylesheet',
173
  plugins_url(ADDTHIS_CSS_PATH, __FILE__)
174
  );
175
+ wp_enqueue_style('attabStyles',plugins_url('css/options-page.css', __FILE__));
176
  echo $this->_getHTML($updateResult);
177
  }
178
 
179
  /**
180
  * Updates addthis profile id
181
+ *
182
  * @param string $pubId Addthis public id
183
+ *
184
  * @return string
185
  */
186
  public function updateSettings($settings)
187
  {
188
  if(isset($settings['pubid'])){
189
+ $this->_options['addthis_profile'] = sanitize_key($settings['pubid']);
190
  }
191
+
192
+ if(isset($settings['addthis_settings']['addthis_environment'])){
193
+ $this->_options['addthis_environment'] = sanitize_key($settings['addthis_settings']['addthis_environment']);
194
+ }
195
+
196
+ if( isset($settings['addthis_plugin_controls'])
197
+ && $settings['addthis_plugin_controls'] == "WordPress"
198
+ ) {
199
+ $this->_options['addthis_plugin_controls'] = $settings['addthis_plugin_controls'];
200
+ }
201
+
202
  if(isset($settings['async_loading'])){
203
+ $this->_options['addthis_asynchronous_loading'] = intval($settings['async_loading']);
204
  }
205
+ $this->_options = $this->addThisConfigs->saveConfigs($this->_options);
206
+
207
+ $this->_pubid = $this->_options['addthis_profile'];
208
+
209
+ return "<div class='addthis_updated wrap' style='margin-top:50px;width:95%'>".
210
  "AddThis Profile Settings updated successfully!!!".
211
  "</div>";
212
  }
213
 
214
  /**
215
  * Get addthis profile id
216
+ *
217
  * @return string
218
  */
219
  public static function getPubid()
220
  {
221
+ global $addThisConfigs;
222
+ $settings = $addThisConfigs->getConfigs();
223
+ if (!empty($settings['addthis_profile'])) {
224
+ return $settings['addthis_profile'];
225
  } else {
226
  return null;
227
  }
228
  }
 
 
 
 
 
 
 
 
 
 
229
 
230
  /**
231
  * Get referer url
232
+ *
233
  * @return string
234
  */
235
  private function _getReferelUrl()
236
  {
237
+ $referer = '';
238
  if (isset($_SERVER['HTTP_REFERER'])) {
239
  $parse = parse_url($_SERVER['HTTP_REFERER']);
240
  $referer = $parse['host'];
241
  }
242
+
243
  // return $referer;
244
  return self::ADDTHIS_REFERER;
245
  }
246
 
247
  /**
248
  * Check if there is an addthis profile id return from addthis.com
249
+ *
250
  * @return boolean
251
  */
252
  private function _checkPubidFromAddThis()
268
  private function _checkAddPubid()
269
  {
270
  $successReturn = isset ($this->_postVariables['pubid'])
271
+ && isset ($this->_postVariables['submit'])
272
+ && isset( $this->_postVariables['pubid_nonce'] )
273
+ && wp_verify_nonce( $this->_postVariables['pubid_nonce'], 'update_pubid' );
274
 
275
  return $successReturn;
276
  }
277
+
278
  /**
279
  * Check if there is request to update async loading
280
  *
286
 
287
  return $successReturn;
288
  }
289
+
290
  public function addthisAsyncLoading()
291
  {
292
+ if (current_user_can( 'manage_options' ) && $this->_checkAsyncLoading()) {
293
  $updateResult = $this->updateSettings($this->_postVariables);
294
  }
295
  die; //exit from the ajax request
313
 
314
  /**
315
  * Get the HTML for addthis settings page
316
+ *
317
  * @param string $updateResult Updated message
318
+ *
319
  * @return string
320
  */
321
  private function _getHTML($updateResult)
322
  {
323
+ $html = '
324
+ <div class="wrap">
325
+ <form
326
+ id="addthis-form"
327
+ method="post"
328
+ action="'.self::getSettingsPageUrl().'"
329
+ >
330
+ <div class="Header">
331
+ <h1><em>AddThis</em> Sharing Buttons</h1>';
332
+ if (!_addthis_is_csr_form()) {
333
+ $html .= '<span class="preview-save-btns">' . _addthis_settings_buttons(false) . '</span>';
334
+ }
335
+
336
+ $html .= '</div>';
337
+
338
  if ($this->_upgrade && !$this->_pubid) {
339
  $html .= $this->_getupdateSuccessMessage();
340
  }
352
  && ($this->_getVariables['advanced_settings'] == 'true'))
353
  ) {
354
  // Get Confirmation form
355
+ $html .= addthis_profile_id_csr_confirmation('pubid');
356
  } else {
357
  $html .= $this->_getAddThisLinkButton();
358
+ }
359
+
360
+ if (!_addthis_is_csr_form()) {
361
+ $html .= '
362
+ <div class="Btn-container-end">
363
+ ' . _addthis_settings_buttons(false) . '
364
+ </div>
365
+ </form>';
366
  }
367
 
368
  return $html;
399
  */
400
  private function _getAddThisLinkButton()
401
  {
402
+ $noPubIdDescription = 'To configure sharing tools for your site, use the button below to set up an AddThis account at addthis.com, create a profile for your site and begin adding sharing tools. This process will require an email address.';
403
+ $noPubIdButtonText = "AddThis profile setup";
404
+ $noPubIdCardTitle = 'You\'re almost done!';
405
+
406
+ $pubIdDescription = 'To configure sharing tools for your site, use the button below. It will take you to Tools on addthis.com';
407
+ $pubIdCardTitle = 'Setup AddThis Tools';
408
+ $pubIdButtonText = "Configure AddThis Tools";
409
+
410
+ if (empty($this->_pubid)) {
411
+ // if they don't have a profile yet, default to setup
412
+ $tabOrder = array(
413
+ 'tabs-1' => 'Setup',
414
+ 'tabs-2' => 'Advanced Options',
415
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
 
417
+ $sharingToolsCardTitle = $noPubIdCardTitle;
418
+ $sharingToolsDescription = $noPubIdDescription;
419
+ $sharingToolsButtonUrl = _addthis_profile_setup_url();
420
+ $sharingToolsButtonText = $noPubIdButtonText;
421
+ $target = '';
422
+ } else {
423
+ // else default to profile
424
+ $tabOrder = array(
425
+ 'tabs-1' => 'Sharing Tools',
426
+ 'tabs-2' => 'Advanced Options',
427
+ );
428
 
429
+ $sharingToolsCardTitle = $pubIdCardTitle;
430
+ $sharingToolsDescription = $pubIdDescription;
431
+ $sharingToolsButtonUrl = _addthis_tools_url();
432
+ $sharingToolsButtonText = $pubIdButtonText;
433
+ $target = 'target="_blank"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  }
435
 
436
+ $tabsHtml = '';
437
+ foreach ($tabOrder as $href => $title) {
438
+ $tabsHtml .= '<li class="Tabbed-nav-item"><a href="#' . $href . '">' . $title . '</a></li>';
 
439
  }
440
 
441
+ $html = '
442
+ <div class="Main-content" id="tabs">
443
+ <ul class="Tabbed-nav">
444
+ ' . $tabsHtml . '
445
+ </ul>
446
+ <div id="tabs-1">
447
+ <div class="Card" id="Card-side-sharing" style="height:320px">
448
+ <div>
449
+ <h3 class="Card-hd-title">
450
+ ' . $sharingToolsCardTitle . '
451
+ </h3>
452
+ </div>
453
+ <div class="addthis_seperator">&nbsp;</div>
454
+ <div class="Card-bd">
455
+ <div class="addthis_description">
456
+ Beautiful simple website tools designed to help you get likes, get shares, get follows and get discovered.
457
+ </div>
458
+ <p>' . $sharingToolsDescription . '</p>
459
+ <a
460
+ class="Btn Btn-blue"
461
+ ' . $target . '
462
+ href="' . $sharingToolsButtonUrl . '">' . $sharingToolsButtonText . ' &#8594;
463
+ </a>
464
+ <p class="addthis_support">
465
+ If you don\'t see your tools after configuring them in the dashboard, please contact
466
+ <a href="http://support.addthis.com/">AddThis Support</a>
467
+ </p>
468
+ </div>
469
+ </div>
470
+ </div>
471
+ <div id="tabs-2">
472
+ ' . _addthis_profile_id_card() . '
473
+ ' . _addthis_mode_card() . '
474
+ </div>
475
+ </div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
 
477
  return $html;
478
  }
479
 
480
  /**
481
  * Get the plugin's settings page url
482
+ *
483
  * @return string
484
  */
485
  public static function getSettingsPageUrl()
489
 
490
  /**
491
  * Get the wp domain
492
+ *
493
  * @return string
494
  */
495
  public static function getDomain()
517
  function Addthis_Wordpress_early()
518
  {
519
  global $addthis_addjs;
520
+ global $addThisConfigs;
521
+
522
  if (!isset($addthis_addjs)) {
523
  include 'includes/addthis_addjs_new.php';
524
+ $addthis_addjs = new AddThis_addjs($addThisConfigs);
 
525
  }
526
+ }
addthis-toolbox.php CHANGED
@@ -1,7 +1,7 @@
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 |
@@ -17,28 +17,12 @@
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
  {
@@ -52,22 +36,18 @@ class Addthis_ToolBox
52
  const AT_ABOVE_POST_CAT_PAGE = "at-above-post-cat-page";
53
  const AT_BELOW_POST_CAT_PAGE = "at-below-post-cat-page";
54
  const AT_ABOVE_POST_ARCH_PAGE = "at-above-post-arch-page";
55
- const AT_BELOW_POST_ARCH_PAGE = "at-below-post-arch-page";
56
  const AT_CONTENT_BELOW_POST_HOME = "at-below-post-homepage-recommended";
57
  const AT_CONTENT_BELOW_POST_PAGE = "at-below-post-page-recommended";
58
  const AT_CONTENT_BELOW_POST = "at-below-post-recommended";
59
  const AT_CONTENT_BELOW_CAT_PAGE = "at-below-post-cat-page-recommended";
60
- const AT_CONTENT_BELOW_ARCH_PAGE = "at-below-post-arch-page-recommended";
61
  const AT_CONTENT_ABOVE_POST_HOME = "at-above-post-homepage-recommended";
62
  const AT_CONTENT_ABOVE_POST_PAGE = "at-above-post-page-recommended";
63
  const AT_CONTENT_ABOVE_POST = "at-above-post-recommended";
64
  const AT_CONTENT_ABOVE_CAT_PAGE = "at-above-post-cat-page-recommended";
65
  const AT_CONTENT_ABOVE_ARCH_PAGE = "at-above-post-arch-page-recommended";
66
 
67
- //This associative array keeps relates a post ID to a Title and URL
68
- // Javascript code will later use this to identify and mark up posts
69
- public static $postTitlesAndUrlsById;
70
-
71
  /**
72
  * Initializes the widget class.
73
  * */
@@ -76,58 +56,7 @@ class Addthis_ToolBox
76
  add_filter('the_content', array($this, 'addWidget'));
77
  if ( has_excerpt()) {
78
  add_filter('the_excerpt', array($this, 'addWidget'));
79
- } else {
80
- add_filter('get_the_excerpt', array($this, 'addExcerptCode'));
81
- }
82
- self::$postTitlesAndUrlsById = array();
83
- }
84
-
85
- /**
86
- * Prepends a 3-letter non-printing code to a raw excerpt string.
87
- * The order of the code identifies a type of post (archive, category, etc).
88
- *
89
- * A piece of javascript later queries for this code, and inserts
90
- * sharetoolbox and recommendedbox divs on either side of the excerpt.
91
- *
92
- * @param string $content Excerpt contents
93
- *
94
- * @return string
95
- */
96
- public function addExcerptCode($content)
97
- {
98
- if(!is_feed()) {
99
- self::$postTitlesAndUrlsById[] = array(
100
- 'id' => get_the_ID(),
101
- 'title' => get_the_title(),
102
- 'url' => get_permalink(),
103
- 'content' => $content
104
- );
105
-
106
- if(preg_match('/[\+\-\*]{3}/', $content) == false) {
107
- //Homepage = + - *
108
- if (is_home() || is_front_page()) {
109
- return '+' . '-' . '*' . $content;
110
- //Page = + * -
111
- } else if (is_page()) {
112
- return '+' . '*' . '-' . $content;
113
- //Single Post = - * +
114
- } else if (is_single()) {
115
- return '-' . '*' . '+' . $content;
116
- //Category = - + *
117
- } else if (is_category()) {
118
- return '-' . '+' . '*' . $content;
119
- //Archive = * + -
120
- } else if (is_archive()) {
121
- return '*' . '+' . '-' . $content;
122
- }
123
- }
124
  }
125
- return $content;
126
- }
127
-
128
- public static function getPostTitlesAndUrls()
129
- {
130
- return self::$postTitlesAndUrlsById;
131
  }
132
 
133
  /**
@@ -145,45 +74,45 @@ class Addthis_ToolBox
145
  $at_flag = get_post_meta( $postid, '_at_widget', TRUE );
146
  if (is_home() || is_front_page()) {
147
  if($at_flag == '' || $at_flag == '1'){
148
- $content = self::_buildDiv(self::AT_ABOVE_POST_HOME) .
149
- self::_buildDiv(self::AT_CONTENT_ABOVE_POST_HOME) .
150
  $content;
151
  $content .= self::_buildDiv(self::AT_BELOW_POST_HOME);
152
  $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_HOME);
153
  }
154
  } else if (is_page()) {
155
  if($at_flag == '' || $at_flag == '1'){
156
- $content = self::_buildDiv(self::AT_ABOVE_POST_PAGE) .
157
- self::_buildDiv(self::AT_CONTENT_ABOVE_POST_PAGE) .
158
  $content;
159
  $content .= self::_buildDiv(self::AT_BELOW_POST_PAGE);
160
  $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_PAGE);
161
  }
162
  } else if (is_single()) {
163
  if($at_flag == '' || $at_flag == '1'){
164
- $content = self::_buildDiv(self::AT_ABOVE_POST) .
165
- self::_buildDiv(self::AT_CONTENT_ABOVE_POST, false) .
166
  $content;
167
  $content .= self::_buildDiv(self::AT_BELOW_POST);
168
  $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST, false);
169
  }
170
  } else if (is_category()) {
171
  if($at_flag == '' || $at_flag == '1'){
172
- $content = self::_buildDiv(self::AT_ABOVE_POST_CAT_PAGE) .
173
- self::_buildDiv(self::AT_CONTENT_ABOVE_CAT_PAGE) .
174
  $content;
175
  $content .= self::_buildDiv(self::AT_BELOW_POST_CAT_PAGE);
176
  $content .= self::_buildDiv(self::AT_CONTENT_BELOW_CAT_PAGE);
177
  }
178
  } else if (is_archive()) {
179
  if($at_flag == '' || $at_flag == '1'){
180
- $content = self::_buildDiv(self::AT_ABOVE_POST_ARCH_PAGE) .
181
- self::_buildDiv(self::AT_CONTENT_ABOVE_ARCH_PAGE) .
182
  $content;
183
  $content .= self::_buildDiv(self::AT_BELOW_POST_ARCH_PAGE);
184
  $content .= self::_buildDiv(self::AT_CONTENT_BELOW_ARCH_PAGE);
185
  }
186
- }
187
  }
188
 
189
  return $content;
@@ -201,11 +130,11 @@ class Addthis_ToolBox
201
  $title = get_the_title();
202
  $url = get_permalink();
203
  if($inline_data == true){
204
- return "<div class='".$class." addthis-toolbox at-wordpress-hide'".
205
  " data-title='".$title."' data-url='".$url."'>".
206
  "</div>";
207
  } else {
208
- return "<div class='".$class." addthis-toolbox at-wordpress-hide'></div>";
209
  }
210
  }
211
 
@@ -221,7 +150,7 @@ class Addthis_ToolBox
221
  $url .= '&dp=' . Addthis_Wordpress::getDomain();
222
 
223
  curl_setopt($curl, CURLOPT_URL, $url);
224
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
225
 
226
  $response = curl_exec($curl);
227
 
1
  <?php
2
  /**
3
  * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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 |
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
 
22
  define('AT_API_URL', 'http://adt00:8080/live/red_lojson');
23
 
24
  /**
25
  * Class for output addthis tool box
 
 
 
 
 
 
 
26
  */
27
  class Addthis_ToolBox
28
  {
36
  const AT_ABOVE_POST_CAT_PAGE = "at-above-post-cat-page";
37
  const AT_BELOW_POST_CAT_PAGE = "at-below-post-cat-page";
38
  const AT_ABOVE_POST_ARCH_PAGE = "at-above-post-arch-page";
39
+ const AT_BELOW_POST_ARCH_PAGE = "at-below-post-arch-page";
40
  const AT_CONTENT_BELOW_POST_HOME = "at-below-post-homepage-recommended";
41
  const AT_CONTENT_BELOW_POST_PAGE = "at-below-post-page-recommended";
42
  const AT_CONTENT_BELOW_POST = "at-below-post-recommended";
43
  const AT_CONTENT_BELOW_CAT_PAGE = "at-below-post-cat-page-recommended";
44
+ const AT_CONTENT_BELOW_ARCH_PAGE = "at-below-post-arch-page-recommended";
45
  const AT_CONTENT_ABOVE_POST_HOME = "at-above-post-homepage-recommended";
46
  const AT_CONTENT_ABOVE_POST_PAGE = "at-above-post-page-recommended";
47
  const AT_CONTENT_ABOVE_POST = "at-above-post-recommended";
48
  const AT_CONTENT_ABOVE_CAT_PAGE = "at-above-post-cat-page-recommended";
49
  const AT_CONTENT_ABOVE_ARCH_PAGE = "at-above-post-arch-page-recommended";
50
 
 
 
 
 
51
  /**
52
  * Initializes the widget class.
53
  * */
56
  add_filter('the_content', array($this, 'addWidget'));
57
  if ( has_excerpt()) {
58
  add_filter('the_excerpt', array($this, 'addWidget'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
 
 
 
 
 
 
60
  }
61
 
62
  /**
74
  $at_flag = get_post_meta( $postid, '_at_widget', TRUE );
75
  if (is_home() || is_front_page()) {
76
  if($at_flag == '' || $at_flag == '1'){
77
+ $content = self::_buildDiv(self::AT_ABOVE_POST_HOME) .
78
+ self::_buildDiv(self::AT_CONTENT_ABOVE_POST_HOME) .
79
  $content;
80
  $content .= self::_buildDiv(self::AT_BELOW_POST_HOME);
81
  $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST_HOME);
82
  }
83
  } else if (is_page()) {
84
  if($at_flag == '' || $at_flag == '1'){
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
  }
91
  } else if (is_single()) {
92
  if($at_flag == '' || $at_flag == '1'){
93
+ $content = self::_buildDiv(self::AT_ABOVE_POST) .
94
+ self::_buildDiv(self::AT_CONTENT_ABOVE_POST, false) .
95
  $content;
96
  $content .= self::_buildDiv(self::AT_BELOW_POST);
97
  $content .= self::_buildDiv(self::AT_CONTENT_BELOW_POST, false);
98
  }
99
  } else if (is_category()) {
100
  if($at_flag == '' || $at_flag == '1'){
101
+ $content = self::_buildDiv(self::AT_ABOVE_POST_CAT_PAGE) .
102
+ self::_buildDiv(self::AT_CONTENT_ABOVE_CAT_PAGE) .
103
  $content;
104
  $content .= self::_buildDiv(self::AT_BELOW_POST_CAT_PAGE);
105
  $content .= self::_buildDiv(self::AT_CONTENT_BELOW_CAT_PAGE);
106
  }
107
  } else if (is_archive()) {
108
  if($at_flag == '' || $at_flag == '1'){
109
+ $content = self::_buildDiv(self::AT_ABOVE_POST_ARCH_PAGE) .
110
+ self::_buildDiv(self::AT_CONTENT_ABOVE_ARCH_PAGE) .
111
  $content;
112
  $content .= self::_buildDiv(self::AT_BELOW_POST_ARCH_PAGE);
113
  $content .= self::_buildDiv(self::AT_CONTENT_BELOW_ARCH_PAGE);
114
  }
115
+ }
116
  }
117
 
118
  return $content;
130
  $title = get_the_title();
131
  $url = get_permalink();
132
  if($inline_data == true){
133
+ return "<div class='".$class." addthis_default_style addthis-toolbox at-wordpress-hide'".
134
  " data-title='".$title."' data-url='".$url."'>".
135
  "</div>";
136
  } else {
137
+ return "<div class='".$class." addthis_default_style addthis-toolbox at-wordpress-hide'></div>";
138
  }
139
  }
140
 
150
  $url .= '&dp=' . Addthis_Wordpress::getDomain();
151
 
152
  curl_setopt($curl, CURLOPT_URL, $url);
153
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
154
 
155
  $response = curl_exec($curl);
156
 
addthis-widget.php CHANGED
@@ -1,7 +1,7 @@
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 |
@@ -17,32 +17,13 @@
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
  *
@@ -56,11 +37,11 @@ class Addthis_Horizontal_Recommended_Content_Widget extends WP_Widget
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
  }
@@ -120,7 +101,7 @@ class Addthis_Horizontal_Recommended_Content_Widget extends WP_Widget
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;
@@ -142,10 +123,10 @@ 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()
@@ -156,11 +137,11 @@ class Addthis_Vertical_Recommended_Content_Widget extends WP_Widget
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
  }
@@ -170,7 +151,7 @@ class Addthis_Vertical_Recommended_Content_Widget extends WP_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)
@@ -190,7 +171,7 @@ class Addthis_Vertical_Recommended_Content_Widget extends WP_Widget
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)
@@ -220,7 +201,7 @@ class Addthis_Vertical_Recommended_Content_Widget extends WP_Widget
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;
@@ -230,7 +211,7 @@ class Addthis_Vertical_Recommended_Content_Widget extends WP_Widget
230
 
231
  /**
232
  * Register widgets
233
- *
234
  * @return null
235
  */
236
  function register_addthis_widget()
1
  <?php
2
  /**
3
  * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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 |
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
 
 
 
 
 
 
 
 
 
 
 
22
  class Addthis_Horizontal_Recommended_Content_Widget extends WP_Widget
23
  {
24
 
25
  const HORIZONTAL_RECOMMENDED_CONTENT = "addthis_recommended_horizontal";
26
+
27
  /**
28
  * Register widget with WordPress.
29
  *
37
  'Addthis Horizontal Recommended Content',
38
  'hor_recomended_widget_domain'
39
  ), // Name
40
+ array( 'description' =>
41
  __(
42
+ 'An Addthis Widget to add horizontal recommended content',
43
  'hor_recomended_widget_domain'
44
+ )
45
  ) // Args
46
  );
47
  }
101
  */
102
  public function update($new_instance, $old_instance)
103
  {
104
+ $new_instance['title'] = (! empty($new_instance['title'])) ?
105
  mysql_real_escape_string($new_instance['title'])
106
  : '';
107
  return $new_instance;
123
  {
124
 
125
  const VERTICAL_RECOMMENDED_CONTENT = "addthis_recommended_vertical";
126
+
127
  /**
128
  * Register widget with WordPress.
129
+ *
130
  * @return null
131
  */
132
  function __construct()
137
  'Addthis Vertical Recommended Content',
138
  'vertical_recomended_widget_domain'
139
  ), // Name
140
+ array( 'description' =>
141
  __(
142
+ 'An Addthis Widget to add vertical recommended content',
143
  'vertical_recomended_widget_domain'
144
+ )
145
  ) // Args
146
  );
147
  }
151
  *
152
  * @param array $args Widget arguments.
153
  * @param array $instance Saved values from database.
154
+ *
155
  * @return null
156
  */
157
  public function widget($args, $instance)
171
  * Back-end widget form.
172
  *
173
  * @param array $instance Previously saved values from database.
174
+ *
175
  * @return null
176
  */
177
  public function form($instance)
201
  */
202
  public function update($new_instance, $old_instance)
203
  {
204
+ $new_instance['title'] = (! empty($new_instance['title'])) ?
205
  mysql_real_escape_string($new_instance['title'])
206
  : '';
207
  return $new_instance;
211
 
212
  /**
213
  * Register widgets
214
+ *
215
  * @return null
216
  */
217
  function register_addthis_widget()
addthis_post_metabox.php CHANGED
@@ -1,4 +1,24 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class addthis_post_metabox{
3
 
4
  function admin_init()
@@ -9,7 +29,7 @@ class addthis_post_metabox{
9
  add_meta_box('addthis', 'AddThis', array($this, 'post_metabox'), $screen, 'side', 'default' );
10
  }
11
  add_action('save_post', array($this, 'save_post') );
12
-
13
  add_filter('default_hidden_meta_boxes', array($this, 'default_hidden_meta_boxes' ) );
14
  }
15
 
@@ -40,10 +60,10 @@ class addthis_post_metabox{
40
  function save_post($post_id)
41
  {
42
  global $post;
43
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
44
  return;
45
 
46
- if ( ! isset($_POST['addthis_postmetabox_nonce'] ) || !wp_verify_nonce( $_POST['addthis_postmetabox_nonce'], 'addthis_postmetabox_nonce' ) )
47
  return;
48
 
49
  if ( ! isset($_POST['addthis_show_option']) )
@@ -60,7 +80,7 @@ class addthis_post_metabox{
60
  }
61
  else
62
  {
63
- update_post_meta($post_id, 'addthis_exclude', 'true' , $custom_fields['addthis_exclude'][0] );
64
  }
65
  }
66
 
1
  <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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
+
22
  class addthis_post_metabox{
23
 
24
  function admin_init()
29
  add_meta_box('addthis', 'AddThis', array($this, 'post_metabox'), $screen, 'side', 'default' );
30
  }
31
  add_action('save_post', array($this, 'save_post') );
32
+
33
  add_filter('default_hidden_meta_boxes', array($this, 'default_hidden_meta_boxes' ) );
34
  }
35
 
60
  function save_post($post_id)
61
  {
62
  global $post;
63
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
64
  return;
65
 
66
+ if ( ! isset($_POST['addthis_postmetabox_nonce'] ) || !wp_verify_nonce( $_POST['addthis_postmetabox_nonce'], 'addthis_postmetabox_nonce' ) )
67
  return;
68
 
69
  if ( ! isset($_POST['addthis_show_option']) )
80
  }
81
  else
82
  {
83
+ update_post_meta($post_id, 'addthis_exclude', 'true' , $custom_fields['addthis_exclude'][0] );
84
  }
85
  }
86
 
addthis_settings_functions.php CHANGED
@@ -1,8 +1,27 @@
1
  <?php
2
  /**
3
- * Get the list of styles
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  */
5
 
 
 
 
6
  function _get_style_options()
7
  {
8
  global $addthis_new_styles;
@@ -15,7 +34,7 @@ function _get_style_options()
15
  */
16
  function addthis_kses($string, $customstyles)
17
  {
18
- global $allowedposttags;
19
  $mytags = $allowedposttags;
20
  $mytags['a'][ 'gplusonesize' ] = array();
21
  $mytags['a'][ 'gplusonecount' ]= array();
@@ -44,7 +63,7 @@ function addthis_kses($string, $customstyles)
44
  $mytags['a'][ 'pipiniturl' ]= array();
45
  $mytags['a'][ 'pipinitmedia' ]= array();
46
  $mytags['a'][ 'pipinitdescription' ]= array();
47
-
48
  $pretags = array( 'g:plusone:', 'fb:like:', 'tw:', 'pi:pinit:', 'fb:share:layout', 'fb:like:locale');
49
  $posttags = array('gplusone', 'fblike', 'tw', 'pipinit', 'fbsharelayout', 'fblikelocale');
50
 
@@ -58,47 +77,47 @@ function addthis_kses($string, $customstyles)
58
  $post_pattern[] = '/[^_]'.$attr.'/';
59
  $posttags[$i] = ' '.$attr;
60
  }
61
-
62
  $temp_string = preg_replace( $pre_pattern, $posttags, $string);
63
  if (strpos($temp_string, "twscreen_name") != false) {
64
- $temp_string = str_replace('twscreen_name', 'twscreenname', $temp_string);
65
  }
66
  if (strpos($temp_string, "fblikeshow_faces") != false) {
67
- $temp_string = str_replace('fblikeshow_faces', 'fblikeshowfaces', $temp_string);
68
  }
69
-
70
  $new_temp_string = wp_kses($temp_string, $mytags);
71
-
72
  // Add in our %s so that the url and title get added properly
73
- if (!preg_match('/(<img[^>]+>)/i', $string, $matches)) {
74
  $new_string = preg_replace( $post_pattern, $pretags, $new_temp_string);
75
  $new_string = substr_replace($new_string, $customstyles, 4, 0);
76
  }
77
  else {
78
- $new_string = substr_replace($new_temp_string, $customstyles, 4, 0);
79
  }
80
-
81
- if (strpos($new_string, "tw:screenname") != false) {
82
- $new_string = str_replace('tw:screenname', 'tw:screen_name', $new_string);
83
  }
84
- if (strpos($new_string, "fb:like:showfaces") != false) {
85
- $new_string = str_replace('fb:like:showfaces', 'fb:like:show_faces', $new_string);
86
  }
87
-
88
  return $new_string;
89
  }
 
90
  /**
91
- * Add this version notification message
92
  * @param int $atversion_update_status
93
  * @param int $atversion
94
  */
95
  function _addthis_version_notification($atversion_update_status, $atversion)
96
  {
97
- //Fresh install Scenario. ie., atversion = 300 without reverting back.
98
  if($atversion_update_status == ADDTHIS_ATVERSION_AUTO_UPDATE && $atversion >= ADDTHIS_ATVERSION) {
99
  return;
100
  }
101
- $imgLocationBase = apply_filters( 'addthis_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
102
  ob_start();
103
  // In the automatic update by the system the $atversion_update_status is 0
104
  // On subsequent update using notification link the $atversion_update_status = -1
@@ -117,20 +136,20 @@ function _addthis_version_notification($atversion_update_status, $atversion)
117
  <div class="addthis-notification addthis-warning-message">
118
  <div style="float:left">Update AddThis to activate new features that will make sharing even easier.</div>
119
  <div style="float:right">
120
- <a href="#" class="addthis-update-atversion"><img src="<?php echo $imgLocationBase . 'update.png';?>" /></a>
121
  </div>
122
- </div>
123
  <?php
124
  }
125
  $notification_content = ob_get_contents();
126
  ob_end_clean();
127
  return $notification_content;
128
  }
 
129
  /**
130
  * Swap the order of occurrence of two keys in an associative array
131
  * @param type $array
132
- * @param type $key1
133
- * @param type $key2
134
  */
135
  function _addthis_swap_first_two_elements (&$array, $key)
136
  {
@@ -138,18 +157,20 @@ function _addthis_swap_first_two_elements (&$array, $key)
138
  unset($array[$key]);
139
  $array = $temp + $array;
140
  }
 
141
  /**
142
  * The icon choser row. Should be made to look a bit prettier
143
  */
144
  function _addthis_choose_icons($name, $options)
145
  {
146
- $addthis_new_styles = _get_style_options();
147
- global $addthis_default_options;
148
- extract($options);
149
- if ($name == 'above')
150
- {
 
151
  _addthis_swap_first_two_elements($addthis_new_styles, 'large_toolbox');
152
- $legend = 'Top';
153
  $option = $above;
154
  $custom_size = $above_custom_size;
155
  $do_custom_services = ( isset( $above_do_custom_services ) && $above_do_custom_services ) ? 'checked="checked"' : '';
@@ -158,10 +179,8 @@ function _addthis_swap_first_two_elements (&$array, $key)
158
  $custom_preferred = $above_custom_preferred;
159
  $custom_more = $above_custom_more;
160
  $custom_string = $above_custom_string;
161
- }
162
- else
163
- {
164
- $legend = 'Bottom';
165
  $option = $below;
166
  $custom_size = $below_custom_size;
167
  $do_custom_services = ( isset( $below_do_custom_services ) && $below_do_custom_services ) ? 'checked="checked"' : '';
@@ -170,51 +189,74 @@ function _addthis_swap_first_two_elements (&$array, $key)
170
  $custom_preferred = $below_custom_preferred;
171
  $custom_more = $below_custom_more;
172
  $custom_string = $below_custom_string;
173
- }
174
- ?>
 
 
175
  <tr>
176
  <td id="<?php echo $name ?>" colspan="2">
177
- <fieldset>
178
- <legend>&nbsp;<strong><?php _e("$legend Sharing Tool", 'addthis_trans_domain') ?></strong> &nbsp;</legend>
179
- <div style="float: left; width: 395px;">
180
- <?php
181
-
182
- $imgLocationBase = apply_filters( 'at_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
183
- $imgLocationBase = apply_filters( 'addthis_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
184
-
185
  foreach ($addthis_new_styles as $k => $v)
186
  {
187
  $checked = '';
188
  if ($option == $k || ($option == 'none' && $k == $addthis_default_options[$name] ) ){
189
  $checked = 'checked="checked"';
190
  }
191
- if ($checked === '' && isset($v['defaultHide']) && $v['defaultHide'] == true)
192
  continue;
193
- echo "<div class='$name"."_option select_row'><span class='radio'><input $checked type='radio' value='".$k."' id='{$k}_{$name}' name='addthis_settings[$name]' /></span><label for='{$k}_{$name}'> <img alt='".$k."' src='". $imgLocationBase . $v['img'] ."' align='left' /></label><div class='clear'></div></div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  }
195
- $ischecked = '';
196
- if ($option == 'disable' ){
197
- $ischecked = 'checked="checked"';
198
- }
199
- echo "<div class='$name"."_option select_row'><span class='radio'><input type='radio' $ischecked value='disable' id='disable_{$name}' name='addthis_settings[$name]' /></span><label for='disable_{$name}'>Do not show a sharing tool at the <strong>$legend</strong> of posts</label></div>";
200
-
201
- $checked = '';
202
  if ($option == 'custom_string' || $option == 'none' && 'custom_strin' == $addthis_default_options[$name] )
203
  {
204
  $checked = 'checked="checked"';
205
  }
206
 
207
- echo "<div class='$name"."_option select_row'><span class='radio mt4'><input $checked type='radio' value='custom_string' name='addthis_settings[$name]' id='$name"."_custom_string' /></span> <label for='{$name}_custom_string'>Custom button</label><div class='clear'></div></div>";
208
- _e( sprintf("<div style='max-width: 555px;margin-left:20px' class='%s_custom_string_input'> This text box allows you to enter any AddThis markup that you wish. To see examples of what you can do, visit <a href='https://www.addthis.com/get/sharing'>AddThis.com Sharing Tools</a> and select any sharing tool. You can also check out our <a href='http://support.addthis.com/customer/portal/articles/381263-addthis-client-api#rendering-decoration'>Client API</a>. For any help you may need, please visit <a href='http://support.addthis.com'>AddThis Support</a></div>", $name ),'addthis_trans_domain');
209
- echo "<textarea style='max-width:555px;margin-left:20px' rows='5' cols='100' name='addthis_settings[$name"."_custom_string]' class='$name"."_custom_string_input' />".esc_textarea($custom_string)."</textarea>";
210
-
 
 
 
 
 
 
 
 
 
 
 
 
211
  $class = 'hidden';
212
  $checked = '';
213
  if ($option == 'custom' || ($option == 'none' && 'custom' == $addthis_default_options[$name] ) ) {
214
  $checked = 'checked="checked"';
215
  $class = '';
216
 
217
- echo "<div class='$name"."_option select_row $class mt20'><span class='radio mt4'><input $checked type='radio' value='custom' name='addthis_settings[$name]' id='$name"."_custom_button' /></span> Build your own<div class='clear'></div></div>";
218
 
219
  echo "<ul class='$name"."_option_custom hidden'>";
220
  $custom_16 = ($custom_size == 16) ? 'selected="selected"' : '' ;
@@ -234,72 +276,277 @@ function _addthis_swap_first_two_elements (&$array, $key)
234
  }
235
  echo "</select><br/><span class='description'>Enter the number of automatically user-personalized items you want displayed</span></li>";
236
  $custom_more = ( $custom_more ) ? 'checked="checked"' : '';
237
-
238
  echo "<li><input $custom_more type='checkbox' class='at_do_custom' name='addthis_settings[$name"."_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic logo that offers sharing to over 330 destinations</span></li>";
239
  echo "</ul></div>";
240
-
241
  }
242
  echo '</div>';
243
  ?>
244
- </div>
245
- <div class="<?php echo $name;?>_button_set select_row" style="float: left; width: 480px;">
246
- <div id="<?php echo $name;?>_custom_btns">
247
- <?php //if ($name == "above") { ?>
248
- <span class="<?php echo $name;?>-smart-sharing-container">
249
- <p id="customizedMessage" class="mb40 personalizedMessage customize-message-section customize-your-buttons" style="display:none;">
250
- Your buttons are currently customized. <a href="#" class="<?php echo $name;?>-customize-sharing-link customize-your-buttons">Show customization.</a>
251
- </p>
252
- <p id="personalizedMessage" class="mb40 personalizedMessage customize-message-section customize-your-buttons">
253
- AddThis boosts sharing by automatically showing the right buttons to each user based on their location and activity across the web. <a href="#" class="<?php echo $name;?>-customize-sharing-link customize-your-buttons">Disable and select your own buttons.</a>
254
- </p>
255
- <p class="mb40 smart-sharing-link customize-message-section">Your buttons are currently customized. <a href="#" class="<?php echo $name;?>-customize-sharing-link smart-sharing-link">Let AddThis choose instead and boost sharing</a>
256
- <span class="row-right" data-content="Smartest sharing buttons on the web. Automated to show each user the services that they use most based on their location and activity across the web." data-original-title="Smart Sharing."> (<a href="#">?</a>)</span>
257
- </p>
258
- <span class="smart-sharing-inner-container">
259
- <p class="hide">
260
- <label>
261
- <input type="radio" checked="checked" name="<?php echo $name;?>-sharing" id="<?php echo $name;?>-enable-smart-sharing" value="<?php echo $name;?>-enable-smart-sharing"/> Use Smart Buttons <strong>(Recommended)</strong>
262
- </label>
263
- <label>
264
- <input type="radio" name="<?php echo $name;?>-sharing" id="<?php echo $name;?>-disable-smart-sharing"> Customize your buttons
265
- </label>
266
- </p>
267
- <div class="customize-buttons">
268
- <div class="sharing-buttons">
269
- <h4 class="sortable-heading">Button Options</h4>
270
- <input type="text" class="sharing-buttons-search" placeholder="Find a service" maxlength="20" size="30" style="width: 230px; height: 41px; margin: 0;">
271
- <ul class="sortable"></ul>
272
- </div>
273
- <div class="selected-services">
274
- <h4 class="sortable-heading">Selected Buttons</h4>
275
- <ul class="sortable" data-type="addthisButtons"></ul>
276
- </div>
277
- </div>
278
- <div class="vertical-drag">
279
- <i class="icon-arrow-up"></i>
280
- <i class="icon-arrow-down"></i>
281
- <p>Drag up or down to reorder services</p>
282
- </div>
283
- <div class="horizontal-drag">
284
- <i class="icon-arrow-right"></i>
285
- <p>Drag across to add service</p>
286
- </div>
287
- <a href="#" class="restore-default-options" style="float: left; padding-left: 100px;">Restore default options</a>
288
- <?php $list = $name.'_chosen_list'; ?>
289
- <input type="hidden" id="<?php echo $name?>-chosen-list" name="addthis_settings[<?php echo $name;?>_chosen_list]" value="<?php echo $options[$list];?>"/>
290
- </span>
291
- </span>
292
- <script type="text/javascript">
293
- window.page = 'sharing-buttons';
294
- //$('.follow-tooltip').popover({ trigger: "hover" });
295
- </script>
296
- <!-- <div id="atcode"></div> -->
297
- <?php //} ?>
298
- </div>
299
- </div>
300
- </fieldset>
301
  </td>
302
  </tr>
303
-
304
  <?php
305
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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
 
22
+ /**
23
+ * Get the list of styles
24
+ */
25
  function _get_style_options()
26
  {
27
  global $addthis_new_styles;
34
  */
35
  function addthis_kses($string, $customstyles)
36
  {
37
+ global $allowedposttags;
38
  $mytags = $allowedposttags;
39
  $mytags['a'][ 'gplusonesize' ] = array();
40
  $mytags['a'][ 'gplusonecount' ]= array();
63
  $mytags['a'][ 'pipiniturl' ]= array();
64
  $mytags['a'][ 'pipinitmedia' ]= array();
65
  $mytags['a'][ 'pipinitdescription' ]= array();
66
+
67
  $pretags = array( 'g:plusone:', 'fb:like:', 'tw:', 'pi:pinit:', 'fb:share:layout', 'fb:like:locale');
68
  $posttags = array('gplusone', 'fblike', 'tw', 'pipinit', 'fbsharelayout', 'fblikelocale');
69
 
77
  $post_pattern[] = '/[^_]'.$attr.'/';
78
  $posttags[$i] = ' '.$attr;
79
  }
80
+
81
  $temp_string = preg_replace( $pre_pattern, $posttags, $string);
82
  if (strpos($temp_string, "twscreen_name") != false) {
83
+ $temp_string = str_replace('twscreen_name', 'twscreenname', $temp_string);
84
  }
85
  if (strpos($temp_string, "fblikeshow_faces") != false) {
86
+ $temp_string = str_replace('fblikeshow_faces', 'fblikeshowfaces', $temp_string);
87
  }
88
+
89
  $new_temp_string = wp_kses($temp_string, $mytags);
90
+
91
  // Add in our %s so that the url and title get added properly
92
+ if (!preg_match('/(<img[^>]+>)/i', $string, $matches)) {
93
  $new_string = preg_replace( $post_pattern, $pretags, $new_temp_string);
94
  $new_string = substr_replace($new_string, $customstyles, 4, 0);
95
  }
96
  else {
97
+ $new_string = substr_replace($new_temp_string, $customstyles, 4, 0);
98
  }
99
+
100
+ if (strpos($new_string, "tw:screenname") != false) {
101
+ $new_string = str_replace('tw:screenname', 'tw:screen_name', $new_string);
102
  }
103
+ if (strpos($new_string, "fb:like:showfaces") != false) {
104
+ $new_string = str_replace('fb:like:showfaces', 'fb:like:show_faces', $new_string);
105
  }
106
+
107
  return $new_string;
108
  }
109
+
110
  /**
111
+ * AddThis version notification message
112
  * @param int $atversion_update_status
113
  * @param int $atversion
114
  */
115
  function _addthis_version_notification($atversion_update_status, $atversion)
116
  {
117
+ //Fresh install Scenario. ie., atversion = 300 without reverting back.
118
  if($atversion_update_status == ADDTHIS_ATVERSION_AUTO_UPDATE && $atversion >= ADDTHIS_ATVERSION) {
119
  return;
120
  }
 
121
  ob_start();
122
  // In the automatic update by the system the $atversion_update_status is 0
123
  // On subsequent update using notification link the $atversion_update_status = -1
136
  <div class="addthis-notification addthis-warning-message">
137
  <div style="float:left">Update AddThis to activate new features that will make sharing even easier.</div>
138
  <div style="float:right">
139
+ <a href="#" class="addthis-update-atversion"><img src="<?php echo _addthis_image_location_base() . 'update.png';?>" /></a>
140
  </div>
141
+ </div>
142
  <?php
143
  }
144
  $notification_content = ob_get_contents();
145
  ob_end_clean();
146
  return $notification_content;
147
  }
148
+
149
  /**
150
  * Swap the order of occurrence of two keys in an associative array
151
  * @param type $array
152
+ * @param type $key
 
153
  */
154
  function _addthis_swap_first_two_elements (&$array, $key)
155
  {
157
  unset($array[$key]);
158
  $array = $temp + $array;
159
  }
160
+
161
  /**
162
  * The icon choser row. Should be made to look a bit prettier
163
  */
164
  function _addthis_choose_icons($name, $options)
165
  {
166
+ global $addThisConfigs;
167
+ $addthis_new_styles = _get_style_options();
168
+ $addthis_default_options = $addThisConfigs->getConfigs();
169
+
170
+ extract($options);
171
+ if ($name == 'above') {
172
  _addthis_swap_first_two_elements($addthis_new_styles, 'large_toolbox');
173
+ $titleAdjective = 'Above';
174
  $option = $above;
175
  $custom_size = $above_custom_size;
176
  $do_custom_services = ( isset( $above_do_custom_services ) && $above_do_custom_services ) ? 'checked="checked"' : '';
179
  $custom_preferred = $above_custom_preferred;
180
  $custom_more = $above_custom_more;
181
  $custom_string = $above_custom_string;
182
+ } else {
183
+ $titleAdjective = 'Below';
 
 
184
  $option = $below;
185
  $custom_size = $below_custom_size;
186
  $do_custom_services = ( isset( $below_do_custom_services ) && $below_do_custom_services ) ? 'checked="checked"' : '';
189
  $custom_preferred = $below_custom_preferred;
190
  $custom_more = $below_custom_more;
191
  $custom_string = $below_custom_string;
192
+ }
193
+ $titleAdjectiveLower = strtolower($titleAdjective);
194
+ ?>
195
+ <table>
196
  <tr>
197
  <td id="<?php echo $name ?>" colspan="2">
198
+ <fieldset>
199
+ <legend class="hidden">
200
+ <strong><?php _e("Sharing $titleAdjective Post", 'addthis_trans_domain') ?></strong>
201
+ </legend>
202
+ <div class="Sharing-Icons-options-container">
203
+ <p><?php _e("These buttons will appear $titleAdjectiveLower your blog posts.", 'addthis_trans_domain') ?></p>
204
+ <?php
205
+
206
  foreach ($addthis_new_styles as $k => $v)
207
  {
208
  $checked = '';
209
  if ($option == $k || ($option == 'none' && $k == $addthis_default_options[$name] ) ){
210
  $checked = 'checked="checked"';
211
  }
212
+ if ($checked === '' && isset($v['defaultHide']) && $v['defaultHide'] == true)
213
  continue;
214
+ echo "
215
+ <div class='$name"."_option select_row'>
216
+ <span class='radio'>
217
+ <input
218
+ $checked
219
+ type='radio'
220
+ value='".$k."'
221
+ id='{$k}_{$name}'
222
+ name='addthis_settings[$name]'
223
+ />
224
+ </span>
225
+ <label for='{$k}_{$name}'>
226
+ <img alt='".$k."' src='". _addthis_image_location_base() . $v['img'] ."' />
227
+ </label>
228
+ </div>";
229
  }
230
+
231
+ $checked = '';
 
 
 
 
 
232
  if ($option == 'custom_string' || $option == 'none' && 'custom_strin' == $addthis_default_options[$name] )
233
  {
234
  $checked = 'checked="checked"';
235
  }
236
 
237
+ echo "
238
+ <div class='$name"."_option select_row'>
239
+ <span class='radio mt4'>
240
+ <input
241
+ $checked
242
+ type='radio'
243
+ value='custom_string'
244
+ name='addthis_settings[$name]'
245
+ id='$name"."_custom_string'
246
+ />
247
+ </span>
248
+ <label for='{$name}_custom_string'>Advanced API button configuration</label>
249
+ </div>";
250
+ _e( sprintf("<div style='max-width: 555px;margin-left:20px' class='%s_custom_string_input'> This text box allows you to enter any AddThis markup that you wish. To see examples of what you can do, visit <a href='https://www.addthis.com/get/sharing'>AddThis.com Sharing Tools</a> and select any sharing tool. You can also check out our <a href='http://support.addthis.com/customer/portal/articles/1365467-preferred-services-personalization'>Client API</a>. For any help you may need, please visit <a href='http://support.addthis.com'>AddThis Support</a></div>", $name ),'addthis_trans_domain');
251
+ echo "<textarea style='max-width:555px;margin-left:20px' rows='5' cols='100' name='addthis_settings[$name"."_custom_string]' class='$name"."_custom_string_input' />".esc_textarea($custom_string)."</textarea>";
252
+
253
  $class = 'hidden';
254
  $checked = '';
255
  if ($option == 'custom' || ($option == 'none' && 'custom' == $addthis_default_options[$name] ) ) {
256
  $checked = 'checked="checked"';
257
  $class = '';
258
 
259
+ echo "<div class='$name"."_option select_row $class mt20'><span class='radio mt4'><input $checked type='radio' value='custom' name='addthis_settings[$name]' id='$name"."_custom_button' /></span> Build your own</div>";
260
 
261
  echo "<ul class='$name"."_option_custom hidden'>";
262
  $custom_16 = ($custom_size == 16) ? 'selected="selected"' : '' ;
276
  }
277
  echo "</select><br/><span class='description'>Enter the number of automatically user-personalized items you want displayed</span></li>";
278
  $custom_more = ( $custom_more ) ? 'checked="checked"' : '';
279
+
280
  echo "<li><input $custom_more type='checkbox' class='at_do_custom' name='addthis_settings[$name"."_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic logo that offers sharing to over 330 destinations</span></li>";
281
  echo "</ul></div>";
282
+
283
  }
284
  echo '</div>';
285
  ?>
286
+ </div>
287
+ <?php
288
+ _addthis_print_services_picker($name, $options);
289
+ ?>
290
+
291
+ </fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  </td>
293
  </tr>
294
+ </table>
295
  <?php
296
  }
297
+
298
+ /**
299
+ * Prints the header and list of checkboxes of templates on which AddThis
300
+ * buttons can be seen.
301
+ * @param string $type 'above', 'below', 'sidebar'
302
+ * @return bool true on success, false on failure
303
+ */
304
+ function _addthis_print_template_checkboxes($type) {
305
+ global $addThisConfigs;
306
+ global $cmsConnector;
307
+
308
+ $types = $cmsConnector->getSharingButtonLocations();
309
+ if (!in_array($type, $types)) {
310
+ return false;
311
+ }
312
+ $addthis_options = $addThisConfigs->getConfigs();
313
+
314
+ $template_checkboxes_config = $addThisConfigs->getFieldsForContentTypeSharingLocations(
315
+ null,
316
+ $type
317
+ );
318
+
319
+ ?>
320
+ <h4>Templates</h4>
321
+ <p>These are the page templates on which your buttons will appear.</p>
322
+
323
+ <ul>
324
+ <?php
325
+ foreach ($template_checkboxes_config as $checkbox) {
326
+ $fieldName = $checkbox['fieldName'];
327
+ $displayName = $checkbox['displayName'];
328
+ $explanation = $checkbox['explanation'];
329
+
330
+ $checked = '';
331
+ if ($addthis_options[$fieldName]) {
332
+ $checked = 'checked="checked"';
333
+ }
334
+
335
+ $listItemStart = "<li>\n";
336
+ $listItemStart .= "<input
337
+ type=\"checkbox\"
338
+ id=\"$fieldName\"
339
+ name=\"addthis_settings[$fieldName]\"
340
+ value=\"true\" $checked />\n";
341
+ $listItemStart .= "<label for=\"$fieldName\">";
342
+
343
+ $listItemEnd = "</label>\n";
344
+ $listItemEnd .= "<span class=\"at-wp-tooltip\" tooltip=\"$explanation\">&quest;</span>\n";
345
+ $listItemEnd .= "</li>\n";
346
+
347
+ echo $listItemStart;
348
+ _e($displayName, 'addthis_trans_domain');
349
+ echo $listItemEnd;
350
+ }
351
+ ?>
352
+ </ul>
353
+ <?php
354
+ return true;
355
+ }
356
+
357
+ function _addthis_print_services_picker($name, $options) {
358
+
359
+
360
+ ?>
361
+
362
+ <div class="<?php echo $name;?>_button_set select_row Sharing-Icons-options-container">
363
+ <div id="<?php echo $name;?>_custom_btns">
364
+ <span class="<?php echo $name;?>-smart-sharing-container">
365
+ <span class="smart-sharing-inner-container">
366
+
367
+ <h4>Services:</h4>
368
+ <p>AddThis boosts sharing by automatically showing the right buttons to
369
+ each user based on their location and activity across the web.</p>
370
+ <div class="above_option select_row">
371
+ <span class="radio mt4">
372
+ <input type="radio" checked="checked" name="addthis_settings[<?php echo $name;?>_sharing]" id="<?php echo $name;?>-enable-smart-sharing" value="<?php echo $name;?>-enable-smart-sharing"/> <strong>Auto Personalization</strong><span> (recommended)</span>
373
+ </span>
374
+ </div>
375
+ <div class="above_option select_row">
376
+ <span class="radio mt4">
377
+ <input type="radio" name="addthis_settings[<?php echo $name;?>_sharing]" id="<?php echo $name;?>-disable-smart-sharing" <?php $sharing_key = $name.'_sharing';echo ( $options[$sharing_key] == $name."-disable-smart-sharing" ? 'checked="checked"' : ''); ?> value="<?php echo $name;?>-disable-smart-sharing"> <strong>Select Your Own</strong>
378
+ </span>
379
+ </div>
380
+
381
+ <div class="customize-buttons">
382
+ <div class="sharing-buttons">
383
+ <h4 class="sortable-heading">Button Options</h4>
384
+ <input type="text" class="sharing-buttons-search" placeholder="Find a service" maxlength="20" size="30" style="width: 230px; height: 41px; margin: 0;">
385
+ <ul class="sortable"></ul>
386
+ </div>
387
+ <div class="selected-services">
388
+ <h4 class="sortable-heading">Selected Buttons</h4>
389
+ <ul class="sortable" data-type="addthisButtons"></ul>
390
+ </div>
391
+ </div>
392
+ <a href="#" class="restore-default-options" style="float: left; padding-left: 100px;">Restore default options</a>
393
+ <div class="vertical-drag">
394
+ <p>Drag up or down to reorder services</p>
395
+ </div>
396
+ <div class="horizontal-drag">
397
+ <p>Drag across to add service</p>
398
+ </div>
399
+ <?php $list = $name.'_chosen_list'; ?>
400
+ <input type="hidden" id="<?php echo $name?>-chosen-list" name="addthis_settings[<?php echo $name;?>_chosen_list]" value="<?php echo $options[$list];?>"/>
401
+ </span>
402
+ </span>
403
+ <script type="text/javascript">
404
+ window.page = 'sharing-buttons';
405
+ </script>
406
+ </div>
407
+ </div>
408
+
409
+
410
+ <?php
411
+ return true;
412
+ }
413
+
414
+ /**
415
+ * Returns an array of template options
416
+ * @return string[] an array of strings
417
+ */
418
+ function _addthis_deprecated_fields() {
419
+ $deletedFields = array(
420
+ 'addthis_bitly_login',
421
+ 'addthis_bitly_key',
422
+ 'addthis_copytracking1',
423
+ 'addthis_copytracking2',
424
+ 'addthis_copytrackingremove',
425
+ 'addthis_for_wordpress',
426
+ 'addthis_nag_username_ignore',
427
+ 'addthis_options',
428
+ 'addthis_password',
429
+ 'addthis_show_stats',
430
+ 'addthis_show_stats',
431
+ 'addthis_showonarchives',
432
+ 'addthis_showoncats',
433
+ 'addthis_showonhome',
434
+ 'addthis_showonpages',
435
+ 'addthis_showonposts',
436
+ 'addthis_sidebar_only',
437
+ 'addthis_username',
438
+ 'options',
439
+ 'password',
440
+ 'profile',
441
+ 'username',
442
+ );
443
+
444
+ return $deletedFields;
445
+ }
446
+
447
+ /**
448
+ * Returns an array of template options
449
+ * @return string[] an array of strings
450
+ */
451
+ function _addthis_determine_template_type() {
452
+ global $post;
453
+
454
+ // determine page type
455
+ if (is_home() || is_front_page()) {
456
+ $type = 'home';
457
+ } elseif (is_archive()) {
458
+ $type = 'archives';
459
+ if (is_category()) {
460
+ $type = 'categories';
461
+ }
462
+ } elseif (is_page($post->ID)) {
463
+ $type = 'pages';
464
+ } elseif (is_single()) {
465
+ $type = 'posts';
466
+ } else {
467
+ $type = false;
468
+ }
469
+
470
+ return $type;
471
+ }
472
+
473
+ /**
474
+ * determines if the above buttons are enabled for exceprts
475
+ * @return boolean true if enabled, false is disabled
476
+ */
477
+ function _addthis_excerpt_buttons_enabled_above() {
478
+ global $addThisConfigs;
479
+ $options = $addThisConfigs->getConfigs();
480
+ $enabled = (boolean)(isset($options['addthis_above_showon_excerpts']) && $options['addthis_above_showon_excerpts']);
481
+ return $enabled;
482
+ }
483
+
484
+ /**
485
+ * determines if the below buttons are enabled for exceprts
486
+ * @return boolean true if enabled, false is disabled
487
+ */
488
+ function _addthis_excerpt_buttons_enabled_below() {
489
+ global $addThisConfigs;
490
+ $options = $addThisConfigs->getConfigs();
491
+ $enabled = (boolean)(isset($options['addthis_below_showon_excerpts']) && $options['addthis_below_showon_excerpts']);
492
+ return $enabled;
493
+ }
494
+
495
+ /**
496
+ * determines if the above or below buttons are enabled for exceprts
497
+ * @return boolean true if enabled, false is disabled
498
+ */
499
+ function _addthis_excerpt_buttons_enabled() {
500
+ $addthis_above_showon_excerpts = _addthis_excerpt_buttons_enabled_above();
501
+ $addthis_below_showon_excerpts = _addthis_excerpt_buttons_enabled_below();
502
+ $enabled = (boolean)($addthis_above_showon_excerpts || $addthis_below_showon_excerpts);
503
+ return $enabled;
504
+ }
505
+
506
+ /**
507
+ * the folder name for the AddThis plugin - OMG why is this hard coded?!?
508
+ * @return string
509
+ */
510
+ function _addthis_plugin_folder(){
511
+ return 'addthis';
512
+ }
513
+
514
+ /**
515
+ * gives you the base URL for our plugin
516
+ * @return string
517
+ */
518
+ function _addthis_plugin_base_url(){
519
+ $url = apply_filters(
520
+ 'addthis_files_uri',
521
+ plugins_url('' , basename(dirname(__FILE__)))
522
+ );
523
+ $url .= '/' . _addthis_plugin_folder();
524
+ return $url;
525
+ }
526
+
527
+ /**
528
+ * gives you the base URL for our plugin's images
529
+ * @return string
530
+ */
531
+ function _addthis_image_location_base(){
532
+ $url = _addthis_plugin_base_url() . '/img/';
533
+ return $url;
534
+ }
535
+
536
+ /**
537
+ * gives you the base URL for our plugin's JavaScript
538
+ * @return string
539
+ */
540
+ function _addthis_js_location_base(){
541
+ $url = _addthis_plugin_base_url() . '/js/';
542
+ return $url;
543
+ }
544
+
545
+ /**
546
+ * gives you the base URL for our plugin's JavaScript
547
+ * @return string
548
+ */
549
+ function _addthis_css_location_base(){
550
+ $url = _addthis_plugin_base_url() . '/css/';
551
+ return $url;
552
+ }
addthis_sidebar_widget.php CHANGED
@@ -1,9 +1,27 @@
1
  <?php
2
- /**
3
- * Add this Widget that allows you to pick your poison, add a widget title, and share your content
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  */
5
 
6
-
 
 
7
  class AddThisSidebarWidget extends WP_Widget {
8
 
9
 
@@ -19,8 +37,8 @@ class AddThisSidebarWidget extends WP_Widget {
19
  $control_ops = array( 'width' => 325);
20
 
21
  /* Create the widget. */
22
- $this->WP_Widget( 'addthis-widget', 'AddThis Share', $widget_ops, $control_ops );
23
-
24
  }
25
 
26
  /**
@@ -30,16 +48,16 @@ class AddThisSidebarWidget extends WP_Widget {
30
  {
31
  extract ( $args );
32
  $addthis_new_styles = _get_style_options();
33
-
34
 
35
  $title = apply_filters('widget_title', $instance['title']);
36
-
37
  echo $before_widget;
38
  if ($title)
39
  echo $before_title . $title . $after_title;
40
-
41
  printf(apply_filters('addthis_sidebar_style_output', $addthis_new_styles[$instance['style']]['src']), '');
42
-
43
  echo $after_widget;
44
  }
45
 
@@ -52,12 +70,12 @@ class AddThisSidebarWidget extends WP_Widget {
52
 
53
  $instance = $old_instance;
54
  $instance['title'] = strip_tags($new_instance['title']);
55
-
56
  if (isset($addthis_new_styles[ $new_instance['style'] ] ) )
57
  $instance['style'] = strip_tags($new_instance['style']);
58
 
59
 
60
-
61
 
62
  return $instance;
63
 
@@ -68,30 +86,57 @@ class AddThisSidebarWidget extends WP_Widget {
68
  */
69
  function form($instance)
70
  {
71
- if (empty($instance))
72
- {
73
  $instance = array('style'=> '' , 'title' => '');
74
  }
75
 
76
- $style = (empty( $instance['style'] ) ) ? addthis_style_default : esc_attr($instance['style']);
77
- $title = (empty( $instance['title'] ) ) ? '' : esc_attr($instance['title']);
78
-
79
 
80
- global $addthis_new_styles;
81
 
82
  ?>
83
- <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
84
-
85
- <p><label for="<?php echo $this->get_field_id('style');?>"><?php _e('Style:', 'addthis'); ?><br /></label></p>
86
- <?php foreach ($addthis_new_styles as $k => $v)
87
- {
88
-
89
- $checked = '';
90
- if ($k === $style)
91
- $checked = 'checked="checked"';
92
-
93
- echo '<div style="height:auto;"><input '.$checked.' style="margin:5px 5px 0 0;" type="radio" name="' . $this->get_field_name('style') . '" value="'.$k.'"><img align="middle" style="padding:5px 0" src="'. plugins_url( '/addthis/img/' . $v['img'], basename(dirname(__FILE__)) ) .'" /></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  ?>
96
  <?php
97
  }
1
  <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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
 
22
+ /**
23
+ * AddThis Widget that allows you to pick your poison, add a widget title, and share your content
24
+ */
25
  class AddThisSidebarWidget extends WP_Widget {
26
 
27
 
37
  $control_ops = array( 'width' => 325);
38
 
39
  /* Create the widget. */
40
+ $this->WP_Widget( 'addthis-widget', 'AddThis Sharing Buttons', $widget_ops, $control_ops );
41
+
42
  }
43
 
44
  /**
48
  {
49
  extract ( $args );
50
  $addthis_new_styles = _get_style_options();
51
+
52
 
53
  $title = apply_filters('widget_title', $instance['title']);
54
+
55
  echo $before_widget;
56
  if ($title)
57
  echo $before_title . $title . $after_title;
58
+
59
  printf(apply_filters('addthis_sidebar_style_output', $addthis_new_styles[$instance['style']]['src']), '');
60
+
61
  echo $after_widget;
62
  }
63
 
70
 
71
  $instance = $old_instance;
72
  $instance['title'] = strip_tags($new_instance['title']);
73
+
74
  if (isset($addthis_new_styles[ $new_instance['style'] ] ) )
75
  $instance['style'] = strip_tags($new_instance['style']);
76
 
77
 
78
+
79
 
80
  return $instance;
81
 
86
  */
87
  function form($instance)
88
  {
89
+ if (empty($instance)) {
 
90
  $instance = array('style'=> '' , 'title' => '');
91
  }
92
 
93
+ $style = (empty($instance['style'])) ? addthis_style_default : esc_attr($instance['style']);
94
+ $title = (empty($instance['title'])) ? '' : esc_attr($instance['title']);
 
95
 
96
+ global $addthis_new_styles;
97
 
98
  ?>
99
+ <p>
100
+ <label for="<?php echo $this->get_field_id('title'); ?>">
101
+ <?php _e('Title:'); ?>
102
+ <input
103
+ class="widefat"
104
+ id="<?php echo $this->get_field_id('title'); ?>"
105
+ name="<?php echo $this->get_field_name('title'); ?>"
106
+ type="text"
107
+ value="<?php echo $title; ?>"
108
+ />
109
+ </label>
110
+ </p>
111
+
112
+ <p>
113
+ <label for="<?php echo $this->get_field_id('style');?>">
114
+ <?php _e('Style:', 'addthis'); ?>
115
+ <br />
116
+ </label>
117
+ </p>
118
+ <?php
119
+ foreach ($addthis_new_styles as $k => $v) {
120
+ $checked = '';
121
+ if ($k === $style) {
122
+ $checked = 'checked="checked"';
123
  }
124
+
125
+ echo '
126
+ <div style="height:auto;">
127
+ <input '.$checked.'
128
+ style="margin:5px 5px 0 0;"
129
+ type="radio"
130
+ name="' . $this->get_field_name('style') . '"
131
+ value="'.$k.'"
132
+ />
133
+ <img
134
+ align="middle"
135
+ style="padding:5px 0"
136
+ src="'. _addthis_image_location_base . $v['img'] .'"
137
+ />
138
+ </div>';
139
+ }
140
  ?>
141
  <?php
142
  }
addthis_social_widget.php CHANGED
@@ -1,59 +1,51 @@
1
  <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4: */
3
- /*
4
- * +--------------------------------------------------------------------------+
5
- * | Copyright (c) 2008-2012 Add This, LLC |
6
- * +--------------------------------------------------------------------------+
7
- * | This program is free software; you can redistribute it and/or modify |
8
- * | it under the terms of the GNU General Public License as published by |
9
- * | the Free Software Foundation; either version 2 of the License, or |
10
- * | (at your option) any later version. |
11
- * | |
12
- * | This program is distributed in the hope that it will be useful, |
13
- * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
- * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
- * | GNU General Public License for more details. |
16
- * | |
17
- * | You should have received a copy of the GNU General Public License |
18
- * | along with this program; if not, write to the Free Software |
19
- * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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.7
27
- *
28
- * Author: The AddThis Team
29
- * Author URI: http://www.addthis.com/blog
30
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.7');
36
- define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-4.0.7');
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*
@@ -69,7 +61,7 @@ function pluginActivationNotice()
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' .
@@ -77,6 +69,7 @@ function pluginActivationNotice()
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
  }
@@ -87,2441 +80,2661 @@ function pluginActivationNotice()
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.
136
- add_action('init', 'addthis_early', 0);
137
- function addthis_early(){
138
- global $addthis_addjs;
139
- if (! isset($addthis_addjs)){
140
- require('includes/addthis_addjs.php');
141
- $addthis_options = get_option('addthis_settings');
142
- $addthis_addjs = new AddThis_addjs($addthis_options);
 
143
  }
144
- }
145
 
146
- $addthis_settings = array();
147
- $addthis_settings['isdropdown'] = 'true';
148
- $addthis_settings['customization'] = '';
149
- $addthis_settings['menu_type'] = 'dropdown';
150
- $addthis_settings['language'] = 'en';
151
- $addthis_settings['username'] = '';
152
- $addthis_settings['fallback_username'] = '';
153
- $addthis_settings['style'] = 'share';
154
- $addthis_settings['atversion'] = ADDTHIS_ATVERSION;
155
- $addthis_settings['placement'] = ENABLE_ADDITIONAL_PLACEMENT_OPTION;
156
-
157
- $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');
158
-
159
- $addthis_menu_types = array('static', 'dropdown', 'toolbox');
160
-
161
- $addthis_styles = array(
162
- 'share' => array('img'=>'lg-share-%lang%.gif', 'w'=>125, 'h'=>16),
163
- 'bookmark' => array('img'=>'lg-bookmark-en.gif', 'w'=>125, 'h'=>16),
164
- 'addthis' => array('img'=>'lg-addthis-en.gif', 'w'=>125, 'h'=>16),
165
- 'share-small' => array('img'=>'sm-share-%lang%.gif', 'w'=>83, 'h'=>16),
166
- 'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
167
- 'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
168
- );
169
-
170
- $addthis_options = get_option('addthis_settings');
171
- $atversion = is_array($addthis_options) && array_key_exists('atversion_reverted', $addthis_options) && $addthis_options['atversion_reverted'] == 1 ? $addthis_options['atversion'] : ADDTHIS_ATVERSION;
172
-
173
- $addthis_new_styles = array(
174
-
175
- 'fb_tw_p1_sc' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %1$s ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_pinterest_pinit"></a><a class="addthis_counter addthis_pill_style"></a></div>' , 'img' => 'horizontal_share_rect.png' , 'name' => 'Like, Tweet, +1, Share', 'above' => '', 'below' => ''
176
- ), // facebook tweet plus 1 share counter
177
- 'large_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_32x32_style" %1$s ><a class="addthis_button_facebook"></a><a class="addthis_button_twitter"></a><a class="addthis_button_email"></a><a class="addthis_button_pinterest_share"></a><a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style"></a></div>', 'img' => 'toolbox-large.png', 'name' => 'Large Toolbox', 'above' => 'hidden ', 'below' => 'hidden'
178
- ), // 32x32
179
- 'small_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_" %1$s ><a class="addthis_button_facebook"></a><a class="addthis_button_twitter"></a><a class="addthis_button_email"></a><a class="addthis_button_pinterest_share"></a><a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style"></a></div>', 'img' => 'toolbox-small.png', 'name' => 'Small Toolbox', 'above' => 'hidden ', 'below' => ''
180
- ), // 32x32
181
- 'plus_one_share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style" %1$s ><a class="addthis_button_google_plusone" g:plusone:size="medium" ></a><a class="addthis_counter addthis_pill_style"></a></div>', 'img' => 'plusone-share.gif', 'name' => 'Plus One and Share Counter', 'above'=> 'hidden', 'below'=>'hidden' , 'defaultHide' => true
182
- ), // +1
183
- 'small_toolbox_with_share' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %1$s ><a href="//addthis.com/bookmark.php?v='.$atversion.'&amp;username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>', 'img' => 'small-toolbox.jpg', 'name' => 'Small Toolbox with Share first', 'above' => '', 'below' => 'hidden' , 'defaultHide' => true
184
- ), // Plus sign share | four buttons
185
- 'fb_tw_sc' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %1$s ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>' , 'img' => 'fb-tw-sc.jpg' , 'name' => 'Like, Tweet, Counter', 'above' => 'hidden', 'below' => 'hidden', 'defaultHide' => true
186
- ), // facebook tweet share counter
187
- 'simple_button' => array('src' => '<div class="addthis_toolbox addthis_default_style " %1$s><a href="//addthis.com/bookmark.php?v='.$atversion.'&amp;username=xa-4d2b47f81ddfbdce" class="addthis_button_compact">Share</a></div>', 'img' => 'share.jpg', 'name' => 'Share Button', 'above' => 'hidden ', 'below' => 'hidden', 'defaultHide' => true
188
- ), // Plus sign share
189
- 'button' => array( 'src' => '<div><a class="addthis_button" href="//addthis.com/bookmark.php?v='.$atversion.'" %1$s><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>', 'img' => 'horizontal_share.png', 'name' => 'Classic Share Button', 'above' => 'hidden ', 'below' => 'hidden'
190
- ), // classic
191
- 'share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %1$s ><a class="addthis_counter"></a></div>', 'img' => 'share_counter.png', 'name' => 'Share Counter', 'above' => 'hidden ', 'below' => 'hidden' , 'defaultHide' => true
192
- ),
193
- );
194
-
195
-
196
- //add_filter('the_title', 'at_title_check');
197
- /**
198
- * @deprecated
199
- * @todo Add _deprecated_function notice.
200
- */
201
- function at_title_check($title)
202
- {
203
-
204
- global $addthis_did_filters_added;
205
-
206
- if (!isset ($addthis_did_filters_added) || $addthis_did_filters_added != true)
207
- {
208
- addthis_add_content_filters();
209
- add_filter('the_content', 'addthis_script_to_content');
210
- }
211
- else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  {
213
- }
214
 
215
- return $title;
216
- }
217
 
 
 
 
 
 
 
 
 
218
 
219
- /**
220
- * @deprecated
221
- * @todo Add _deprecated_function notice.
222
- */
223
- function addthis_script_to_content($content)
224
- {
225
- global $addthis_did_script_output;
226
 
227
- if (!isset($addthis_did_script_output) )
 
 
 
 
228
  {
229
- $addthis_did_script_output = true;
230
- $content .= addthis_output_script(true);
 
 
 
 
 
 
231
  }
232
- return $content ;
233
- }
234
 
235
 
236
- add_filter('language_attributes', 'addthis_language_attributes');
237
- function addthis_language_attributes($input)
238
- {
239
- return $input . ' xmlns:fb="http://ogp.me/ns/fb#" xmlns:addthis="http://www.addthis.com/help/api-spec" ';
240
- }
241
 
242
 
243
- /**
244
- * Converts our old many options in to one beautiful array
245
- *
246
- */
247
 
248
- // Caution: Using this filter to disable upgrades may have unexpected consequences.
249
- if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
250
- {
251
- function addthis_options_200()
252
  {
253
-
254
- global $current_user;
255
- $user_id = $current_user->ID;
256
- $addthis_new_options = array();
257
- if ($username = get_option('addthis_username'))
258
- $addthis_new_options['username'] = $username;
259
-
260
- if ($password = get_option('addthis_password'))
261
- $addthis_new_options['password'] = $password;
262
-
263
- if ($show_stats = get_option('addthis_show_stats'))
264
- $addthis_new_options['addthis_show_stats'] = $show_stats;
265
-
266
- if ($asynchronous_loading = get_option('addthis_asynchronous_loading'))
267
- $addthis_new_options['addthis_asynchronous_loading'] = $asynchronous_loading;
268
-
269
- if ($append_data = get_option('addthis_append_data'))
270
- $addthis_new_options['addthis_append_data'] = $append_data;
271
-
272
- if ($showonhome = get_option('addthis_showonhome'))
273
- $addthis_new_options['addthis_showonhome'] = $showonhome;
274
-
275
- if ($showonpages = get_option('addthis_showonpages'))
276
- $addthis_new_options['addthis_showonpages'] = $showonpages;
277
-
278
- if ($showoncats = get_option('addthis_showoncats'))
279
- $addthis_new_options['addthis_showoncats'] = $showoncats;
280
-
281
- if ($showonarchives = get_option('addthis_showonarchives'))
282
- $addthis_new_options['addthis_showonarchives'] = $showonarchives;
283
-
284
- if ($aftertitle = get_option('addthis_aftertitle'))
285
- $addthis_new_options['addthis_aftertitle'] = $aftertitle;
286
-
287
- if ($beforecomments = get_option('addthis_beforecomments'))
288
- $addthis_new_options['addthis_beforecomments'] = $beforecomments;
289
-
290
-
291
- if (get_option('addthis_showonposts') != true)
292
- $addthis_new_options['below'] = 'none';
293
- elseif (get_option('addthis_sidebar_only') == true)
294
  $addthis_new_options['below'] = 'none';
295
- else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  {
297
- if ( ($menu_type = get_option('addthis_menu_type')) == 'toolbox' )
298
- $addthis_new_options['below'] = 'small_toolbox_with_share';
299
- else
300
- $addthis_new_options['below'] = 'button';
301
- }
302
- if ($header_background = get_option('addthis_header_background'))
303
- $addthis_new_options['addthis_header_background'] = $header_background;
304
- if ($header_color = get_option('addthis_header_color'))
305
- $addthis_new_options['addthis_header_color'] = $header_color;
306
- if ($brand = get_option('addthis_brand'))
307
- $addthis_new_options['addthis_brand'] = $brand;
308
- if ($language = get_option('addthis_language'))
309
- $addthis_new_options['addthis_language'] = $language;
310
-
311
- //version check
312
- if ($atversion = get_option('atversion'))
313
- $addthis_new_options['atversion'] = $atversion;
314
-
315
-
316
- // Above is new, set it to none
317
- $addthis_new_options['above'] = 'none';
318
-
319
- // Save option
320
- add_option('addthis_settings', $addthis_new_options);
321
-
322
- // if the option saved, delete the old options
323
-
324
- delete_option('addthis_show_stats');
325
- delete_option('addthis_asynchronous_loading');
326
- delete_option('addthis_password');
327
- delete_option('addthis_fallback_username');
328
- delete_option('addthis_options');
329
- delete_option('addthis_product');
330
- delete_option('addthis_isdropdown');
331
- delete_option('addthis_menu_type');
332
- delete_option('addthis_append_data');
333
- delete_option('addthis_showonhome');
334
- delete_option('addthis_showonposts');
335
- delete_option('addthis_showonpages');
336
- delete_option('addthis_showoncats');
337
- delete_option('addthis_showonarchives');
338
- delete_option('addthis_aftertitle');
339
- delete_option('addthis_beforecomments');
340
- delete_option('addthis_style');
341
- delete_option('addthis_header_background');
342
- delete_option('addthis_header_color');
343
- delete_option('addthis_sidebar_only');
344
- delete_option('addthis_brand');
345
- delete_option('addthis_language');
346
- delete_option('atversion');
347
-
348
 
349
- global $current_user;
350
- $user_id = $current_user->ID;
351
 
352
- add_user_meta($user_id, 'addthis_nag_updated_options', 'true', true);
 
 
353
  }
354
 
355
- function addthis_options_210()
356
- {
357
- $options = get_option('addthis_settings');
358
- if ( isset( $options['username'] ) )
359
- $options['profile'] = $options['username'];
360
 
361
- update_option( 'addthis_settings', $options);
362
  }
363
 
364
- function addthis_options_240()
365
- {
366
- $options = get_option('addthis_settings');
367
 
368
- // Add An option for the AT Version
369
- $options['atversion'] = ADDTHIS_ATVERSION;
370
-
371
- //$options['wpfooter'] = false;
372
- update_option( 'addthis_settings', $options);
373
  }
374
- }
375
 
376
- function addthis_add_for_check_footer() {
377
 
378
- }
 
 
 
 
 
 
 
 
379
 
380
- function addthis_check_footer() {
381
 
382
- }
 
 
 
 
 
383
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
 
385
- /**
386
- * Generates unique IDs
387
- */
388
- function cuid()
389
- {
390
- $base = get_option('home');
391
- $cuid = hash_hmac('md5', $base, 'addthis');
392
- return $cuid;
393
- }
394
 
395
- define('ADDTHIS_FALLBACK_USERNAME', 'wp-'.cuid() );
 
396
 
397
- /**
398
- * Returns major.minor WordPress version.
399
- */
400
- function addthis_get_wp_version() {
401
- return (float)substr(get_bloginfo('version'),0,3);
402
- }
403
 
404
- /**
405
- * For templates, we need a wrapper for printing out the code on demand.
406
- */
407
- function addthis_print_widget($url = null, $title = null, $style = addthis_style_default) {
408
- global $addthis_styles, $addthis_new_styles;
409
- $styles = array_merge($addthis_styles, $addthis_new_styles);
410
-
411
- if (isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings'))
412
- $preview = true;
413
- else
414
- $options = get_option('addthis_settings');
415
-
416
- $identifier = addthis_get_identifier($url, $title);
417
-
418
- echo "\n<!-- AddThis Custom -->\n";
419
- if (!is_array($style) && isset($addthis_new_styles[$style])) {
420
- echo sprintf($addthis_new_styles[$style]['src'], $identifier);
421
- } elseif ($style == 'above') {
422
- $above = addthis_display_widget_above($styles, $url, $title, $options);
423
- echo sprintf($above, $identifier);
424
- } elseif ($style == 'below') {
425
- $below = addthis_display_widget_below($styles, $url, $title, $options);
426
- echo sprintf($below, $identifier);
427
- } elseif (is_array($style))
428
- echo addthis_custom_toolbox($style, $url, $title);
429
- echo "\n<!-- End AddThis Custom -->\n";
430
- }
431
 
432
- /*
433
- * Generates the addthis:url and addthis:title attributes
434
- */
435
 
436
- function addthis_get_identifier($url = null, $title = null)
437
- {
 
 
 
 
 
 
 
 
 
 
 
438
 
439
- if (! is_null($url) )
440
- $identifier = "addthis:url='$url' ";
441
- if (! is_null($title) )
442
- $identifier .= "addthis:title='$title'";
443
-
444
- if (! isset($identifier) )
445
- $identifier = '';
446
 
447
- return $identifier;
 
448
 
449
- }
 
450
 
451
- /**
452
- * Options is an array that contains
453
- * size - either 16 or 32. Defaults to 16
454
- * services - comma sepperated list of services
455
- * preferred - number of Prefered services to be displayed after listed services
456
- * more - bool to show or not show the more icon at the end
457
- *
458
- * @param $options array
459
- */
460
-
461
- function addthis_custom_toolbox($options, $url, $title)
462
- {
463
- $identifier = addthis_get_identifier($url, $title);
464
-
465
- $outerClasses = 'addthis_toolbox addthis_default_style';
466
-
467
- if (isset($options['size']) && $options['size'] == '32')
468
- $outerClasses .= ' addthis_32x32_style';
469
-
470
- if (isset($options['type']) && $options['type'] != 'custom_string') {
471
- $button = '<div class="'.$outerClasses.'" '.$identifier.' >';
472
-
473
- if (isset($options['addthis_options']) && $options['addthis_options'] != "") {
474
- $addthis_options = split(',', $options['addthis_options']);
475
- foreach ($addthis_options as $option) {
476
- $option = trim($option);
477
- if ($option != 'more') {
478
- $button .= '<a class="addthis_button_'.$option.'"></a>';
479
- }
480
- }
481
- }
482
- else if (isset($options['services']) ) {
483
- $services = explode(',', $options['services']);
484
- foreach ($services as $service)
485
- {
486
- $service = trim($service);
487
- if ($service == 'more' || $service == 'compact') {
488
- if (isset($options['type']) && $options['type'] != 'fb_tw_p1_sc') {
489
- $button .= '<a class="addthis_button_compact"></a>';
490
  }
491
- }
492
- else if ($service == 'counter') {
493
- if (isset($options['type']) && $options['type'] == 'fb_tw_p1_sc') {
494
- $button .= '<a class="addthis_counter addthis_pill_style"></a>';
 
 
 
495
  }
496
- else {
497
- $button .= '<a class="addthis_counter addthis_bubble_style"></a>';
498
  }
 
 
499
  }
500
- else if ($service == 'google_plusone') {
501
- $button .= '<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>';
502
- }
503
- else
504
- $button .= '<a class="addthis_button_'.strtolower($service).'"></a>';
505
  }
506
- }
507
-
508
- if (isset($options['preferred']) && is_numeric($options['preferred']))
509
- {
510
- for ($a = 1; $a <= $options['preferred']; $a++)
511
  {
512
- $button .= '<a class="addthis_button_preferred_'.$a.'"></a>';
 
 
 
513
  }
514
- }
515
 
516
- if (isset($options['more']) && $options['more'] == true)
517
- {
518
- $button .= '<a class="addthis_button_compact"></a>';
519
- }
520
-
521
- if (isset($options['counter']) && ($options['counter'] != "") && ($options['counter'] !== false))
522
- {
523
- if ($options['counter'] === true)
524
- { //no style was specified
525
- $button .= '<a class="addthis_counter"></a>';
526
  }
527
- else
528
- { //a specific style was specified such as pill_style or bubble_style
529
- $button .= '<a class="addthis_counter addthis_'.$options['counter'].'"></a>';
 
 
 
 
 
 
 
 
530
  }
 
 
531
  }
532
-
533
- $button .= '</div>';
534
  }
535
 
536
- return $button;
 
 
 
 
 
537
 
538
- }
 
 
 
 
 
539
 
 
540
 
541
- /**
542
- * Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
543
- */
544
- function addthis_print_style() {
545
- wp_enqueue_style( 'addthis' );
546
- }
547
 
548
- /**
549
- * Adds AddThis script to page. Only used for admin dashboard in WP 2.7 and higher.
550
- */
551
- function addthis_print_script() {
552
- wp_enqueue_script( 'addthis' );
553
- }
554
 
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');
589
- echo "</p></div>";
590
  }
591
- }
592
- add_action('admin_init', 'addthis_nag_ignore');
593
 
594
- function addthis_nag_ignore()
595
- {
596
- global $current_user;
597
- $user_id = $current_user->ID;
598
-
599
- $options = get_option('addthis_settings');
600
 
601
- if (isset($_GET['addthis_nag_ignore']) && '0' == $_GET['addthis_nag_ignore'])
602
- add_user_meta($user_id, 'addthis_ignore_notices', 'true', true);
603
- if (isset($_GET['addthis_nag_username_ignore']) && '0' == $_GET['addthis_nag_username_ignore'])
604
- add_user_meta($user_id, 'addthis_nag_username_ignore', 'true', true);
605
- if (isset($_GET['addthis_nag_updated_ignore']) && '0' == $_GET['addthis_nag_updated_ignore'])
606
- delete_user_meta($user_id, 'addthis_nag_updated_options', 'true');
607
 
608
 
609
- }
610
 
611
- function addthis_plugin_useragent($userAgent)
612
- {
613
- return $userAgent . 'ATV/' . ADDTHIS_PLUGIN_VERSION;
614
- }
 
615
 
 
 
616
 
617
- add_action('wp_ajax_at_show_dashboard_widget', 'addthis_render_dashboard_widget');
618
- /**
619
- * Our admin dashboard widget shows yesterday's top shared content and top shared-to services.
620
- * Data is fetched via AJAX. We assume jQuery is available on any WP install supporting
621
- * dashboard widgets.
622
- *
623
- * @see js/addthis.js
624
- * @see js/addthis.css
625
- */
626
- function addthis_render_dashboard_widget() {
627
- if( current_user_can('manage_options') || apply_filters('addthis_show_dashboard', __return_false() ) )
628
- {
629
- // we're good
630
- }
631
- else
632
- {
633
- _e( 'Cheatin&#8217; uh?' );
634
- exit;
635
- }
636
- $_services = array(
637
- 'netvibes' => 'Netvibes',
638
- 'google' => 'Google Reader',
639
- 'yahoo' => 'Yahoo',
640
- 'rojo' => 'Rojo',
641
- 'aol' => 'AOL',
642
- 'newsgator-on' => 'Newsgator Online',
643
- 'pluck-on' => 'Pluck Online',
644
- 'bloglines' => 'Bloglines',
645
- 'feedlounge' => 'Feedlounge',
646
- 'newsburst' => 'Newsburst',
647
- 'msn' => 'MSN',
648
- 'winlive' => 'Windows Live',
649
- 'technorati' => 'Technorati',
650
- 'pageflakes' => 'Pageflakes',
651
- 'newsalloy' => 'News Alloy',
652
- 'feedreader' => 'FeedReader',
653
- 'mymsn' => 'My MSN',
654
- 'newsisfree' => 'Newsisfree',
655
- 'feeddemon' => 'FeedDemon',
656
- 'netnewswire' => 'NetNewWire',
657
- 'pluck' => 'Pluck',
658
- 'newsgator' => 'NewsGator',
659
- 'sharpreader' => 'SharpReader',
660
- 'awasu' => 'Awasu',
661
- 'myearthlink' => 'myEarthLink',
662
- 'rss' => 'Direct Feed Link',
663
- 'googlebuzz' => 'Google Buzz',
664
- 'youtube' => 'YouTube',
665
- 'facebook' => 'Facebook',
666
- 'flickr' => 'Flickr',
667
- 'twitter' => 'Twitter',
668
- 'linkedin' => 'LinkedIn'
669
- );
670
-
671
-
672
- global $addthis_settings;
673
- $options = get_option('addthis_settings');
674
- if (isset($options['username']))
675
- $username = urlencode($options['username']);
676
- else
677
- {
678
- echo 'No Username entered';
679
- return false;
680
  }
681
- if (isset($options['password']))
682
- $password = urlencode($options['password']);
683
- else
684
- {
685
- echo 'No Password entered';
686
- return false;
687
- }
688
-
689
- $domain = str_ireplace('www.', '', parse_url(get_home_url(), PHP_URL_HOST));
690
-
691
- if (isset($options['profile']))
692
- $profile = '&pubid='.urlencode($options['profile']);
693
- else
694
- $profile = '';
695
-
696
-
697
- $requests = array(
698
- array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
699
- array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'week'),
700
- array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'month'),
701
- array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
702
- array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'week'),
703
- array('metric' => 'clickbacks', 'dimension' => '', 'domain' => $domain, 'period' => 'month'),
704
- array('metric' => 'shares', 'dimension' => 'service' , 'domain' => $domain, 'period' => 'month'),
705
- array('metric' => 'clickbacks', 'dimension' => 'service', 'domain' => $domain, 'period' => 'month'),
706
- array('metric' => 'shares', 'dimension' => 'url' , 'domain' => $domain, 'period' => 'month'),
707
- array('metric' => 'clickbacks', 'dimension' => 'url', 'domain' => $domain, 'period' => 'month'),
708
- );
709
-
710
- if (! $stats = get_transient('addthis_dashboard_stats') )
711
- {
712
- add_filter('http_headers_useragent', 'addthis_plugin_useragent');
713
- foreach ($requests as $request)
714
- {
715
- $dimension = $metric = $domain = $period = '';
716
- extract($request);
717
- $dimension = ($dimension != '') ? '/'.$dimension : '';
718
- $url = 'https://api.addthis.com/analytics/1.0/pub/' . $metric . $dimension . '.json?'.
719
- 'domain='.$domain.'&period='.$period.
720
- '&username='.$username.
721
- '&password='.$password.
722
- $profile.'&origin=wordpress_plugin';
723
- $stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
724
-
725
- if ( is_wp_error( $stats[$metric.$dimension.$period] ) )
726
- {
727
- echo "There was an error retrieving your stats from the AddThis servers. Please wait and try again in a few moments.\n";
728
- if (defined(WP_DEBUG) && WP_DEBUG == TRUE)
729
- echo "Error Code:" . $stats[$metric.$dimension.$period]->get_error_code();
730
-
731
- exit;
732
- }
733
-
734
- else if ($stats[$metric.$dimension.$period]['response']['code'] == 401 )
735
- {
736
- echo "The username, password, and profile combination you entered is invalid.<br />";
737
- echo "Please confirm that you have correctly entered your AddThis username, password and profile ID.";
738
- exit;
739
- }
740
- else if ( $stats[$metric.$dimension.$period]['response']['code'] == 500)
741
- {
742
- echo "Something has gone terribly wrong! This should never happen, but somehow did. We are working to correct it right now. We will get everything up again soon.";
743
- exit;
744
- }
745
 
746
- else if ($stats[$metric.$dimension.$period]['response']['code'] == 501 )
747
- {
748
- echo "There was an error retrieving your analytics. If you wait a momeent and try again, you should be all set.";
749
- exit;
750
- }
751
- else if ($stats[$metric.$dimension.$period]['response']['code'] != 201 )
752
- {
 
 
 
 
 
 
753
  }
 
 
754
  }
755
 
756
- if ( $stats['sharesday']['response']['code'] == 200)
757
- set_transient('addthis_dashboard_stats', $stats, '600');
758
-
759
  }
760
- if ($stats['sharesday']['response']['code'] == 200 && $stats['sharesmonth']['body'] != '[]' )
 
 
 
 
 
761
  {
762
- $shareurls = json_decode($stats['shares/urlmonth']['body']);
763
- $clickbackurls = json_decode($stats['clickbacks/urlmonth']['body']);
764
- $yesterday['shares'] = json_decode($stats['sharesday']['body']);
765
- $yesterday['shares'] = $yesterday['shares'][0]->shares;
766
- $yesterday['clickbacks'] = json_decode($stats['clickbacksday']['body']);
767
- $yesterday['clickbacks'] = $yesterday['clickbacks'][0]->clickbacks;
768
- $yesterday['viral'] = ($yesterday['shares'] > 0 && $yesterday['clickbacks'] > 0 ) ? $yesterday['clickbacks'] / $yesterday['shares'] * 100 . '%' : 'n/a';
769
-
770
- if (! $yesterday['clickbacks'] ) $yesterday['clickbacks'] = 0;
771
- if (! $yesterday['shares'] ) $yesterday['shares'] = 0;
772
-
773
- $decodedLastWeek = json_decode($stats['sharesweek']['body']);
774
- $lastweek['shares'] = 0;
775
- foreach ($decodedLastWeek as $share)
 
 
 
 
 
776
  {
777
- $lastweek['shares'] += $share->shares;
778
  }
779
- $decodedLastWeek = json_decode($stats['clickbacksweek']['body']);
780
- $lastweek['clickbacks'] = 0;
781
- foreach ($decodedLastWeek as $clickback)
782
  {
783
- $lastweek['clickbacks'] += $clickback->clickbacks;
 
 
 
 
 
 
 
784
  }
785
- $lastweek['viral'] = ($lastweek['shares'] > 0 && $lastweek['clickbacks'] > 0 ) ? $lastweek['clickbacks'] / $lastweek['shares'] * 100 . '%' : 'n/a';
 
 
 
 
 
 
 
 
 
 
 
 
 
786
 
787
- $decodedLastMonth = json_decode($stats['sharesmonth']['body']);
788
- $lastmonth['shares'] = 0;
789
- foreach ($decodedLastMonth as $share)
 
 
 
 
790
  {
791
- $lastmonth['shares'] += $share->shares;
792
  }
793
- $decodedLastMonth = json_decode($stats['clickbacksmonth']['body']);
794
- $lastmonth['clickbacks'] = 0;
795
- foreach ($decodedLastMonth as $clickback)
796
  {
797
- $lastmonth['clickbacks'] += $clickback->clickbacks;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
798
  }
799
- $lastmonth['viral'] = ($lastmonth['shares'] > 0 && $lastmonth['clickbacks'] ) ? $lastmonth['clickbacks'] / $lastmonth['shares'] * 100 . '%' : 'n/a';
800
 
801
- $services['shares'] = json_decode($stats['shares/servicemonth']['body']);
802
- if (is_null($services['shares'])) $services['shares'] = array();
803
- $services['clickbacks'] = json_decode($stats['clickbacks/servicemonth']['body']);
804
- if (is_null($services['clickbacks'])) $services['shares'] = array();
805
 
806
- foreach (array('shares', 'clickbacks') as $type)
 
 
 
 
 
 
 
 
 
 
 
807
  {
808
- if (is_array($services[$type])) {
809
- $topServiceShare = array_shift($services[$type]);
810
- $firstLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
811
- $firstAmount = $topServiceShare->{$type};
812
- $topServiceShare = array_shift($services[$type]);
813
- $secondLabel = ( isset($_services[$topServiceShare->service])) ? $_services[$topServiceShare->service] : $topServiceShare->service;
814
- $secondAmount = $topServiceShare->{$type};
815
- $thirdLabel = 'Others';
816
- $thirdAmount = 0;
817
- if (is_array($services[$type])) {
818
- foreach($services[$type] as $service )
819
- {
820
- $thirdAmount += $service->{$type};
821
- }
822
- }
 
 
 
 
 
 
 
 
 
823
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
 
825
- $servicesCharts[$type] = '//chart.apis.google.com/chart?&chdlp=b&chs=118x145&cht=p3&chco=BA3A1C|F75C39|424242&chf=bg,s,00000000&'.
826
- 'chdl='.$firstLabel.'|'.$secondLabel.'|'.$thirdLabel.'&'.
827
- 'chd=t:'.$firstAmount.','.$secondAmount.','.$thirdAmount;
 
828
  } else {
829
- $servicesCharts[$type] = '//chart.apis.google.com/chart?&chdlp=b&chs=118x145&cht=p3&chco=BA3A1C|F75C39|424242&chf=bg,s,00000000&';
830
  }
831
- }
832
 
 
 
 
833
 
834
- echo "<div id='at_tabs'>";
835
- echo "<ul>";
836
- echo "<li class='at_time_period'><a href='#tab1'>Yesterday</a></li>";
837
- echo "<li class='at_time_period'><a href='#tab2'>Last Week</a></li>";
838
- echo "<li class='at_time_period'><a href='#tab3'>Last Month</a></li>";
839
- echo "</ul><div class='clear'>&nbsp;</div>";
840
- $tab = 0;
841
- foreach (array('yesterday', 'lastweek', 'lastmonth') as $timePeriod )
842
- {
843
- $stats = $$timePeriod;
844
- $tab++;
845
- $viral = ( $stats['viral'] != 'n/a' ) ? number_format( $stats['viral'],2) .'%' : $stats['viral'];
846
- echo '<div id="tab'.$tab.'">';
847
-
848
- echo
849
- '<table class="atw-table">
850
- <colgroup><col width="33%"/><col width="33%"/><col width="33%"/></colgroup>
851
- <tr>';
852
- echo '<td><div class="atw-cell"><h3>'. $stats['shares'].'</h3>Shares</div></td>';
853
- echo '<td><div class="atw-cell"><h3>'. $stats['clickbacks'].'</h3>Clicks</div></td>';
854
- echo '<td><div class="atw-cell"><h3>'. $viral .'</h3>Viral Lift</div></td>';
855
-
856
- echo '</tr>';
857
- echo '</table>';
858
- echo '</div>';
859
- }
860
- echo "</div>";
861
-
862
- echo "<div>";
863
- echo "</div>";
864
- echo "<div id='tstab1'>";
865
- echo "<h5> Most Shared URLs (last month) </h5>";
866
- echo "<ul>";
867
- $count = count($shareurls);
868
- for($i = 0; ( $i < 5 && $i < $count ); $i++)
869
- {
870
- $url = array_shift($shareurls);
871
- $displayUrl = str_replace( array('http://', 'https://', $domain), '',$url->url);
872
- echo "<li><span class='urlCount'>" . $url->shares . "</span><span class='urlUrl'>". urldecode($displayUrl) . "</span></li>";
873
- }
874
- echo "</ul>";
875
- echo "<h5>Top Services for shares(last month)</h5>";
876
- echo "<img src='{$servicesCharts['shares']}' width='118' height='145' alt='share stats for the last month' />";
877
- echo "</div>";
878
- echo '<div id="tstab2">';
879
- echo '<h5> Most Clicked URLs (last month) </h5>';
880
- echo "<ul>";
881
- $count = count($clickbackurls);
882
- for($i = 0; ( $i < 5 && $i < $count ); $i++)
883
- {
884
- $url = array_shift($clickbackurls);
885
- $displayUrl = str_replace( array('http://', 'https://', $domain), '',$url->url);
886
- echo "<li><span class='urlCount'>" . $url->clickbacks . "</span><span class='urlUrl'>". urldecode($displayUrl) . "</span></li>";
887
- }
888
- echo "</ul>";
889
- echo "<h5>Top Services for clicks(last month)</h5>";
890
- echo "<img src='{$servicesCharts['clickbacks']}' width='118' height='145' alt='share stats for the last month' />";
891
- echo "</div>";
892
- echo '<div class="clear">&nbsp;</div>';
893
- echo '<p><a class="button rbutton" href="//www.addthis.com/analytics/summary?domain='.$domain.'">View More Analytics</a></p>';
894
- }
895
- elseif($stats['sharesday']['response']['code'] == 200){
896
-
897
- echo
898
- <<<ENDHTML
899
- <p>We haven't recorded any sharing events in the last month for this site. This could be because you just installed addthis. If you would like to increase your sharing,</p>
900
- <p>If you want some ideas for increasing your sharing, check out:</p>
901
- <ul>
902
- <li><span class='b'><a href="//www.addthis.com//blog/">The AddThis Blog</a></span></li>
903
- <li><span class='b'><a href="//www.addthis.com//blog/2010/11/09/3-tips-for-getting-the-most-shares/">Three tips for getting the most shares</a></span></li>
904
- <li><span class='b'><a href="//www.addthis.com/forum/">The AddThis Forum</a></span></li>
905
- <ul>
906
- ENDHTML;
907
- }
908
- elseif ($stats['sharesday']['response']['code'] == 401){
909
- echo "I'm sorry, but we seemed to encounter an error. Please ensure that your password, username and pubid are correct.";
910
 
911
- }
 
912
 
913
- else{
914
- echo "I'm sorry, but we seemed to have encountered an error when requesting your analytics. Please wait a few moments and try again.";
915
- }
916
- die();
917
- }
918
 
919
- /**
920
- * Initialize the dashboard widget.
921
- */
922
- function addthis_dashboard_init() {
923
- $options = get_option('addthis_settings');
924
- if (isset($options['addthis_show_stats']) && $options['addthis_show_stats'] == true && isset($options['username']) && isset($options['password']) && ! empty($options['username']) && ! empty($options['password']) && (current_user_can('manage_options') || apply_filters('addthis_show_dashboard', __return_false() ) ) )
925
- wp_add_dashboard_widget('dashboard_addthis', 'AddThis', 'addthis_render_dashboard_widget_holder');
926
- }
927
-
928
- function addthis_render_dashboard_widget_holder()
929
- {
930
- echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
931
- }
932
 
 
 
 
933
 
934
- add_action('wp_ajax_at_save_transient', 'addthis_save_transient');
935
 
936
- function addthis_save_transient() {
937
- global $wpdb; // this is how you get access to the database
 
938
 
 
 
 
939
 
940
- parse_str($_POST['value'], $values);
 
 
 
 
 
 
 
 
 
941
 
942
- // verify nonce (or die).
943
- $nonce = $values['_wpnonce'];
944
- if (! wp_verify_nonce($nonce, 'addthis-options') ) die('Security check');
 
 
 
 
945
 
946
- // Parse Post data
947
- $option_array = addthis_parse_options($values);
948
-
949
- // Set Transient
950
- if (false !== get_transient('addthis_settings'))
951
- delete_transient('addthis_settings');
952
- $eh = set_transient('addthis_settings', $option_array, 120);
953
-
954
- print_r($option_array);
955
 
956
- die();
957
- }
 
958
 
959
- function addthis_save_settings($input)
960
- {
961
- $options_array = addthis_parse_options($input);
 
 
 
 
962
 
963
- return $options_array;
 
 
 
 
 
 
964
 
 
 
 
965
 
966
- }
 
 
967
 
 
 
 
968
 
 
 
 
969
 
970
- /**
971
- * goes through all the options, sanitizing, verifying and returning for storage what needs to be there
972
- */
973
- function addthis_parse_options($data)
974
- {
975
- require_once('addthis_settings_functions.php');
976
 
977
- global $addthis_styles, $addthis_new_styles;
 
978
 
979
- $styles = array_merge($addthis_styles, $addthis_new_styles);
980
 
981
- $below_custom_styles = $above_custom_styles = '';
 
 
 
 
 
982
 
983
- $options = array();
 
 
 
 
 
 
 
984
 
985
- // Sanitize profile, username and password
986
- if ( isset($data['addthis_username']) )
987
- $options['username'] = sanitize_text_field($data['addthis_username']);
988
 
989
- if ( isset($data['addthis_profile']) )
990
- $options['profile'] = sanitize_text_field($data['addthis_profile']);
 
 
991
 
992
- if ( isset($data['addthis_password']) )
993
- $options['password'] = sanitize_text_field($data['addthis_password']);
994
 
995
- if ( isset($data['username']) )
996
- $options['username'] = sanitize_text_field($data['username']);
997
 
998
- if ( isset($data['profile']) )
999
- $options['profile'] = sanitize_text_field($data['profile']);
1000
 
1001
- if ( isset($data['password']) )
1002
- $options['password'] = sanitize_text_field($data['password']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1003
 
1004
- if ( isset($data['wpfooter']))
1005
- $options['wpfooter'] = (bool) $data['wpfooter'];
 
1006
 
 
 
1007
 
1008
- if ( isset ($data['show_above']) )
1009
- $options['above'] = 'none';
1010
- elseif ( isset($styles[$data['above']]) )
1011
- $options['above'] = $data['above'];
1012
- elseif ($data['above'] == 'disable')
1013
- $options['above'] = $data['above'];
1014
- elseif ($data['above'] == 'none')
1015
- {
1016
- $options['above'] = 'none';
1017
- }
1018
- elseif ($data['above'] == 'custom')
1019
- {
1020
 
1021
- $options['above_do_custom_services'] = isset($data['above_do_custom_services']) ;
1022
- $options['above_do_custom_preferred'] = isset($data['above_do_custom_preferred']) ;
1023
 
1024
- $options['above'] = 'custom';
1025
- $options['above_custom_size'] = ( $data['above_custom_size'] == '16' || $data['above_custom_size'] == 32 ) ? $data['above_custom_size'] : '' ;
1026
- $options['above_custom_services'] = sanitize_text_field( $data['above_custom_services'] );
1027
- $options['above_custom_preferred'] = (int) $data['above_custom_preferred'] ;
1028
- $options['above_custom_more'] = isset($data['above_custom_more']);
1029
- }
1030
- elseif ($data['above'] == 'custom_string')
1031
- {
1032
 
1033
- $options['above'] = 'custom_string';
1034
- if (strpos($data['above_custom_string'], "style=") != false) {
1035
- $custom_style = explode('style=', $data['above_custom_string']);
1036
- $custom_style = explode('>', $custom_style[1]);
1037
- $custom_style = explode(' ', $custom_style[0]);
1038
- $above_custom_styles = " style=$custom_style[0]";
1039
  }
1040
- $options['above_custom_string'] = addthis_kses($data['above_custom_string'], $above_custom_styles);
1041
 
1042
- }
1043
-
1044
- if ( isset ($data['show_below']) )
1045
- $options['below'] = 'none';
1046
- elseif ( isset($styles[$data['below']]) )
1047
- $options['below'] = $data['below'];
1048
- elseif ($data['below'] == 'disable')
1049
- $options['below'] = $data['below'];
1050
- elseif ($data['below'] == 'none')
1051
- {
1052
- $options['below'] = 'none';
1053
- }
1054
- elseif ($data['below'] == 'custom')
1055
- {
1056
- $options['below_do_custom_services'] = isset($data['below_do_custom_services']) ;
1057
- $options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']) ;
1058
-
1059
- $options['below'] = 'custom';
1060
- $options['below_custom_size'] = ( $data['below_custom_size'] == '16' || $data['below_custom_size'] == 32 ) ? $data['below_custom_size'] : '' ;
1061
- $options['below_custom_services'] = sanitize_text_field( $data['below_custom_services'] );
1062
- $options['below_custom_preferred'] = sanitize_text_field( $data['below_custom_preferred'] );
1063
- $options['below_custom_more'] = isset($data['below_custom_more']);
1064
- }
1065
- elseif ($data['below'] == 'custom_string')
1066
- {
1067
- $options['below'] = 'custom_string';
1068
- if (strpos($data['below_custom_string'], "style=") != false) {
1069
- $custom_style = explode('style=', $data['below_custom_string']);
1070
- $custom_style = explode('>', $custom_style[1]);
1071
- $custom_style = explode(' ', $custom_style[0]);
1072
- $below_custom_styles = " style=$custom_style[0]";
1073
- }
1074
- $options['below_custom_string'] = addthis_kses($data['below_custom_string'], $below_custom_styles);
1075
- }
1076
 
1077
- if (isset($data['addthis_copytrackingremove']) && $data['addthis_copytrackingremove'] == true)
1078
- unset($data['addthis_copytracking1']);
1079
 
1080
- // All the checkbox fields
1081
- foreach (array('addthis_show_stats', 'addthis_asynchronous_loading','addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_aftertitle' , 'addthis_beforecomments', 'addthis_addressbar','addthis_508','addthis_copytracking2' ) as $field)
1082
- {
1083
- if ( isset($data[$field]) && $data[$field] == true)
1084
- $options[$field] = true;
1085
- else
1086
- $options[$field] = false;
1087
 
1088
- }
1089
- if ( isset ($data['data_ga_property']) && strlen($data['data_ga_property']) != 0)
1090
- $options['data_ga_property'] = sanitize_text_field($data['data_ga_property']);
1091
 
1092
- //[addthis_twitter_template]
1093
- if ( isset ($data['addthis_twitter_template']) && strlen($data['addthis_twitter_template']) != 0 ) {
1094
- //Parse the first twitter username to be used with via
1095
- $options['addthis_twitter_template'] = get_first_twitter_username(sanitize_text_field($data['addthis_twitter_template']));
1096
- }
1097
 
1098
- if (isset ($data['addthis_bitly_login']) && strlen($data['addthis_bitly_login']) != 0 )
1099
- $options['addthis_bitly_login'] = sanitize_text_field($data['addthis_bitly_login']);
1100
 
1101
- if (isset ($data['addthis_bitly_key']) && strlen($data['addthis_bitly_key']) != 0 )
1102
- $options['addthis_bitly_key'] = sanitize_text_field($data['addthis_bitly_key']);
1103
 
 
 
 
 
 
 
 
 
 
1104
 
1105
- //[addthis_brand] =>
1106
 
1107
- if ( isset ($data['addthis_brand']) && strlen($data['addthis_brand']) != 0 )
1108
- $options['addthis_brand'] = sanitize_text_field($data['addthis_brand']);
 
 
 
 
 
1109
 
1110
- //[addthis_options] =>
1111
- if ( isset ($data['addthis_options']) && strlen($data['addthis_options']) != 0 )
1112
- $options['addthis_options'] = str_replace(' ', '', esc_js( strtolower( $data['addthis_options'] ) ));
 
 
 
 
1113
 
1114
- //[addthis_language] =>
1115
- if ( isset ($data['addthis_language']))
1116
- $options['addthis_language'] = sanitize_text_field($data['addthis_language']);
 
 
1117
 
 
 
1118
 
1119
- //[atversion]=>
1120
- if ( isset ($data['atversion']))
1121
- $options['atversion'] = sanitize_text_field($data['atversion']);
1122
 
1123
- //[atversion_update_status]=>
1124
- if ( isset ($data['atversion_update_status']))
1125
- $options['atversion_update_status'] = sanitize_text_field($data['atversion_update_status']);
1126
 
1127
- if ( isset ($data['credential_validation_status']))
1128
- $options['credential_validation_status'] = sanitize_text_field($data['credential_validation_status']);
1129
 
1130
- if ( isset ($data['addthis_header_background']) && strlen($data['addthis_header_background']) != 0 )
1131
- {
1132
- if (! strpos($data['addthis_header_background'], '#') === 0)
1133
- $options['addthis_header_background'] = '#' . sanitize_text_field($data['addthis_header_background']);
1134
- else
1135
- $options['addthis_header_background'] = sanitize_text_field($data['addthis_header_background']);
1136
- }
1137
 
1138
- if ( isset ($data['addthis_header_color']) && strlen($data['addthis_header_color']) != 0 )
1139
- {
1140
- if (! strpos($data['addthis_header_color'], '#') === 0)
1141
- $options['addthis_header_color'] = '#' . sanitize_text_field($data['addthis_header_color']);
1142
- else
1143
- $options['addthis_header_color'] = sanitize_text_field($data['addthis_header_color']);
1144
- }
1145
 
1146
- if (isset ($data['addthis_config_json']) && strlen($data['addthis_config_json']) != 0 )
1147
- {
1148
- $options['addthis_config_json'] = sanitize_text_field($data['addthis_config_json']);
1149
- }
 
1150
 
1151
- if (isset ($data['addthis_share_json']) && strlen($data['addthis_share_json']) != 0 )
1152
- {
1153
- $options['addthis_share_json'] = sanitize_text_field($data['addthis_share_json']);
1154
- }
1155
-
1156
- if (isset ($data['above_chosen_list']) && strlen($data['above_chosen_list']) != 0)
1157
- {
1158
- $options['above_chosen_list'] = sanitize_text_field($data['above_chosen_list']);
1159
- }
1160
- else {
1161
- $options['above_chosen_list'] = "";
1162
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1163
 
1164
- if (isset ($data['below_chosen_list']) && strlen($data['below_chosen_list']) != 0)
1165
- {
1166
- $options['below_chosen_list'] = sanitize_text_field($data['below_chosen_list']);
1167
- }
1168
- else {
1169
- $options['below_chosen_list'] = "";
1170
- }
 
1171
 
1172
- return $options;
 
 
1173
 
1174
- }
 
1175
 
 
 
 
 
 
1176
 
1177
- /**
1178
- * Formally registers AddThis settings. Only called in WP 2.7+.
1179
- */
1180
- function register_addthis_settings() {
1181
- register_setting('addthis', 'addthis_settings', 'addthis_save_settings');
 
 
 
 
 
1182
 
1183
- }
1184
- /*
1185
- * Used to make sure excerpts above the head aren't displayed wrong
1186
- */
1187
- function addthis_add_content_filters()
1188
- {
 
 
 
 
1189
 
1190
- global $addthis_did_filters_added;
1191
- $addthis_did_filters_added = true;
1192
 
1193
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1194
- $preview = true;
1195
- else
1196
- $options = get_option('addthis_settings');
1197
-
1198
- if ( ! empty( $options) ){
1199
- if ( isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true )
1200
- add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt', 11);
1201
-
1202
- if ( isset($options['addthis_aftertitle']) && $options['addthis_aftertitle'] == true)
1203
- add_filter('the_title', 'addthis_display_after_title', 11);
1204
 
1205
- add_filter('the_content', 'addthis_display_social_widget', 15);
1206
-
 
 
 
1207
  }
1208
- }
1209
-
1210
-
1211
- /**
1212
- * Adds WP filter so we can append the AddThis button to post content.
1213
- */
1214
- function addthis_init()
1215
- {
1216
- global $addthis_settings;
1217
 
1218
- add_action( 'wp_head', 'addthis_add_content_filters');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1219
 
1220
- if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) {
1221
- if ( is_admin() ) {
1222
- add_action( 'admin_init', 'register_addthis_settings' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1223
  }
 
1224
  }
1225
 
1226
- $options = get_option('addthis_settings');
 
 
 
1227
 
1228
-
1229
- $script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/addthis.js' ;
1230
- $script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/addthis.js' ;
1231
 
1232
- $style_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) .'/addthis/css/addthis.css' ;
1233
- $style_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) .'/addthis/css/addthis.css' ;
1234
 
 
 
 
 
 
 
 
1235
 
1236
- wp_register_style( 'addthis', $style_location );
1237
- wp_register_script( 'addthis', $script_location , array('jquery-ui-tabs') );
 
 
 
 
 
 
1238
 
1239
- add_action('admin_print_styles-index.php', 'addthis_print_style');
1240
- add_action('admin_print_scripts-index.php', 'addthis_print_script');
 
 
 
 
1241
 
1242
- add_filter('admin_menu', 'addthis_admin_menu');
 
 
 
 
1243
 
1244
- if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
1245
- {
1246
- if ( get_option('addthis_product') !== false && ! is_array( $options ) )
1247
- addthis_options_200();
 
 
 
1248
 
1249
- // Upgrade to 210 from 200
1250
- if ( isset($options['username']) && ! isset($options['profile']) )
1251
- addthis_options_210();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1252
 
1253
- // Upgrade to 240 and add at 300
1254
- if ( ! isset($options['atversion']) )
1255
- addthis_options_240();
1256
- }
1257
- add_action( 'addthis_widget', 'addthis_print_widget', 10, 3);
1258
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1259
 
 
 
 
 
 
 
 
 
 
1260
 
1261
- }
 
 
1262
 
1263
- /**
1264
- * Places our options into a global associative array.
1265
- * @refactor
1266
- */
1267
- function addthis_set_addthis_settings()
1268
- {
1269
- global $addthis_settings;
1270
- $product = get_option('addthis_product');
1271
 
 
1272
 
1273
- $style = get_option('addthis_style');
1274
- if (strlen($style) == 0) $style = 'share';
1275
- $addthis_settings['style'] = $style;
 
1276
 
1277
- $addthis_settings['menu_type'] = get_option('addthis_menu_type');
 
 
1278
 
1279
- $addthis_settings['username'] = get_option('addthis_username');
1280
- $addthis_settings['fallback_username'] = get_option('addthis_fallback_username');
1281
 
1282
- $addthis_settings['password'] = get_option('addthis_password');
 
 
 
 
 
 
 
 
1283
 
1284
- $language = get_option('addthis_language');
1285
- $addthis_settings['language'] = $language;
1286
-
1287
- $atversion = get_option('atversion');
1288
- $addthis_settings['atversion'] = $atversion;
1289
 
1290
- $advopts = array('brand', 'append_data', 'language', 'header_background', 'header_color');
1291
- $addthis_settings['customization'] = '';
1292
- for ($i = 0; $i < count($advopts); $i++)
1293
- {
1294
- $opt = $advopts[$i];
1295
- $val = get_option("addthis_$opt");
1296
- if (isset($val) && strlen($val)) $addthis_settings['customization'] .= "var addthis_$opt = '$val';";
1297
- }
1298
- $addthis_settings['options'] = get_option('addthis_options');
1299
- }
1300
 
1301
- add_action('wp_dashboard_setup', 'addthis_dashboard_init' );
 
 
 
 
1302
 
1303
- add_action('widgets_init', 'addthis_widget_init');
 
1304
 
1305
- function addthis_widget_init()
1306
- {
1307
- require_once('addthis_settings_functions.php');
1308
- require_once('addthis_sidebar_widget.php');
1309
- //require_once('addthis_content_feed_widget.php');
1310
- register_widget('AddThisSidebarWidget');
1311
- //register_widget('AddThisContentFeedWidget');
1312
- }
1313
 
1314
- function addthis_sidebar_widget($args)
1315
- {
1316
- extract($args);
1317
- echo $before_widget;
1318
- echo $before_title . $after_title . addthis_social_widget('', true);
1319
- echo $after_widget;
1320
- }
1321
 
1322
- // essentially replace wp_trim_excerpt until we have something better to use here
1323
- function addthis_remove_tag($content, $text = '')
1324
- {
1325
 
 
 
1326
 
1327
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1328
- $preview = true;
1329
- else
1330
- $options = get_option('addthis_settings');
1331
 
 
 
1332
 
1333
- $raw_excerpt = $text;
1334
- if ( '' == $text ) {
1335
 
1336
- $text = get_the_content('');
1337
- $text = strip_shortcodes( $text );
1338
 
1339
- remove_filter('the_content', 'addthis_display_social_widget', 15);
1340
-
1341
- $text = apply_filters('the_content', $text);
1342
 
1343
- add_filter('the_content', 'addthis_display_social_widget', 15);
 
 
1344
 
1345
- $text = str_replace(']]>', ']]&gt;', $text);
1346
-
1347
- // 3.3 and earlier
1348
- if (! function_exists('wp_trim_words'))
1349
- $text = strip_tags($text);
1350
- $excerpt_length = apply_filters('excerpt_length', 55);
1351
- $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
1352
 
1353
- // 3.3 and later
1354
- if (function_exists('wp_trim_words'))
1355
- {
1356
- $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
1357
  }
1358
- else
 
 
 
 
 
1359
  {
1360
- $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
1361
- if ( count($words) > $excerpt_length ) {
1362
- array_pop($words);
1363
- $text = implode(' ', $words);
1364
- $text = $text . $excerpt_more;
1365
- } else {
1366
- $text = implode(' ', $words);
 
 
 
1367
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1368
  }
1369
- if ($options['addthis_showonexcerpts'] == false)
1370
- return $text;
1371
- return addthis_display_social_widget($text, false, false);
1372
- }
1373
- else
1374
- {
1375
- return $content;
1376
- }
1377
- }
1378
 
1379
 
1380
- /**
1381
- * so named because it is added "later then the standard filter and all the WP internal filters"
1382
- */
1383
- function addthis_late_widget($link_text)
1384
- {
1385
- remove_filter('get_the_excerpt', 'addthis_late_widget');
1386
 
1387
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1388
- $preview = true;
1389
- else
1390
- $options = get_option('addthis_settings');
1391
-
1392
- if ($options['addthis_showonexcerpts'] == false)
1393
- return $link_text;
1394
-
1395
- global $addthis_styles, $addthis_new_styles;
1396
- $styles = array_merge($addthis_styles, $addthis_new_styles);
1397
-
1398
- $url = get_permalink();
1399
- $title = get_the_title();
1400
- $url_above = '';
1401
- $url_below = '';
1402
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1403
- $preview = true;
1404
- else
1405
- $options = get_option('addthis_settings');
1406
-
1407
 
1408
- $url_below = "addthis:url='$url' ";
1409
- $url_below .= "addthis:title='". esc_attr( $title) ." '";
1410
 
1411
- if (has_excerpt() && ! is_attachment() && isset($options['below']) && $options['below'] == 'custom')
1412
- {
1413
- $belowOptions['size'] = $options['below_custom_size'];
1414
- if ($options['below_do_custom_services'])
1415
- $belowOptions['services'] = $options['below_custom_services'];
1416
- if ($options['below_do_custom_preferred'])
1417
- $belowOptions['preferred'] = $options['below_custom_preferred'];
1418
- $belowOptions['more'] = $options['below_custom_more'];
1419
- return $link_text . apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
1420
- }
1421
-
1422
- elseif ( isset ($styles[$options['below']]) && has_excerpt() && ! is_attachment() )
1423
- {
1424
- $below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
1425
- }
1426
- else
1427
- {
1428
- $below = apply_filters('addthis_below_content','' );
1429
  }
1430
- return $link_text . sprintf($below, $url_below);
1431
 
 
 
 
 
1432
 
1433
- }
 
 
1434
 
 
1435
 
1436
- function addthis_display_social_widget_excerpt($content)
1437
- {
1438
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1439
- $preview = true;
1440
- else
1441
- $options = get_option('addthis_settings');
1442
-
1443
- // I don't think has_excerpt() is always necessarily true when calling "get_the_excerpt()",
1444
- // but since this function is only as a get_the_excerpt() filter, we should probably
1445
- // not care whether or not an excerpt is there since the caller obviously wants one.
1446
- // needs testing/understanding.
1447
- if ( has_excerpt() && $options['addthis_showonexcerpts'] == true ) {
1448
- return addthis_display_social_widget($content, true, true);
1449
- } else
1450
- return $content;
1451
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1452
 
1453
- function addthis_display_widget_above($styles, $url, $title, $options) {
1454
- $above = '';
1455
- if (isset($styles[$options['above']])) {
1456
- if (isset($options['above_chosen_list']) && strlen($options['above_chosen_list']) != 0) {
1457
- if (isset($options['above']) && $options['above'] == 'large_toolbox') {
1458
- $aboveOptions['size'] = '32';
1459
- } elseif (isset($options['above']) && $options['above'] == 'small_toolbox') {
1460
- $aboveOptions['size'] = '16';
 
 
 
 
 
 
1461
  }
1462
- $aboveOptions['type'] = $options['above'];
1463
- $aboveOptions['services'] = $options['above_chosen_list'];
1464
- if(isset($options['addthis_options']))
1465
- $aboveOptions['addthis_options'] = $options['addthis_options'];
1466
- else
1467
- $aboveOptions['addthis_options'] = '';
1468
- $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title));
1469
- } else {
1470
- $above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
1471
- }
1472
- } elseif ($options['above'] == 'custom') {
1473
- $aboveOptions['size'] = $options['above_custom_size'];
1474
- if ($options['above_do_custom_services'])
1475
- $aboveOptions['services'] = $options['above_custom_services'];
1476
- if ($options['above_do_custom_preferred'])
1477
- $aboveOptions['preferred'] = $options['above_custom_preferred'];
1478
- $aboveOptions['more'] = $options['above_custom_more'];
1479
- $aboveOptions['addthis_options'] = $options['addthis_options'];
1480
- $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title));
1481
- } elseif ($options['above'] == 'custom_string') {
1482
- $custom = preg_replace('/<\s*div\s*/', '<div %1$s ', $options['above_custom_string']);
1483
- $above = apply_filters('addthis_above_content', $custom);
1484
- }
1485
- return $above;
1486
- }
1487
 
1488
- function addthis_display_widget_below($styles, $url, $title, $options) {
1489
- $below = '';
1490
- if (isset($styles[$options['below']])) {
1491
- if (isset($options['below_chosen_list']) && strlen($options['below_chosen_list']) != 0) {
1492
- if (isset($options['below']) && $options['below'] == 'large_toolbox') {
1493
- $belowOptions['size'] = '32';
1494
- } elseif (isset($options['below']) && $options['below'] == 'small_toolbox') {
1495
- $belowOptions['size'] = '16';
 
 
 
 
 
 
 
1496
  }
1497
- $belowOptions['type'] = $options['below'];
1498
- $belowOptions['services'] = $options['below_chosen_list'];
1499
- if(isset($options['addthis_options']))
1500
- $belowOptions['addthis_options'] = $options['addthis_options'];
1501
- else
1502
- $belowOptions['addthis_options'] = '';
1503
- $below = apply_filters('addthis_above_content', addthis_custom_toolbox($belowOptions, $url, $title));
1504
- } else {
1505
- $below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
1506
  }
1507
- } elseif ($options['below'] == 'custom') {
1508
- $belowOptions['size'] = $options['below_custom_size'];
1509
- $belowOptions['services'] = $options['below_custom_services'];
1510
- $belowOptions['preferred'] = $options['below_custom_preferred'];
1511
- $belowOptions['more'] = $options['below_custom_more'];
1512
- $belowOptions['addthis_options'] = $options['addthis_options'];
1513
- $below = apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title));
1514
- } elseif ($options['below'] == 'custom_string') {
1515
- $custom = preg_replace('/<\s*div\s*/', '<div %1$s ', $options['below_custom_string']);
1516
- $below = apply_filters('addthis_below_content', $custom);
1517
- }
1518
- return $below;
1519
- }
1520
 
1521
- function addthis_display_social_widget($content, $filtered = true, $below_excerpt = false)
1522
- {
 
 
 
 
 
1523
 
1524
- global $addthis_styles, $addthis_new_styles, $post;
1525
- $styles = array_merge($addthis_styles, $addthis_new_styles);
 
 
 
 
 
 
 
 
 
 
 
 
1526
 
 
 
 
 
 
1527
 
1528
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1529
- $preview = true;
1530
- else
1531
- $options = get_option('addthis_settings');
1532
 
1533
- if ( is_home() || is_front_page() ) {
1534
- if (isset($options['addthis_showonhome']) && $options['addthis_showonhome'] == true ) {
1535
- if (isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true ) {
1536
- $display = true;
1537
- }
1538
- else {
1539
- if( strpos($post->post_content, '<!--more-->') != false) {
1540
- $display = false;
1541
- }
1542
- else {
1543
- $display = true;
1544
- }
1545
- }
1546
- }
1547
- else {
1548
- if (isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true ) {
1549
- if( strpos($post->post_content, '<!--more-->') != false) {
1550
- $display = true;
1551
- }
1552
- else {
1553
- $display = false;
1554
- }
1555
- }
1556
- else {
1557
- $display = false;
1558
- }
1559
- }
1560
- }
1561
- elseif ( is_archive() && ! is_category() )
1562
- $display = (isset($options['addthis_showonarchives']) && $options['addthis_showonarchives'] == true ) ? true : false;
1563
- // Cat
1564
- elseif ( is_category() )
1565
- $display = (isset($options['addthis_showoncats']) && $options['addthis_showoncats'] == true ) ? true : false;
1566
- // Pages
1567
- elseif ( is_page($post->ID) )
1568
- $display = (isset($options['addthis_showonpages']) && $options['addthis_showonpages'] == true) ? true: false;
1569
- // Single pages (true by default and design)
1570
- elseif ( is_single() )
1571
- $display = true;
1572
- else
1573
- $display = false;
1574
-
1575
- $custom_fields = get_post_custom($post->ID);
1576
- if (isset ($custom_fields['addthis_exclude']) && $custom_fields['addthis_exclude'][0] == 'true')
1577
- $display = false;
1578
-
1579
- $display = apply_filters('addthis_post_exclude', $display);
1580
-
1581
- remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
1582
- remove_filter('get_the_excerpt', 'addthis_late_widget');
1583
- $url = get_permalink();
1584
- $title = get_the_title();
1585
- $url_above = "addthis:url='$url' ";
1586
- $url_above .= "addthis:title='". esc_attr( $title) ." '";
1587
- $url_below = "addthis:url='$url' ";
1588
- $url_below .= "addthis:title='". esc_attr( $title) ." '";
1589
- $above = '';
1590
- $below = '';
1591
-
1592
- // Still here? Well let's add some social goodness
1593
- if ( isset( $options['above'] ) && $options['above'] != 'none' && $options['above'] != 'disable' && $display )
1594
- {
1595
- $above = addthis_display_widget_above($styles, $url, $title, $options);
1596
- }
1597
- elseif ($display)
1598
- $above = apply_filters('addthis_above_content','' );
1599
- else
1600
- $above = '';
1601
 
1602
- if ( isset( $options['below'] ) && $options['below'] != 'none' && $options['below'] != 'disable' && $display && ! $below_excerpt )
1603
- {
1604
- $below = addthis_display_widget_below($styles, $url, $title, $options);
1605
- }
1606
- elseif ($below_excerpt && $display && $options['below'] != 'none' )
1607
- {
1608
- $below = apply_filters('addthis_below_content','' );
1609
- if ($options['addthis_showonexcerpts'] == true )
1610
- add_filter('get_the_excerpt', 'addthis_late_widget', 14);
1611
- }
1612
- elseif ($display)
1613
- $below = apply_filters('addthis_below_content','' );
1614
- else
1615
- $below = '';
1616
 
1617
-
1618
- if ($display)
1619
- {
1620
- if ( isset($above) )
1621
  {
 
 
1622
 
1623
- $content = sprintf($above, $url_above) . $content;
 
 
 
 
 
 
 
1624
  }
1625
- if ( isset($below) )
1626
  {
1627
- $content = $content . sprintf($below, $url_below);
 
 
 
 
1628
  }
1629
- if ($filtered == true)
1630
- add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11, 2);
 
 
 
 
 
 
 
 
 
 
 
 
1631
  }
1632
-
1633
- return $content;
1634
 
1635
- }
 
 
 
 
 
 
 
 
1636
 
1637
- add_action('init', 'addthis_register_script_in_addjs', 20);
1638
 
1639
- function addthis_register_script_in_addjs(){
1640
- global $addthis_addjs;
1641
- $script = addthis_output_script(true, true);
1642
- $addthis_addjs->addToScript($script);
1643
- }
 
 
 
 
 
 
 
 
1644
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1645
 
1646
- //add_action('wp_footer', 'addthis_output_script');
 
 
 
 
 
 
 
 
 
 
 
 
1647
 
1648
- /**
1649
- * Check to see if our Javascript has been outputted yet. If it hasn't, return it. Else, return false.
1650
- *
1651
- * @return mixed
1652
- */
1653
- function addthis_output_script($return = false, $justConfig = false )
1654
- {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1655
 
1656
- global $addthis_settings;
1657
- wp_enqueue_style( 'output', plugins_url('css/output.css', __FILE__) );
 
 
 
 
 
 
 
 
 
1658
 
1659
- if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
1660
- $preview = true;
1661
- else
1662
- $options = get_option('addthis_settings');
1663
-
1664
- $script = "\n<!-- AddThis Button Begin -->\n"
1665
- .'<script type="text/javascript">'
1666
- ."var addthis_product = '".ADDTHIS_PRODUCT_VERSION."';\n";
1667
-
1668
-
1669
- $pub = (isset($options['profile'])) ? $options['profile'] : false ;
1670
- if (!$pub) {
1671
- $pub = 'wp-'.cuid();
1672
- }
1673
- $pub = urlencode($pub);
1674
-
1675
- $addthis_config = array();
1676
- $addthis_share = array();
1677
-
1678
- $addthis_config["data_track_clickback"] = (isset($options['addthis_append_data']) && $options['addthis_append_data'] == true);
1679
-
1680
- if ( isset($options['data_ga_property']) ){
1681
- $addthis_config['data_ga_property'] = $options['data_ga_property'];
1682
- $addthis_config['data_ga_social'] = true;
1683
- }
1684
-
1685
- $addthis_config["data_track_addressbar"] = (isset($options['addthis_addressbar']) && $options['addthis_addressbar'] == true);
1686
-
1687
- // Opt in
1688
- $addthis_config['data_track_textcopy'] = (isset($options['addthis_copytracking2']) && $options['addthis_copytracking2'] == true);
1689
-
1690
- // Old opt out
1691
- if ( isset($options['addthis_copytracking1']) && $options['addthis_copytracking1'] == true)
1692
- $addthis_config['data_track_textcopy'] = false;
1693
- // Opt in
1694
- else if ( isset($options['addthis_copytracking2']) && $options['addthis_copytracking2'] == true)
1695
- $addthis_config['data_track_textcopy'] = true;
1696
- else
1697
- $addthis_config['data_track_textcopy'] = false;
1698
-
1699
-
1700
- if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1701
- $addthis_config['ui_language'] = $options['addthis_language'];
1702
-
1703
- if ( isset($options['atversion']))
1704
- $addthis_config['ui_atversion'] = isset($options['atversion_update_status']) && $options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $options['atversion'] : ADDTHIS_ATVERSION;
1705
-
1706
- if ( isset($options['addthis_header_background']) )
1707
- $addthis_config['ui_header_background'] = $options['addthis_header_background'];
1708
-
1709
- if ( isset($options['addthis_header_color']) )
1710
- $addthis_config['ui_header_color'] = $options['addthis_header_color'];
1711
-
1712
- if ( isset($options['addthis_brand']) )
1713
- $addthis_config['ui_cobrand'] = $options['addthis_brand'];
1714
-
1715
- if (isset($options['addthis_508']) && $options['addthis_508'] == true)
1716
- $addthis_config['ui_508_compliant'] = true;
1717
-
1718
- $addthis_config = apply_filters('addthis_config_js_var', $addthis_config);
1719
- $addthis_config_json = array_key_exists('addthis_config_json', $options) ? $options['addthis_config_json'] : '';
1720
- $script = merge_config_with_json_config($script, $addthis_config, $addthis_config_json);
1721
-
1722
-
1723
- if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
1724
- $script .= 'var addthis_options = "'.$options['addthis_options'].'";';
1725
-
1726
- if (isset($options['addthis_twitter_template'])){
1727
- //The following twitter template translation is deprecated and replaced with via
1728
- //$addthis_share['templates']['twitter'] = esc_js($options['addthis_twitter_template']);
1729
- $addthis_share['passthrough']['twitter']['via'] = esc_js(get_first_twitter_username($options['addthis_twitter_template']));
1730
-
1731
- }
1732
- if (isset($options['addthis_bitly_login']) && isset($options['addthis_bitly_key']) ){
1733
- $addthis_share['url_transforms']['shorten']['twitter'] = 'bitly';
1734
- $addthis_share['shorteners']['bitly']['login'] = esc_js($options['addthis_bitly_login']);
1735
- $addthis_share['shorteners']['bitly']['apiKey'] = esc_js($options['addthis_bitly_key']);
1736
- }
1737
-
1738
- if ($justConfig)
1739
  {
1740
- $return = '';
1741
- $share = apply_filters('addthis_share_js_var', $addthis_share );
1742
- if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '') {
1743
- $addthis_json_share = array_key_exists('addthis_share_json', $options) ? $options['addthis_share_json'] : '';
1744
- $return .= merge_share_with_json_share($addthis_share, $addthis_json_share);
1745
- }
1746
- else
1747
- {
1748
- if (! empty($share) )
1749
- $return .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1750
- }
1751
- $return .= "\n";
1752
 
1753
- if (isset($options['addthis_options']) && strlen($options['addthis_options']) != 0)
1754
- $return .= 'var addthis_options = "'.$options['addthis_options'].'";';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1755
 
1756
- $return .= "\n";
1757
-
1758
- $return = merge_config_with_json_config($return, $addthis_config, $addthis_config_json);
1759
 
1760
- $return .= "\n";
 
 
 
1761
 
1762
- return $return;
 
 
 
 
 
 
 
 
 
 
 
1763
 
 
 
 
1764
  }
 
1765
 
 
 
 
 
 
1766
 
1767
- if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '')
1768
- $script .= merge_share_with_json_share($addthis_share, $addthis_json_share);
1769
- else
1770
- $script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1771
- $script .= '</script>';
1772
-
1773
 
1774
- $script .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#pubid='.$pub.'"></script>';
1775
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1776
 
1777
- if ( ! is_admin() && ! is_feed() )
1778
- echo $script;
1779
- elseif ($return == true && ! is_admin() && ! is_feed() )
1780
- return $script;
1781
- }
1782
 
1783
- add_action('wp_ajax_validate_addthis_api_credentials', 'validate_addthis_api_credentials');
1784
- /**
1785
- * AJAX action to test the AddThis credentials
1786
- */
1787
- function validate_addthis_api_credentials()
1788
- {
1789
- $ajax_response = array('profileerror' => 'true', 'profilemessage' => '',
1790
- 'credentialerror' => 'true', 'credentialmessage' => '');
1791
- if ($_POST['addthis_username'] && $_POST['addthis_password'] && $_POST['addthis_profile']) {
1792
- $url = 'https://api.addthis.com/analytics/1.0/pub/shares.json?'.
1793
- 'username=' . urlencode($_POST['addthis_username']).
1794
- '&password=' . urlencode($_POST['addthis_password']).
1795
- '&pubid=' . urlencode($_POST['addthis_profile']);
1796
- $response = wp_remote_get($url);
1797
- $credential_error = '&#x2716; The username, password, and profile combination you entered is invalid.';
1798
- $profile_error = '&#x2716; Invalid AddThis profile ID';
1799
-
1800
- if (!is_wp_error($response)) {
1801
- if ($response['response']['code'] == 200) {
1802
- $ajax_response['profileerror'] = 'false';
1803
- $ajax_response['credentialerror'] = 'false';
1804
- } else {
1805
- if ($response['response']['code'] != 401) {
1806
- $ajax_response['credentialerror'] = 'false';
1807
- if (strpos($response['body'], '"invalidParameterName":"pubid"') === FALSE) {
1808
- $ajax_response['profileerror'] = 'false';
1809
- } else {
1810
- $ajax_response['profilemessage'] = $profile_error;
1811
- }
1812
- } else {
1813
- $ajax_response['credentialmessage'] = $credential_error;
1814
- }
1815
- }
1816
- } else {
1817
- $ajax_response['credentialmessage'] = 'error';
1818
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1819
  }
1820
- die('{"profileerror":"' . $ajax_response['profileerror'] . '","profilemessage":"' . $ajax_response['profilemessage'] . '",
1821
- "credentialerror":"' . $ajax_response['credentialerror'] . '","credentialmessage":"' . $ajax_response['credentialmessage'] . '"}');
1822
- }
1823
- /*
1824
- * Merge the Add this settings with that given using JSON format
1825
- * @param String $appendString - The string to build and return the script
1826
- * @param array $addthis_config - The setting array for add this config
1827
- * @param String $addthis_json_config - The JSON String
1828
- * @return String $appendString - The string to build and return the script
1829
- */
1830
- function merge_config_with_json_config($append_string, $addthis_config, $addthis_json_config) {
1831
- if ( isset( $addthis_json_config ) && trim($addthis_json_config) != '') {
1832
- $addthis_config_json_list = json_decode($addthis_json_config, true);
1833
- if (! empty ($addthis_config_json_list) && ! empty ($addthis_config)) {
1834
- foreach($addthis_config_json_list as $key_json => $json_config_value) {
1835
- $addthis_config[$key_json] = $json_config_value;
1836
- }
1837
  }
1838
- }
1839
- if (! empty ($addthis_config) )
1840
- $append_string .= 'var addthis_config = '. json_encode($addthis_config) .';';
1841
- return $append_string;
1842
- }
1843
- /*
1844
- * Merge the Add this settings with that given using JSON format
1845
- * @param String $appendString - The string to build and return the script
1846
- * @param array $addthis_share - The setting array for add this share
1847
- * @param String $addthis_json_share - The JSON String
1848
- * @return String $appendString - The string to build and return the script
1849
- */
1850
- function merge_share_with_json_share($addthis_share, $addthis_json_share) {
1851
- $append_string = '';
1852
- if ( isset( $addthis_json_share ) && trim($addthis_json_share) != '') {
1853
- $addthis_share_json_list = json_decode($addthis_json_share, true);
1854
- if (! empty ($addthis_share_json_list) && ! empty ($addthis_share)) {
1855
- foreach($addthis_share_json_list as $key_json => $json_share_value) {
1856
- $addthis_share[$key_json] = $json_share_value;
1857
- }
1858
- }
1859
- }
1860
- if (! empty ($addthis_share) )
1861
- $append_string = 'if (typeof(addthis_share) == "undefined"){ addthis_share = '. json_encode($addthis_share) .';}';
1862
- return $append_string;
1863
- }
1864
- /**
1865
- * Appends AddThis button to post content.
1866
- */
1867
- function addthis_social_widget($content, $onSidebar = false, $url = null, $title = null)
1868
- {
1869
- addthis_set_addthis_settings();
1870
- global $addthis_settings;
1871
 
1872
- // add nothing to RSS feed or search results; control adding to static/archive/category pages
1873
- if (!$onSidebar)
1874
  {
1875
- if ($addthis_settings['sidebar_only'] == 'true') return $content;
1876
- else if (is_feed()) return $content;
1877
- else if (is_search()) return $content;
1878
- else if (is_home() && !$addthis_settings['showonhome']) return $content;
1879
- else if (is_page() && !$addthis_settings['showonpages']) return $content;
1880
- else if (is_archive() && !$addthis_settings['showonarchives']) return $content;
1881
- else if (is_category() && !$addthis_settings['showoncats']) return $content;
1882
  }
1883
 
1884
- $pub = ($addthis_settings['username']);
1885
- if (!$pub) {
1886
- $pub = 'wp-'.cuid();
 
 
 
 
 
 
 
 
 
 
1887
  }
1888
- $pub = urlencode($pub);
1889
-
1890
- $link = !is_null($url) ? $url : ($onSidebar ? get_bloginfo('url') : get_permalink());
1891
- $title = !is_null($title) ? $title : ($onSidebar ? get_bloginfo('title') : the_title('', '', false));
1892
- $addthis_options = $addthis_settings['options'];
1893
-
1894
- $content .= "\n<!-- AddThis Button BEGIN -->\n"
1895
- .'<script type="text/javascript">'
1896
- ."\n//<!--\n"
1897
- ."var addthis_product = '".ADDTHIS_PRODUCT_VERSION."';\n";
1898
 
 
 
 
 
 
 
 
1899
 
1900
- if (strlen($addthis_settings['customization']))
1901
  {
1902
- $content .= ($addthis_settings['customization']) . "\n";
 
 
 
1903
  }
1904
 
1905
- if ($addthis_settings['menu_type'] === 'dropdown')
1906
  {
1907
- if (strlen($addthis_options)) $content .= "var addthis_options = '$addthis_options';\n";
1908
- $content .= <<<EOF
1909
- //-->
1910
- </script>
1911
- <div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" class="addthis_button" addthis:url="$link" addthis:title="$title">
1912
- EOF;
1913
- $content .= ($addthis_settings['language'] == '' ? '' /* no hardcoded image -- we'll choose the language automatically */ : addthis_get_button_img()) . '</a><script type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
1914
  }
1915
- else if ($addthis_settings['menu_type'] === 'toolbox')
 
 
 
 
 
 
1916
  {
1917
- $content .= "\n//-->\n</script>\n";
1918
- $content .= <<<EOF
1919
- <div class="addthis_container addthis_toolbox addthis_default_style" addthis:url="$link" addthis:title="$title"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span>
1920
- EOF;
1921
- if (!strlen($addthis_options)) $addthis_options = 'email,favorites,print,facebook,twitter';
1922
- $addthis_options = split(',', $addthis_options);
1923
- foreach ($addthis_options as $option) {
1924
- $option = trim($option);
1925
- if ($option != 'more') {
1926
- $content .= '<a class="addthis_button_'.$option.'"></a>';
 
 
1927
  }
 
1928
  }
1929
- $content .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
1930
  }
1931
- else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1932
  {
1933
- $link = urlencode($link);
1934
- $title = urlencode($title);
1935
- $content .= <<<EOF
1936
- //-->
1937
- </script>
1938
- <div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" onclick="window.open('//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub&amp;url=$link&amp;title=$title', 'ext_addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank">
1939
- EOF;
1940
- $content .= addthis_get_button_img() . '</a></div>';
1941
  }
1942
- $content .= "\n<!-- AddThis Button END -->";
1943
 
1944
- return $content;
 
1945
  }
1946
 
1947
- /**
1948
- * Generates img tag for share/bookmark button.
1949
- */
1950
- function addthis_get_button_img( $btnStyle = false )
1951
- {
1952
- global $addthis_settings;
1953
- global $addthis_styles;
1954
- global $addthis_default_options;
1955
-
1956
- $addthis_options = get_option('addthis_settings');
1957
- $options = wp_parse_args($addthis_options, $addthis_default_options);
1958
-
1959
- $language = $options['language'];
1960
 
1961
- if ($btnStyle == false)
1962
- $btnStyle = $addthis_settings['style'];
1963
- if ($addthis_settings['language'] != 'en')
1964
- {
1965
- // We use a translation of the word 'share' for all verbal buttons
1966
- switch ($btnStyle)
1967
- {
1968
- case 'bookmark':
1969
- case 'addthis':
1970
- case 'bookmark-sm':
1971
- $btnStyle = 'share';
 
 
 
1972
  }
 
1973
  }
1974
 
1975
- if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
1976
- $btnRecord = $addthis_styles[$btnStyle];
1977
- $btnUrl = (strpos(trim($btnRecord['img']), '//') !== 0 ? "//s7.addthis.com/static/btn/v2/" : "") . $btnRecord['img'];
1978
-
1979
- if (strpos($btnUrl, '%lang%') !== false)
1980
- {
1981
- $btnUrl = str_replace('%lang%', strlen($language) ? $language : 'en', $btnUrl);
1982
  }
1983
- $btnWidth = $btnRecord['w'];
1984
- $btnHeight = $btnRecord['h'];
1985
- return <<<EOF
1986
- <img src="$btnUrl" width="$btnWidth" height="$btnHeight" style="border:0" alt="Bookmark and Share"/>
1987
- EOF;
1988
- }
1989
 
1990
- function addthis_options_page_scripts()
1991
- {
1992
- $script = (addthis_get_wp_version() >= 3.2 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) ? 'options-page.32.js' : 'options-page.js';
1993
-
1994
- $script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
1995
- $script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
1996
- $imgLocationBase = apply_filters( 'at_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
1997
- $imgLocationBase = apply_filters( 'addthis_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
1998
- wp_enqueue_script( 'addthis_options_page_script', $script_location , array('jquery-ui-tabs', 'thickbox' ));
1999
- wp_enqueue_script( 'addthis_core',plugins_url( '', basename(dirname(__FILE__)) ) . '/addthis/js/core-1.1.1.js');
2000
- wp_enqueue_script( 'addthis_lr', plugins_url( '', basename(dirname(__FILE__)) ) .'/addthis/js/lr.js');
2001
- wp_enqueue_script('addthis_qtip_script', plugins_url( '', basename(dirname(__FILE__)) ) .'/addthis/js/jquery.qtip.min.js');
2002
- wp_enqueue_script('addthis_ui_script', plugins_url( '', basename(dirname(__FILE__)) ) .'/addthis/js/jqueryui.sortable.js');
2003
- wp_enqueue_script( 'addthis_selectbox',plugins_url( '', basename(dirname(__FILE__)) ) . '/addthis/js/jquery.selectBoxIt.min.js');
2004
- wp_enqueue_script( '', plugins_url( '', basename(dirname(__FILE__)) ) .'/addthis/js/jquery.messagebox.js');
2005
- wp_enqueue_script( '', plugins_url( '', basename(dirname(__FILE__)) ) .'/addthis/js/jquery.atjax.js');
2006
- wp_enqueue_script( 'addthis_lodash_script', plugins_url( '', basename(dirname(__FILE__)) ) .'/addthis/js/lodash-0.10.0.js');
2007
- wp_enqueue_script('addthis_services_script', plugins_url( '', basename(dirname(__FILE__)) ) . '/addthis/js/gtc-sharing-personalize.js');
2008
- wp_enqueue_script('addthis_service_script', plugins_url( '', basename(dirname(__FILE__)) ) . '/addthis/js/gtc.cover.js');
2009
- wp_localize_script( 'addthis_options_page_script', 'addthis_option_params', array('wp_ajax_url'=> admin_url('admin-ajax.php'), 'addthis_validate_action' => 'validate_addthis_api_credentials', 'img_base' => $imgLocationBase) );
2010
- wp_localize_script( 'addthis_services_script', 'addthis_params', array('img_base' => $imgLocationBase) );
2011
 
 
2012
  }
2013
 
2014
- function addthis_options_page_style()
2015
- {
2016
- $style_location = apply_filters( 'at_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
2017
- $style_location = apply_filters( 'addthis_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
2018
- wp_enqueue_style( 'addthis_options_page_style', $style_location);
2019
- wp_enqueue_style( 'thickbox' );
2020
- wp_enqueue_style( 'addthis_services_style', plugins_url( '', basename(dirname(__FILE__)) ) . '/addthis/css/gtc.sharing-personalize.css' );
2021
- wp_enqueue_style('addthis_bootstrap_style', plugins_url( '', basename(dirname(__FILE__)) ) . '/addthis/css/bootstrap.css');
2022
- wp_enqueue_style( 'addthis_widget', 'https://ct1.addthis.com/static/r07/widget114.css');
2023
- wp_enqueue_style( 'addthis_widget_big', 'https://ct1.addthis.com/static/r07/widgetbig056.css');
2024
  }
2025
 
2026
- function addthis_admin_menu()
2027
- {
2028
- $addthis = add_options_page('AddThis Plugin Options', 'AddThis Share', 'manage_options', basename(__FILE__), 'addthis_plugin_options_php4');
2029
- add_action('admin_print_scripts-' . $addthis, 'addthis_options_page_scripts');
2030
- add_action('admin_print_styles-' . $addthis, 'addthis_options_page_style');
2031
  }
2032
 
2033
- $addthis_default_options = array(
2034
- 'profile' => '',
2035
- 'username' => '',
2036
- 'password' => '',
2037
- 'style' => addthis_style_default ,
2038
- 'location' => 'below',
2039
- 'below' => 'fb_tw_p1_sc',
2040
- 'above' => 'large_toolbox',
2041
- 'addthis_show_stats' => true,
2042
- 'addthis_asynchronous_loading' => true,
2043
- 'addthis_append_data'=> true,
2044
- 'addthis_showonhome' => true,
2045
- 'addthis_showonpages' => true,
2046
- 'addthis_showonarchives' => true,
2047
- 'addthis_showoncats' => true,
2048
- 'addthis_aftertitle' => false,
2049
- 'addthis_beforecomments' => false,
2050
- 'addthis_addressbar' => false,
2051
- 'addthis_copytracking1' => false,
2052
- 'addthis_copytracking2' => false,
2053
- 'addthis_brand' => '',
2054
- 'toolbox' => '',
2055
- 'addthis_language' => '',
2056
- 'addthis_header_background' => '',
2057
- 'addthis_header_color' => '',
2058
- 'addthis_options' => '',
2059
- 'addthis_showonexcerpts' => true,
2060
- 'above_custom_size' => '',
2061
- 'above_custom_services' => '',
2062
- 'above_custom_preferred' => '',
2063
- 'above_custom_more' => '',
2064
- 'above_custom_string' => '',
2065
- 'below_custom_size' => '',
2066
- 'below_custom_services' => '',
2067
- 'below_custom_preferred' => '',
2068
- 'below_custom_more' => '',
2069
- 'below_custom_string' => '',
2070
- 'addthis_twitter_template' => '',
2071
- 'addthis_508' => '',
2072
- 'data_ga_property' => '',
2073
- 'addthis_bitly_login' => '',
2074
- 'addthis_bitly_key' => '',
2075
- 'addthis_config_json' => '',
2076
- 'addthis_share_json' => '',
2077
- 'atversion' => ADDTHIS_ATVERSION,
2078
- 'atversion_update_status' => 0,
2079
- 'credential_validation_status' => 0
2080
- );
2081
 
2082
- function addthis_plugin_options_php4() {
2083
-
2084
- require_once('addthis_settings_functions.php');
2085
- global $addthis_styles;
2086
- global $addthis_languages;
2087
- global $addthis_settings;
2088
- global $addthis_menu_types;
2089
- global $addthis_new_styles;
2090
- global $addthis_default_options;
2091
- global $addthis_addjs;
2092
-
2093
-
2094
-
2095
- global $current_user;
2096
- $user_id = $current_user->ID;
2097
-
2098
- if (get_user_meta($user_id, 'addthis_nag_updated_options') )
2099
- delete_user_meta($user_id, 'addthis_nag_updated_options', 'true');
2100
-
2101
- ?>
2102
- <div class="wrap">
2103
- <h2 class='placeholder'>&nbsp;</h2>
2104
-
2105
- <form id="addthis_settings" method="post" action="options.php">
2106
- <?php
2107
- // use the old-school settings style in older versions of wordpress
2108
- if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) {
2109
- settings_fields('addthis');
2110
- } else {
2111
- wp_nonce_field('update-options');
2112
- }
2113
-
2114
- $addthis_options = get_option('addthis_settings');
2115
- if ($addthis_options == false)
2116
- add_option('addthis_settings', array() );
2117
 
2118
- foreach ( array( 'addthis_show_stats', 'addthis_asynchronous_loading','addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats' ) as $option)
2119
- {
2120
- if ( $addthis_options && ! isset($addthis_options[$option]) )
2121
- $addthis_options[$option] = false;
2122
- }
2123
- $options = wp_parse_args($addthis_options, $addthis_default_options);
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>Now that you've upgraded your plugin you can access even more AddThis tools. </b>
2131
- &nbsp;Note: Your tool configurations will be reset.
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">
2140
- <ul class="nav-tab-wrapper">
2141
- <li><h2 class="nav-tab-wrapper"><a href="#tabs-1">Basic</a></h2></li>
2142
- <li><h2 class="nav-tab-wrapper"><a href="#tabs-2">Advanced</a></h2></li>
2143
- <li style="float: right; border: none;padding-right:0px;">
2144
- <strong><?php _e("AddThis Profile ID:", 'addthis_trans_domain' ); ?></strong>
2145
- <input id="addthis_profile" type="text" name="addthis_settings[addthis_profile]" value="<?php echo $profile; ?>" autofill='off' autocomplete='off' />
2146
- <br />
2147
- <span id="addthis-profile-validation-message" style="float: right;color:red;font-size:10px"></span>
2148
- <?php
2149
- if ($credential_validation_status == 1) {
2150
- echo '<span style="float: right;color:green;font-size:10px;">&#10004; Valid AddThis Profile ID</span>';
2151
- }
2152
- ?>
2153
- </li>
2154
- </ul>
2155
- <div class='clear'>&nbsp;</div>
2156
-
2157
- <div id="tabs-1">
2158
- <div style="float: left;width: 620px; margin-right: 10px;">
2159
- <?php echo $version_notification_content = _addthis_version_notification($atversion_update_status, $atversion);?>
2160
- <input type="hidden" value="<?php echo $atversion?>" name="addthis_settings[atversion]" id="addthis_atversion_hidden" />
2161
- <input type="hidden" value="<?php echo $atversion_update_status?>" name="addthis_settings[atversion_update_status]" id="addthis_atversion_update_status" />
2162
- <input type="hidden" value="<?php echo $credential_validation_status?>" name="addthis_settings[credential_validation_status]" id="addthis_credential_validation_status" />
2163
- <table class="form-table">
2164
- <tbody>
2165
- <?php _addthis_choose_icons('above', $options ); ?>
2166
- <?php _addthis_choose_icons('below', $options ); ?>
2167
- </tbody>
2168
- </table>
2169
-
2170
- <br/>
2171
-
2172
- <div style="margin-left:5px;font-weight:bold">
2173
- <?php _e("<a href='https://www.addthis.com/register?profile=wpp' target='_blank'>Register</a> for free in-depth analytics reports and better understand your site's social traffic.", 'addthis_trans_domain');?>
2174
- </div>
2175
- <table class="form-table" style="width:600px;">
2176
- <tbody>
2177
- <tr valign="top">
2178
- <td width="200"><?php _e("AddThis email / username:", 'addthis_trans_domain' ); ?></td>
2179
- <td><input id="addthis_username" type="text" name="addthis_settings[addthis_username]" value="<?php echo $username; ?>" autofill='off' autocomplete='off' /></td>
2180
- </tr>
2181
- <tr id="password_row" >
2182
- <td><?php _e("AddThis password:", 'addthis_trans_domain' ); ?><br/><span style="font-size:10px">(required for displaying stats)</span></td>
2183
- <td><input id="addthis_password" type="password" name="addthis_settings[addthis_password]" value="<?php echo $password; ?>" autocomplete='off' autofill='off' /></td>
2184
- </tr>
2185
- <tr>
2186
- <td style="height:32px">
2187
-
2188
- </td>
2189
- <td style="vertical-align:top;margin-top:0;padding-top:0;line-height:5px;font-size:10px">
2190
- <img class="addthis-admin-loader" style="display:none" src="<?php echo plugins_url('img/loader.gif', __FILE__)?>" />
2191
- <span class="addthis-admin-loader" style="display:none;color:gray">Connecting to AddThis profile <?php echo $profile; ?>..</span>
2192
- <span id="addthis-credential-validation-message" style="color:red"></span>
2193
- <?php
2194
- if ($credential_validation_status == 1) {
2195
- echo '<span style="color:green">&#10004; Valid AddThis Credentials</span>';
2196
- }
2197
- ?>
2198
- </td>
2199
- </tr>
2200
- </tbody>
2201
- </table>
2202
- <div class='clear'>&nbsp;</div>
2203
- <br/>
2204
- </div>
2205
-
2206
- <div style="display:block; float:left; width:470px;">
2207
- <div id="preview_floater">
2208
- <table class="form-table">
2209
- <tbody>
2210
- <tr>
2211
- <td id="below" colspan="2">
2212
- <fieldset>
2213
- <legend id="previewHeader">&nbsp;<strong>Preview</strong> &nbsp;</legend>
2214
- <div id="previewBox" class="previewbox">
2215
- <div id="addthis_share_demo" class="addthis_tshare_demo" >
2216
- <div class="addthis-share-list">
2217
- <h3 style="margin-top:0;">Another Post with Everything in it</h3>
2218
- <div id="above_previewContainer" style="float: left; width: 100%;"></div>
2219
- <p style="float: left; width: 100%;">Published by <a href="#">admin</a> on September 17, 2008 | <a href="#">2 Responses</a> | <a href="#">Edit</a></p>
2220
- <div id="preview_post"><p style="float: left; width: 100%;">Lorem dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p></div>
2221
- <div id="below_previewContainer" style="float: left; width: 100%;"></div>
2222
- <p style="float:left;">Posted in <a href="#">Child Category I</a>, <a href="#">Parent Category I</a>, <a href="#">Parent Category II</a></p>
2223
- </div>
2224
- </div>
2225
- </div>
2226
- </fieldset>
2227
- </td>
2228
- </tr>
2229
- </tbody>
2230
- </table>
2231
  </div>
2232
- </div>
2233
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2234
 
2235
- <div id="tabs-2">
2236
- <?php echo $version_notification_content?>
2237
- <table class="form-table">
2238
- <tr>
2239
- <th><h2>Show AddThis on &hellip;</h2></th>
2240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2241
  </tr>
2242
- <th scope="row"><?php _e("homepage:", 'addthis_trans_domain' ); ?></th>
2243
- <td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
2244
- </tr>
2245
- <tr>
2246
- <th scope="row"><?php _e("<a href=\"//codex.wordpress.org/Pages\" target=\"blank\">pages</a>:", 'addthis_trans_domain' ); ?></th>
2247
- <td><input type="checkbox" name="addthis_settings[addthis_showonpages]" value="true" <?php echo ( $addthis_showonpages == true ? 'checked="checked"' : ''); ?>/></td>
2248
- </tr>
2249
- <tr>
2250
- <th scope="row"><?php _e("archives:", 'addthis_trans_domain' ); ?></th>
2251
- <td><input type="checkbox" name="addthis_settings[addthis_showonarchives]" value="true" <?php echo ($addthis_showonarchives == true ? 'checked="checked"' : ''); ?>/></td>
2252
- </tr>
2253
- <tr>
2254
- <th scope="row"><?php _e("categories:", 'addthis_trans_domain' ); ?></th>
2255
- <td><input type="checkbox" name="addthis_settings[addthis_showoncats]" value="true" <?php echo ( $addthis_showoncats == true ? 'checked="checked"' : ''); ?>/></td>
2256
- </tr>
2257
- <tr>
2258
- <th scope="row"><?php _e("excerpts:", 'addthis_trans_domain' ); ?></th>
2259
- <td><input type="checkbox" name="addthis_settings[addthis_showonexcerpts]" value="true" <?php echo ( $addthis_showonexcerpts == true ? 'checked="checked"' : ''); ?>/></td>
2260
- </tr>
2261
- <?php if($addthis_settings['placement'] != "0") { ?>
2262
- <tr>
2263
- <th scope="row"><?php _e("after title:", 'addthis_trans_domain' ); ?></th>
2264
- <td><input type="checkbox" name="addthis_settings[addthis_aftertitle]" value="true" <?php echo ( $addthis_aftertitle == true ? 'checked="checked"' : ''); ?>/></td>
2265
- </tr>
2266
- <tr>
2267
- <th scope="row"><?php _e("before comments:", 'addthis_trans_domain' ); ?></th>
2268
- <td><input type="checkbox" name="addthis_settings[addthis_beforecomments]" value="true" <?php echo ( $addthis_beforecomments == true ? 'checked="checked"' : ''); ?>/></td>
2269
- </tr>
2270
- <?php } ?>
2271
  <tr>
2272
- <th><h2>Have AddThis track &hellip;</h2></th>
 
 
 
 
 
 
 
 
 
 
2273
  </tr>
2274
- <tr>
2275
- <th scope="row"><?php _e("<a href=\"//www.addthis.com/blog/2010/03/11/clickback-analytics-measure-traffic-back-to-your-site-from-addthis/\" target=\"_blank\">clickbacks</a>:", 'addthis_trans_domain' ); ?></th>
2276
- <td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
2277
- </tr>
2278
- <tr>
2279
- <th scope="row"><?php _e("address bar shares:", 'addthis_trans_domain' ); ?></th>
2280
- <td><input type="checkbox" name="addthis_settings[addthis_addressbar]" value="true" <?php echo ($addthis_addressbar == true ? 'checked="checked"' : ''); ?>/></td>
2281
- </tr>
2282
- <tr>
2283
- <th scope="row"><?php _e("copied text:", 'addthis_trans_domain' ); ?></th>
2284
- <?php if (isset( $addthis_copytracking1 ) && $addthis_copytracking1 == true){
2285
- echo "<input type='hidden' name='addthis_settings[addthis_copytrackingremove' value='true'/>";
2286
- $addthis_copytracking2 = false;
2287
- }?>
2288
- <!-- <td><input type="checkbox" name="addthis_settings[addthis_copytracking1]" value="true" <?php echo ( $addthis_copytracking1 == true ? 'checked="checked"' : ''); ?>/></td> -->
2289
- <td><input type="checkbox" name="addthis_settings[addthis_copytracking2]" value="true" <?php echo ( $addthis_copytracking2 == true ? 'checked="checked"' : ''); ?>/></td>
2290
- </tr>
2291
  <tr>
2292
- <th><h2>Display Options</h2></th>
 
 
 
 
 
 
 
 
 
 
2293
  </tr>
2294
- <tr valign="top">
2295
- <td colspan="2">For more details on the following options, see <a href="//support.addthis.com/customer/portal/articles/381263-addthis-client-api">our customization documentation</a>.</td>
2296
- </tr>
2297
- <tr valign="top">
2298
- <th scope="row"><?php _e("Custom service list:", 'addthis_trans_domain' ); ?><br /><span class='description'><?php _e(
2299
- 'Important: AddThis optimizes displayed services based on popularity and language, and personalizes the list for each user. You may decrease sharing by overriding these features.'
2300
- , 'addthis_trans_domain') ?>
2301
- </span></th>
2302
- <td><input size='60' type="text" name="addthis_settings[addthis_options]" value="<?php echo $addthis_options; ?>" /><br />
2303
- <span class='description'><?php _e('Enter a comma-separated list of <a href="//addthis.com/services/list">service codes</a>', 'addthis_trans_domain' ); ?></span>
2304
- </td>
2305
- </tr>
2306
- <tr valign="top" class="classicFeature">
2307
- <th scope="row"><?php _e("Brand:", 'addthis_trans_domain' ); ?></th>
2308
- <td><input type="text" name="addthis_settings[addthis_brand]" value="<?php echo $addthis_brand; ?>" /></td>
2309
- </tr>
2310
- <tr valign="top">
2311
- <th scope="row"><?php _e("Twitter via:", 'addthis_trans_domain' ); ?></th>
2312
- <td><input type="text" name="addthis_settings[addthis_twitter_template]" value="<?php echo get_first_twitter_username($addthis_twitter_template) ; ?>" /></td>
2313
- </tr>
2314
-
2315
- <tr valign="top">
2316
- <th scope="row"><?php _e("Language:", 'addthis_trans_domain' ); ?></th>
2317
- <td>
2318
- <select name="addthis_settings[addthis_language]">
2319
- <?php
2320
- $curlng = $addthis_language;
2321
- foreach ($addthis_languages as $lng=>$name)
2322
- {
2323
- echo "<option value=\"$lng\"". ($lng == $curlng ? " selected='selected'":""). ">$name</option>";
2324
- }
2325
- ?>
2326
- </select>
2327
- </td>
2328
- </tr>
2329
- <tr valign="top" class="classicFeature">
2330
- <th scope="row"><?php _e("Header background:", 'addthis_trans_domain' ); ?></th>
2331
- <td><input type="text" name="addthis_settings[addthis_header_background]" value="<?php echo $addthis_header_background; ?>" /></td>
2332
- </tr>
2333
- <tr valign="top" class="classicFeature">
2334
- <th scope="row"><?php _e("Header color:", 'addthis_trans_domain' ); ?></th>
2335
- <td><input type="text" name="addthis_settings[addthis_header_color]" value="<?php echo $addthis_header_color; ?>" /></td>
2336
- </tr>
2337
-
2338
  <tr>
2339
- <th><h2>Additional Options</h2></th>
 
 
 
 
 
 
 
 
2340
  </tr>
2341
- <tr>
2342
- <th scope="row"><?php _e("Show analytics in admin dashboard:", 'addthis_trans_domain' ); ?></th>
2343
- <td><input type="checkbox" name="addthis_settings[addthis_show_stats]" value="true" <?php echo ($addthis_show_stats == true ? 'checked="checked"' : ''); ?>/></td>
2344
- </tr>
2345
- <tr>
2346
- <th scope="row"><?php _e("Asynchronous Loading:", 'addthis_trans_domain' ); ?></th>
2347
- <td><input type="checkbox" name="addthis_settings[addthis_asynchronous_loading]" value="true" <?php echo ($addthis_asynchronous_loading == true ? 'checked="checked"' : ''); ?>/></td>
2348
- </tr>
2349
- <tr>
2350
- <tr>
2351
- <th scope="row"><?php _e("Enable enhanced accessibility:", 'addthis_trans_domain' ); ?></th>
2352
- <td><input type="checkbox" name="addthis_settings[addthis_508]" value="true" <?php echo ( $addthis_508 == true ? 'checked="checked"' : ''); ?>/></td>
2353
- </tr>
2354
- <tr>
2355
- <th scope="row"><?php _e("Google Analytics property ID:", 'addthis_trans_domain' ); ?></th>
2356
- <td><input type="text" name="addthis_settings[data_ga_property]" value="<?php echo $data_ga_property ?>"/></td>
2357
- </tr>
2358
-
2359
- <tr valign="top">
2360
- <td colspan="2"></td>
2361
- </tr>
2362
- <tr valign="top">
2363
- <th scope="row"><?php _e("Bitly login:", 'addthis_trans_domain' ); ?></th>
2364
- <td><input type="text" name="addthis_settings[addthis_bitly_login]" value="<?php echo $addthis_bitly_login; ?>" /></td>
2365
- </tr>
2366
- <tr valign="top">
2367
- <th scope="row"><?php _e("Bitly key:", 'addthis_trans_domain' ); ?></th>
2368
- <td><input type="text" name="addthis_settings[addthis_bitly_key]" value="<?php echo $addthis_bitly_key; ?>" /></td>
2369
- </tr>
2370
- <tr valign="top">
2371
- <th scope="row"><?php _e("addthis_config values:<br/><span class=\"description\">(json format)</span>", 'addthis_trans_domain' ); ?></th>
2372
- <td><textarea rows='3' cols='40' type="text" name="addthis_settings[addthis_config_json]" id="addthis-config-json"/><?php echo $addthis_config_json; ?></textarea></td>
2373
- <td id="config-error" style="display: none;color: red;float: left;margin-top: 25px;width: 150px;">Invalid JSON format</td>
2374
- </tr>
2375
- <tr valign="top">
2376
- <th scope="row"><?php _e("addthis_share values:<br/><span class=\"description\">(json format)</span>", 'addthis_trans_domain' ); ?></th>
2377
- <td><textarea rows='3' cols='40' type="text" name="addthis_settings[addthis_share_json]" id="addthis-share-json" /><?php echo $addthis_share_json; ?></textarea></td>
2378
- <td id="share-error" style="display: none;color: red;float: left;margin-top: 25px;width: 150px;">Invalid JSON format</td>
2379
- </tr>
2380
- </table>
2381
- <div class='clear'>&nbsp;</div>
2382
- </div>
2383
- </div>
2384
- <div class="clear">&nbsp;</div>
2385
-
2386
- <p class="submit">
2387
- <?php
2388
- // Build Preview Link
2389
- $preview_link = esc_url( get_option( 'home' ) . '/' );
2390
- if ( is_ssl() )
2391
- $preview_link = str_replace( 'http://', 'https://', $preview_link );
2392
- $stylesheet = get_option('stylesheet');
2393
- $template = get_option('template');
2394
- $preview_link = htmlspecialchars( add_query_arg( array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => true, 'TB_iframe' => 'true' ), $preview_link ) );
2395
-
2396
-
2397
- ?>
2398
- <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" id="submit-button"/>
2399
- <a href="<?php echo $preview_link; ?>" class="thickbox thickbox-preview" id="preview" ><?php _e('Preview'); ?></a>
2400
- </p>
2401
-
2402
- </form>
2403
- </div>
2404
- <?php
2405
- }
2406
- add_action('init', 'addthis_init');
2407
-
2408
- /* 2.9 compatability functions
2409
- */
2410
-
2411
- if (! function_exists('get_user_meta'))
2412
- {
2413
- function get_user_meta($userid, $metakey, $ignored='')
2414
- {
2415
- $userdata = get_userdata($userid);
2416
- if (isset($userdata->{$metakey}) )
2417
- return $userdata->{$metakey};
2418
- else
2419
- return false;
 
 
 
 
 
 
 
 
2420
  }
2421
 
2422
- }
2423
- if (! function_exists('delete_user_meta'))
2424
- {
2425
- function delete_user_meta($userid, $metakey, $ignored = '')
2426
- {
2427
- return delete_usermeta($userid, $metakey);
 
 
 
 
 
 
 
2428
  }
2429
- }
2430
 
2431
- if (! function_exists('add_user_meta'))
2432
- {
2433
- function add_user_meta($userid, $metakey, $metavalue)
2434
- {
2435
- return update_usermeta($userid, $metakey, $metavalue);
2436
- }
2437
- }
2438
- if (! function_exists('get_home_url'))
2439
- {
2440
- function get_home_url()
2441
- {
2442
- return get_option( 'home' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2443
  }
2444
- }
2445
 
2446
- if (! function_exists('__return_false'))
2447
- {
2448
- function __return_false()
2449
- {
2450
- return false;
2451
- }
2452
  }
2453
 
2454
- if (! function_exists('__return_true'))
2455
- {
2456
- function __return_true()
2457
- {
2458
- return true;
2459
  }
2460
- }
2461
 
2462
- if (! function_exists('esc_textarea'))
2463
- {
2464
- function esc_textarea($text)
2465
- {
2466
- $safe_text = htmlspecialchars( $text, ENT_QUOTES );
2467
- return $safe_text;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2468
  }
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
2475
- * @return String twitter username
2476
  */
2477
- if (! function_exists('get_first_twitter_username'))
2478
  {
2479
- function get_first_twitter_username($raw_twitter_username)
2480
- {
2481
- $twitter_username = '';
2482
- preg_match_all('/@(\w+)\b/i', $raw_twitter_username, $twitter_via_matches);
2483
- if (count($twitter_via_matches[1]) == 0) {
2484
- //To handle strings without @
2485
- preg_match_all('/(\w+)\b/i', $raw_twitter_username, $twitter_via_refined_matches);
2486
- if (count($twitter_via_refined_matches[1]) > 0) {
2487
- $twitter_username = $twitter_via_refined_matches[1][0];
2488
- }
2489
- } else {
2490
- $twitter_username = $twitter_via_matches[1][0];
2491
- }
2492
- return $twitter_username;
2493
- }
2494
- }
2495
-
2496
- // check for pro user
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;
2510
- }
2511
  }
2512
- return $isPro;
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
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
7
+ * Author: The AddThis Team
8
+ * Author URI: http://www.addthis.com/
9
+ * License: GPL2
10
+ *
11
+ * +--------------------------------------------------------------------------+
12
+ * | Copyright (c) 2008-2015 AddThis, LLC |
13
+ * +--------------------------------------------------------------------------+
14
+ * | This program is free software; you can redistribute it and/or modify |
15
+ * | it under the terms of the GNU General Public License as published by |
16
+ * | the Free Software Foundation; either version 2 of the License, or |
17
+ * | (at your option) any later version. |
18
+ * | |
19
+ * | This program is distributed in the hope that it will be useful, |
20
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
+ * | GNU General Public License for more details. |
23
+ * | |
24
+ * | You should have received a copy of the GNU General Public License |
25
+ * | along with this program; if not, write to the Free Software |
26
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
27
+ * +--------------------------------------------------------------------------+
28
+ */
29
+
30
  if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
31
  else return;
32
 
33
  define( 'addthis_style_default' , 'fb_tw_p1_sc');
34
+ define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-5.0');
 
35
  define( 'ADDTHIS_ATVERSION', '300');
36
  define( 'ADDTHIS_ATVERSION_MANUAL_UPDATE', -1);
37
  define( 'ADDTHIS_ATVERSION_AUTO_UPDATE', 0);
38
  define( 'ADDTHIS_ATVERSION_REVERTED', 1);
39
  define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
40
 
41
+ require_once('AddThisWordPressConnector.php');
42
+ require_once('AddThisConfigs.php');
 
 
 
 
 
 
43
 
44
+ $cmsConnector = new AddThisWordPressConnector();
45
+ $addThisConfigs = new AddThisConfigs($cmsConnector);
46
+ $addthis_options = $addThisConfigs->getConfigs();
47
 
48
+ require_once('addthis_settings_functions.php');
49
 
50
  /**
51
  * Show Plugin activation notice on first installation*
61
  );
62
  $html = '<div class="addthis_updated wrap">';
63
  $html .= '<span>'.
64
+ 'Congrats! You\'ve Installed AddThis Sharing Buttons'.
65
  '</span>';
66
  $html .= '<span><a class="addthis_configure" href="'
67
  . 'options-general.php?page=addthis_social_widget' .
69
  $html .= '</div><!-- /.updated -->';
70
  echo '<style>div#message.updated{ display: none; }</style>';
71
  echo $html;
72
+
73
  update_option('addthis_run_once', true);
74
  }
75
  }
80
  */
81
  add_action('admin_notices', 'pluginActivationNotice');
82
  function addthis_activation_hook(){
83
+ $cmsConnector = new AddThisWordPressConnector();
84
+ $addThisConfigs = new AddThisConfigs($cmsConnector);
85
+ $options = $addThisConfigs->getConfigs();
86
+ $addThisConfigs->saveConfigs($options);
87
+ }
88
+
89
+ register_activation_hook( __FILE__, 'addthis_activation_hook' );
90
+
91
+ if ( isset($_POST['addthis_plugin_controls'])
92
+ && $_POST['addthis_plugin_controls'] != $addthis_options['addthis_plugin_controls']
93
+ ) {
94
+ if($_POST['addthis_plugin_controls'] != 'AddThis') {
95
+ $addthis_options['addthis_plugin_controls'] = 'WordPress';
96
  } else {
97
+ $addthis_options['addthis_plugin_controls'] = 'AddThis';
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
+ $addthis_options = $addThisConfigs->saveConfigs($addthis_options);
 
 
100
  }
101
 
102
+ add_action('wp_head', 'addthis_minimal_css');
103
+ function addthis_minimal_css() {
104
+ wp_enqueue_style( 'output', _addthis_css_location_base() . 'output.css' );
105
+ }
106
 
107
+ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
108
  require_once 'addthis-for-wordpress.php';
109
+ new Addthis_Wordpress(isset($upgraded), $addThisConfigs);
110
  } else {
111
 
112
+ // Show old version of the plugin till upgrade button is clicked
113
+
114
+ // Add settings link on plugin page
115
+ function your_plugin_settings_link($links) {
116
+ $settings_link = '<a href="options-general.php?page=addthis_social_widget">Settings</a>';
117
+ array_push($links, $settings_link);
118
+ return $links;
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
+ if (!isset($addthis_addjs)){
132
+ require('includes/addthis_addjs_new.php');
133
+ $addthis_addjs = new AddThis_addjs($addThisConfigs);
134
+ }
135
  }
 
136
 
137
+ $addthis_settings = array();
138
+ $addthis_settings['isdropdown'] = 'true';
139
+ $addthis_settings['customization'] = '';
140
+ $addthis_settings['menu_type'] = 'dropdown';
141
+ $addthis_settings['language'] = 'en';
142
+ $addthis_settings['fallback_username'] = '';
143
+ $addthis_settings['style'] = 'share';
144
+ $addthis_settings['atversion'] = ADDTHIS_ATVERSION;
145
+ $addthis_settings['placement'] = ENABLE_ADDITIONAL_PLACEMENT_OPTION;
146
+
147
+ $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');
148
+
149
+ $addthis_menu_types = array('static', 'dropdown', 'toolbox');
150
+
151
+ $addthis_styles = array(
152
+ 'share' => array('img'=>'lg-share-%lang%.gif', 'w'=>125, 'h'=>16),
153
+ 'bookmark' => array('img'=>'lg-bookmark-en.gif', 'w'=>125, 'h'=>16),
154
+ 'addthis' => array('img'=>'lg-addthis-en.gif', 'w'=>125, 'h'=>16),
155
+ 'share-small' => array('img'=>'sm-share-%lang%.gif', 'w'=>83, 'h'=>16),
156
+ 'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
157
+ 'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
158
+ );
159
+
160
+ $addthis_options = get_option('addthis_settings');
161
+ $atversion = is_array($addthis_options) && array_key_exists('atversion_reverted', $addthis_options) && $addthis_options['atversion_reverted'] == 1 ? $addthis_options['atversion'] : ADDTHIS_ATVERSION;
162
+
163
+ $addthis_new_styles = array(
164
+ 'large_toolbox' => array(
165
+ 'src' => '
166
+ <div class="addthis_toolbox addthis_default_style addthis_32x32_style" %1$s >
167
+ <a class="addthis_button_preferred_1"></a>
168
+ <a class="addthis_button_preferred_2"></a>
169
+ <a class="addthis_button_preferred_3"></a>
170
+ <a class="addthis_button_preferred_4"></a>
171
+ <a class="addthis_button_compact"></a>
172
+ <a class="addthis_counter addthis_bubble_style"></a>
173
+ </div>',
174
+ 'img' => 'toolbox-large.png',
175
+ 'name' => 'Large Toolbox',
176
+ 'above' => 'hidden ',
177
+ 'below' => 'hidden'
178
+ ),
179
+ 'small_toolbox' => array(
180
+ 'src' => '
181
+ <div class="addthis_toolbox addthis_default_style addthis_" %1$s >
182
+ <a class="addthis_button_preferred_1"></a>
183
+ <a class="addthis_button_preferred_2"></a>
184
+ <a class="addthis_button_preferred_3"></a>
185
+ <a class="addthis_button_preferred_4"></a>
186
+ <a class="addthis_button_compact"></a>
187
+ <a class="addthis_counter addthis_bubble_style"></a>
188
+ </div>',
189
+ 'img' => 'toolbox-small.png',
190
+ 'name' => 'Small Toolbox',
191
+ 'above' => 'hidden ',
192
+ 'below' => ''
193
+ ),
194
+ 'fb_tw_p1_sc' => array(
195
+ 'src' => '
196
+ <div class="addthis_toolbox addthis_default_style " %1$s >
197
+ <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
198
+ <a class="addthis_button_tweet"></a>
199
+ <a class="addthis_button_pinterest_pinit"></a>
200
+ <a class="addthis_counter addthis_pill_style"></a>
201
+ </div>',
202
+ 'img' => 'horizontal_share_rect.png',
203
+ 'name' => 'Like, Tweet, +1, Share',
204
+ 'above' => '',
205
+ 'below' => '',
206
+ ),
207
+ 'button' => array(
208
+ 'src' => '
209
+ <div>
210
+ <a class="addthis_button" href="//addthis.com/bookmark.php?v='.$atversion.'" %1$s>
211
+ <img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/>
212
+ </a>
213
+ </div>',
214
+ 'img' => 'horizontal_share.png',
215
+ 'name' => 'Classic Share Button',
216
+ 'above' => 'hidden ',
217
+ 'below' => 'hidden'
218
+ )
219
+ );
220
+
221
+
222
+ //add_filter('the_title', 'at_title_check');
223
+ /**
224
+ * @deprecated
225
+ * @todo Add _deprecated_function notice.
226
+ */
227
+ function at_title_check($title)
228
  {
 
229
 
230
+ global $addthis_did_filters_added;
 
231
 
232
+ if (!isset ($addthis_did_filters_added) || $addthis_did_filters_added != true)
233
+ {
234
+ addthis_add_content_filters();
235
+ add_filter('the_content', 'addthis_script_to_content');
236
+ }
237
+
238
+ return $title;
239
+ }
240
 
 
 
 
 
 
 
 
241
 
242
+ /**
243
+ * @deprecated
244
+ * @todo Add _deprecated_function notice.
245
+ */
246
+ function addthis_script_to_content($content)
247
  {
248
+ global $addthis_did_script_output;
249
+
250
+ if (!isset($addthis_did_script_output) )
251
+ {
252
+ $addthis_did_script_output = true;
253
+ $content .= addthis_output_script(true);
254
+ }
255
+ return $content ;
256
  }
 
 
257
 
258
 
259
+ add_filter('language_attributes', 'addthis_language_attributes');
260
+ function addthis_language_attributes($input)
261
+ {
262
+ return $input . ' xmlns:fb="http://ogp.me/ns/fb#" xmlns:addthis="http://www.addthis.com/help/api-spec" ';
263
+ }
264
 
265
 
266
+ /**
267
+ * Converts our old many options in to one beautiful array
268
+ *
269
+ */
270
 
271
+ // Caution: Using this filter to disable upgrades may have unexpected consequences.
272
+ if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
 
 
273
  {
274
+ function addthis_options_200()
275
+ {
276
+ global $current_user;
277
+ global $addThisConfigs;
278
+
279
+ $user_id = $current_user->ID;
280
+ $addthis_new_options = array();
281
+
282
+ if ($asynchronous_loading = get_option('addthis_asynchronous_loading'))
283
+ $addthis_new_options['addthis_asynchronous_loading'] = $asynchronous_loading;
284
+
285
+ if ($append_data = get_option('addthis_append_data'))
286
+ $addthis_new_options['addthis_append_data'] = $append_data;
287
+
288
+ // populate variables for share button location template settings
289
+ $locationTemplateFields = $addThisConfigs->getFieldsForContentTypeSharingLocations();
290
+ foreach ($locationTemplateFields as $field) {
291
+ $optionName = $field['fieldName'];
292
+ $variableName = $field['variableName'];
293
+
294
+ if ($$variableName = get_option($optionName)) {
295
+ $addthis_new_options[$optionName] = $$variableName;
296
+ }
297
+ }
298
+
299
+ if ($aftertitle = get_option('addthis_aftertitle'))
300
+ $addthis_new_options['addthis_aftertitle'] = $aftertitle;
301
+
302
+ if ($beforecomments = get_option('addthis_beforecomments'))
303
+ $addthis_new_options['addthis_beforecomments'] = $beforecomments;
304
+
 
 
 
 
 
 
 
 
 
 
305
  $addthis_new_options['below'] = 'none';
306
+
307
+ if ($header_background = get_option('addthis_header_background'))
308
+ $addthis_new_options['addthis_header_background'] = $header_background;
309
+ if ($header_color = get_option('addthis_header_color'))
310
+ $addthis_new_options['addthis_header_color'] = $header_color;
311
+ if ($brand = get_option('addthis_brand'))
312
+ $addthis_new_options['addthis_brand'] = $brand;
313
+ if ($language = get_option('addthis_language'))
314
+ $addthis_new_options['addthis_language'] = $language;
315
+
316
+ //version check
317
+ if ($atversion = get_option('atversion'))
318
+ $addthis_new_options['atversion'] = $atversion;
319
+
320
+
321
+ // Above is new, set it to none
322
+ $addthis_new_options['above'] = 'none';
323
+
324
+ // Save option
325
+ add_option('addthis_settings', $addthis_new_options);
326
+
327
+ // if the option saved, delete the old options
328
+
329
+ delete_option('addthis_asynchronous_loading');
330
+ delete_option('addthis_fallback_username');
331
+ delete_option('addthis_product');
332
+ delete_option('addthis_isdropdown');
333
+ delete_option('addthis_menu_type');
334
+ delete_option('addthis_append_data');
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
+
344
+ // delete each share button location template settings
345
+ foreach ($locationTemplateFields as $field) {
346
+ $optionName = $field['fieldName'];
347
+ delete_option($optionName);
348
+ }
349
+
350
+ // old options that are no longer used, to clean up after ourshelves
351
+ if (false) {
352
+ $deprecatedFields = _addthis_deprecated_fields();
353
+ foreach ($deprecatedFields as $field) {
354
+ delete_option($field);
355
+ }
356
+ }
357
+
358
+ global $current_user;
359
+ $user_id = $current_user->ID;
360
+
361
+ add_user_meta($user_id, 'addthis_nag_updated_options', 'true', true);
362
+ }
363
+
364
+ function addthis_options_240()
365
  {
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
+ }
375
  }
376
 
377
+ function addthis_add_for_check_footer() {
 
 
 
 
378
 
 
379
  }
380
 
381
+ function addthis_check_footer() {
 
 
382
 
 
 
 
 
 
383
  }
 
384
 
 
385
 
386
+ /**
387
+ * Generates unique IDs
388
+ */
389
+ function cuid()
390
+ {
391
+ $base = get_option('home');
392
+ $cuid = hash_hmac('md5', $base, 'addthis');
393
+ return $cuid;
394
+ }
395
 
396
+ define('ADDTHIS_FALLBACK_USERNAME', 'wp-'.cuid() );
397
 
398
+ /**
399
+ * Returns major.minor WordPress version.
400
+ */
401
+ function addthis_get_wp_version() {
402
+ return (float)substr(get_bloginfo('version'),0,3);
403
+ }
404
 
405
+ /**
406
+ * For templates, we need a wrapper for printing out the code on demand.
407
+ */
408
+ function addthis_print_widget($url = null, $title = null, $style = addthis_style_default) {
409
+ global $addthis_styles, $addthis_new_styles;
410
+ global $addThisConfigs;
411
+ $styles = array_merge($addthis_styles, $addthis_new_styles);
412
+
413
+ $options = $addThisConfigs->getConfigs();
414
+
415
+ $identifier = addthis_get_identifier($url, $title);
416
+
417
+ echo "\n<!-- AddThis Custom -->\n";
418
+ if (!is_array($style) && isset($addthis_new_styles[$style])) {
419
+ echo sprintf($addthis_new_styles[$style]['src'], $identifier);
420
+ } elseif ($style == 'above') {
421
+ $above = addthis_display_widget_above($styles, $url, $title, $options);
422
+ echo sprintf($above, $identifier);
423
+ } elseif ($style == 'below') {
424
+ $below = addthis_display_widget_below($styles, $url, $title, $options);
425
+ echo sprintf($below, $identifier);
426
+ } elseif (is_array($style))
427
+ echo addthis_custom_toolbox($style, $url, $title);
428
+ echo "\n<!-- End AddThis Custom -->\n";
429
+ }
430
 
431
+ /*
432
+ * Generates the addthis:url and addthis:title attributes
433
+ */
 
 
 
 
 
 
434
 
435
+ function addthis_get_identifier($url = null, $title = null)
436
+ {
437
 
438
+ if (! is_null($url) )
439
+ $identifier = "addthis:url='$url' ";
440
+ if (! is_null($title) )
441
+ $identifier .= "addthis:title='$title'";
 
 
442
 
443
+ if (! isset($identifier) )
444
+ $identifier = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
 
446
+ return $identifier;
447
+ }
 
448
 
449
+ /**
450
+ * Options is an array that contains
451
+ * size - either 16 or 32. Defaults to 16
452
+ * services - comma sepperated list of services
453
+ * preferred - number of Prefered services to be displayed after listed services
454
+ * more - bool to show or not show the more icon at the end
455
+ *
456
+ * @param $options array
457
+ */
458
+
459
+ function addthis_custom_toolbox($options, $url, $title)
460
+ {
461
+ $identifier = addthis_get_identifier($url, $title);
462
 
463
+ $outerClasses = 'addthis_toolbox addthis_default_style';
 
 
 
 
 
 
464
 
465
+ if (isset($options['size']) && $options['size'] == '32')
466
+ $outerClasses .= ' addthis_32x32_style';
467
 
468
+ if (isset($options['type']) && $options['type'] != 'custom_string') {
469
+ $button = '<div class="'.$outerClasses.'" '.$identifier.' >';
470
 
471
+ if (isset($options['services']) ) {
472
+ $services = explode(',', $options['services']);
473
+ foreach ($services as $service)
474
+ {
475
+ $service = trim($service);
476
+ if ($service == 'more' || $service == 'compact') {
477
+ if (isset($options['type']) && $options['type'] != 'fb_tw_p1_sc') {
478
+ $button .= '<a class="addthis_button_compact"></a>';
479
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  }
481
+ else if ($service == 'counter') {
482
+ if (isset($options['type']) && $options['type'] == 'fb_tw_p1_sc') {
483
+ $button .= '<a class="addthis_counter addthis_pill_style"></a>';
484
+ }
485
+ else {
486
+ $button .= '<a class="addthis_counter addthis_bubble_style"></a>';
487
+ }
488
  }
489
+ else if ($service == 'google_plusone') {
490
+ $button .= '<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>';
491
  }
492
+ else
493
+ $button .= '<a class="addthis_button_'.strtolower($service).'"></a>';
494
  }
 
 
 
 
 
495
  }
496
+
497
+ if (isset($options['preferred']) && is_numeric($options['preferred']))
 
 
 
498
  {
499
+ for ($a = 1; $a <= $options['preferred']; $a++)
500
+ {
501
+ $button .= '<a class="addthis_button_preferred_'.$a.'"></a>';
502
+ }
503
  }
 
504
 
505
+ if (isset($options['more']) && $options['more'] == true)
506
+ {
507
+ $button .= '<a class="addthis_button_compact"></a>';
 
 
 
 
 
 
 
508
  }
509
+
510
+ if (isset($options['counter']) && ($options['counter'] != "") && ($options['counter'] !== false))
511
+ {
512
+ if ($options['counter'] === true)
513
+ { //no style was specified
514
+ $button .= '<a class="addthis_counter"></a>';
515
+ }
516
+ else
517
+ { //a specific style was specified such as pill_style or bubble_style
518
+ $button .= '<a class="addthis_counter addthis_'.$options['counter'].'"></a>';
519
+ }
520
  }
521
+
522
+ $button .= '</div>';
523
  }
524
+
525
+ return $button;
526
  }
527
 
528
+ /**
529
+ * Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
530
+ */
531
+ function addthis_print_style() {
532
+ wp_enqueue_style( 'addthis' );
533
+ }
534
 
535
+ /**
536
+ * Adds AddThis script to page. Only used for admin dashboard in WP 2.7 and higher.
537
+ */
538
+ function addthis_print_script() {
539
+ wp_enqueue_script( 'addthis' );
540
+ }
541
 
542
+ add_action('admin_notices', 'addthis_admin_notices');
543
 
544
+ function addthis_admin_notices(){
545
+ if (! current_user_can('manage_options') ||( defined('ADDTHIS_NO_NOTICES') && ADDTHIS_NO_NOTICES == true ) )
546
+ return;
 
 
 
547
 
548
+ global $current_user ;
549
+ $user_id = $current_user->ID;
550
+ $options = get_option('addthis_settings');
 
 
 
551
 
552
+ if (!$options && ! get_user_meta($user_id, 'addthis_ignore_notices')) {
553
+ echo '<div class="updated addthis_setup_nag"><p>';
554
+ 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>'),
555
+ admin_url('options-general.php?page=' . basename(__FILE__) ),
556
+ '?addthis_nag_ignore=0');
557
+ echo "</p></div>";
558
+ } elseif ((get_user_meta($user_id, 'addthis_nag_updated_options'))) {
559
+ echo '<div class="updated addthis_setup_nag"><p>';
560
+ 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>'),
561
+ admin_url('options-general.php?page=' . basename(__FILE__) ),
562
+ '?addthis_nag_updated_ignore=0');
563
+ echo "</p></div>";
564
+ }
565
+ }
566
+ add_action('admin_init', 'addthis_nag_ignore');
567
 
568
+ function addthis_nag_ignore()
569
+ {
570
+ global $current_user;
571
+ $user_id = $current_user->ID;
572
 
573
+ if (isset($_GET['addthis_nag_ignore']) && '0' == $_GET['addthis_nag_ignore'])
574
+ add_user_meta($user_id, 'addthis_ignore_notices', 'true', true);
575
+ if (isset($_GET['addthis_nag_updated_ignore']) && '0' == $_GET['addthis_nag_updated_ignore'])
576
+ delete_user_meta($user_id, 'addthis_nag_updated_options', 'true');
577
+ }
578
 
579
+ function addthis_plugin_useragent($userAgent)
580
  {
581
+ global $cmsConnector;
582
+ return $userAgent . 'ATV/' . $cmsConnector->getPluginVersion();
 
 
 
583
  }
584
 
585
+ function addthis_render_dashboard_widget_holder()
586
  {
587
+ echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
 
 
 
 
 
 
 
 
 
 
 
 
 
588
  }
 
 
589
 
590
+ add_action('wp_ajax_at_save_transient', 'addthis_save_transient');
 
 
 
 
 
591
 
592
+ function addthis_save_transient() {
593
+ global $wpdb; // this is how you get access to the database
 
 
 
 
594
 
595
 
596
+ parse_str($_POST['value'], $values);
597
 
598
+ // verify nonce (or die).
599
+ $nonce = $values['_wpnonce'];
600
+ if (!wp_verify_nonce($nonce, 'addthis-options')) {
601
+ die('Security check');
602
+ }
603
 
604
+ // Parse Post data
605
+ $option_array = addthis_parse_options($values);
606
 
607
+ // Set Transient
608
+ if (get_transient('addthis_settings') !== false) {
609
+ delete_transient('addthis_settings');
610
+ }
611
+
612
+ $eh = set_transient('addthis_settings', $option_array, 120);
613
+
614
+ print_r($option_array);
615
+
616
+ die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
618
 
619
+ function addthis_save_settings($input)
620
+ {
621
+ global $addThisConfigs;
622
+ $options_array = $addThisConfigs->getConfigs();
623
+
624
+ // if special, do special, else
625
+ if ( isset($input['addthis_csr_confirmation'])
626
+ && $input['addthis_csr_confirmation'] == 'true'
627
+ ) {
628
+ if ( isset($input['addthis_profile'])
629
+ && wp_verify_nonce($_POST['pubid_nonce'], 'update_pubid')
630
+ ) {
631
+ $options_array['addthis_profile'] = $input['addthis_profile'];
632
  }
633
+ } else {
634
+ $options_array = addthis_parse_options($input);
635
  }
636
 
637
+ return $options_array;
 
 
638
  }
639
+
640
+
641
+ /**
642
+ * goes through all the options, sanitizing, verifying and returning for storage what needs to be there
643
+ */
644
+ function addthis_parse_options($data)
645
  {
646
+ global $addthis_styles, $addthis_new_styles;
647
+ global $addThisConfigs;
648
+
649
+ $styles = array_merge($addthis_styles, $addthis_new_styles);
650
+ $below_custom_styles = $above_custom_styles = '';
651
+ $options = $addThisConfigs->getConfigs();
652
+
653
+ if ( isset($data['above_sharing']))
654
+ $options['above_sharing'] = $data['above_sharing'];
655
+ if ( isset($data['below_sharing']))
656
+ $options['below_sharing'] = $data['below_sharing'];
657
+
658
+ if ( isset ($data['show_below']) )
659
+ $options['below'] = 'none';
660
+ elseif (isset($data['below'], $styles[$data['below']]) )
661
+ $options['below'] = $data['below'];
662
+ elseif ($data['below'] == 'disable')
663
+ $options['below'] = $data['below'];
664
+ elseif ($data['below'] == 'none')
665
  {
666
+ $options['below'] = 'none';
667
  }
668
+ elseif ($data['below'] == 'custom')
 
 
669
  {
670
+ $options['below_do_custom_services'] = isset($data['below_do_custom_services']) ;
671
+ $options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']) ;
672
+
673
+ $options['below'] = 'custom';
674
+ $options['below_custom_size'] = ( $data['below_custom_size'] == '16' || $data['below_custom_size'] == 32 ) ? $data['below_custom_size'] : '' ;
675
+ $options['below_custom_services'] = sanitize_text_field( $data['below_custom_services'] );
676
+ $options['below_custom_preferred'] = sanitize_text_field( $data['below_custom_preferred'] );
677
+ $options['below_custom_more'] = isset($data['below_custom_more']);
678
  }
679
+ elseif ($data['below'] == 'custom_string')
680
+ {
681
+ $options['below'] = 'custom_string';
682
+ if (strpos($data['below_custom_string'], "style=") != false) {
683
+ $custom_style = explode('style=', $data['below_custom_string']);
684
+ $custom_style = explode('>', $custom_style[1]);
685
+ $custom_style = explode(' ', $custom_style[0]);
686
+ $below_custom_styles = " style=$custom_style[0]";
687
+ }
688
+ $options['below_custom_string'] = addthis_kses($data['below_custom_string'], $below_custom_styles);
689
+ }
690
+
691
+ if ( isset($data['wpfooter']))
692
+ $options['wpfooter'] = (bool) $data['wpfooter'];
693
 
694
+ if ( isset ($data['show_above']) )
695
+ $options['above'] = 'none';
696
+ elseif ( isset($styles[$data['above']]) )
697
+ $options['above'] = $data['above'];
698
+ elseif ($data['above'] == 'disable')
699
+ $options['above'] = $data['above'];
700
+ elseif ($data['above'] == 'none')
701
  {
702
+ $options['above'] = 'none';
703
  }
704
+ elseif ($data['above'] == 'custom')
 
 
705
  {
706
+
707
+ $options['above_do_custom_services'] = isset($data['above_do_custom_services']) ;
708
+ $options['above_do_custom_preferred'] = isset($data['above_do_custom_preferred']) ;
709
+ $options['above'] = 'custom';
710
+ $options['above_custom_size'] = ( $data['above_custom_size'] == '16' || $data['above_custom_size'] == 32 ) ? $data['above_custom_size'] : '' ;
711
+ $options['above_custom_services'] = sanitize_text_field( $data['above_custom_services'] );
712
+ $options['above_custom_preferred'] = (int) $data['above_custom_preferred'] ;
713
+ $options['above_custom_more'] = isset($data['above_custom_more']);
714
+ }
715
+ elseif ($data['above'] == 'custom_string')
716
+ {
717
+ //[addthis_twitter_template]
718
+ if ( isset ($data['addthis_twitter_template']) && strlen($data['addthis_twitter_template']) != 0 ) {
719
+ //Parse the first twitter username to be used with via
720
+ $options['addthis_twitter_template'] = get_first_twitter_username(sanitize_text_field($data['addthis_twitter_template']));
721
+ }
722
+
723
+ $options['above'] = 'custom_string';
724
+ if (strpos($data['above_custom_string'], "style=") != false) {
725
+ $custom_style = explode('style=', $data['above_custom_string']);
726
+ $custom_style = explode('>', $custom_style[1]);
727
+ $custom_style = explode(' ', $custom_style[0]);
728
+ $above_custom_styles = " style=$custom_style[0]";
729
+ }
730
+ $options['above_custom_string'] = addthis_kses($data['above_custom_string'], $above_custom_styles);
731
+
732
  }
 
733
 
734
+ if (isset($data['addthis_profile'])) {
735
+ $options['addthis_profile'] = sanitize_text_field($data['addthis_profile']);
736
+ }
 
737
 
738
+ if ( isset($data['above_sharing']))
739
+ $options['above_sharing'] = $data['above_sharing'];
740
+ if ( isset($data['below_sharing']))
741
+ $options['below_sharing'] = $data['below_sharing'];
742
+
743
+ if ( isset ($data['show_below']) )
744
+ $options['below'] = 'none';
745
+ elseif ( isset($styles[$data['below']]) )
746
+ $options['below'] = $data['below'];
747
+ elseif ($data['below'] == 'disable')
748
+ $options['below'] = $data['below'];
749
+ elseif ($data['below'] == 'none')
750
  {
751
+ $options['below'] = 'none';
752
+ }
753
+ elseif ($data['below'] == 'custom')
754
+ {
755
+ $options['below_do_custom_services'] = isset($data['below_do_custom_services']) ;
756
+ $options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']) ;
757
+
758
+ $options['below'] = 'custom';
759
+ $options['below_custom_size'] = ( $data['below_custom_size'] == '16' || $data['below_custom_size'] == 32 ) ? $data['below_custom_size'] : '' ;
760
+ $options['below_custom_services'] = sanitize_text_field( $data['below_custom_services'] );
761
+ $options['below_custom_preferred'] = sanitize_text_field( $data['below_custom_preferred'] );
762
+ $options['below_custom_more'] = isset($data['below_custom_more']);
763
+ }
764
+ elseif ($data['below'] == 'custom_string')
765
+ {
766
+ $options['below'] = 'custom_string';
767
+ if (strpos($data['below_custom_string'], "style=") != false) {
768
+ $custom_style = explode('style=', $data['below_custom_string']);
769
+ $custom_style = explode('>', $custom_style[1]);
770
+ $custom_style = explode(' ', $custom_style[0]);
771
+ $below_custom_styles = " style=$custom_style[0]";
772
+ }
773
+ $options['below_custom_string'] = addthis_kses($data['below_custom_string'], $below_custom_styles);
774
+ }
775
 
776
+ // All the checkbox fields
777
+ $checkboxFields = array(
778
+ 'addthis_508',
779
+ 'addthis_above_enabled',
780
+ 'addthis_addressbar',
781
+ 'addthis_aftertitle' ,
782
+ 'addthis_append_data',
783
+ 'addthis_append_data',
784
+ 'addthis_asynchronous_loading',
785
+ 'addthis_beforecomments',
786
+ 'addthis_below_enabled',
787
+ 'addthis_bitly',
788
+ 'addthis_sidebar_enabled',
789
+ );
790
+
791
+ // add all share button location template settings to list of checkbox fields
792
+ $locationTemplateFields = $addThisConfigs->getFieldsForContentTypeSharingLocations();
793
+ foreach ($locationTemplateFields as $field) {
794
+ $optionName = $field['fieldName'];
795
+ $checkboxFields[] = $optionName;
796
+ }
797
 
798
+ foreach ($checkboxFields as $field)
799
+ {
800
+ if (isset($data[$field]) && $data[$field]) {
801
+ $options[$field] = true;
802
  } else {
803
+ $options[$field] = false;
804
  }
805
+ }
806
 
807
+ if (isset($data['data_ga_property'])) {
808
+ $options['data_ga_property'] = sanitize_text_field($data['data_ga_property']);
809
+ }
810
 
811
+ //[addthis_twitter_template]
812
+ if ( isset ($data['addthis_twitter_template'])) {
813
+ //Parse the first twitter username to be used with via
814
+ $options['addthis_twitter_template'] = get_first_twitter_username(sanitize_text_field($data['addthis_twitter_template']));
815
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
 
817
+ if (isset ($data['addthis_bitly']) && strlen($data['addthis_bitly']) != 0 )
818
+ $options['addthis_bitly'] = sanitize_text_field($data['addthis_bitly']);
819
 
 
 
 
 
 
820
 
821
+ //[addthis_brand] =>
822
+ if ( isset ($data['addthis_brand']) && strlen($data['addthis_brand']) != 0 )
823
+ $options['addthis_brand'] = sanitize_text_field($data['addthis_brand']);
 
 
 
 
 
 
 
 
 
 
824
 
825
+ //[addthis_language] =>
826
+ if ( isset ($data['addthis_language']))
827
+ $options['addthis_language'] = sanitize_text_field($data['addthis_language']);
828
 
 
829
 
830
+ //[atversion]=>
831
+ if ( isset ($data['atversion']))
832
+ $options['atversion'] = sanitize_text_field($data['atversion']);
833
 
834
+ //[atversion_update_status]=>
835
+ if ( isset ($data['atversion_update_status']))
836
+ $options['atversion_update_status'] = sanitize_text_field($data['atversion_update_status']);
837
 
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_header_background']) && strlen($data['addthis_header_background']) != 0 )
842
+ {
843
+ if (! strpos($data['addthis_header_background'], '#') === 0)
844
+ $options['addthis_header_background'] = '#' . sanitize_text_field($data['addthis_header_background']);
845
+ else
846
+ $options['addthis_header_background'] = sanitize_text_field($data['addthis_header_background']);
847
+ }
848
 
849
+ if ( isset ($data['addthis_header_color']) && strlen($data['addthis_header_color']) != 0 )
850
+ {
851
+ if (! strpos($data['addthis_header_color'], '#') === 0)
852
+ $options['addthis_header_color'] = '#' . sanitize_text_field($data['addthis_header_color']);
853
+ else
854
+ $options['addthis_header_color'] = sanitize_text_field($data['addthis_header_color']);
855
+ }
856
 
857
+ if (isset($data['addthis_config_json'])) {
858
+ $options['addthis_config_json'] = sanitize_text_field($data['addthis_config_json']);
859
+ }
 
 
 
 
 
 
860
 
861
+ if (isset($data['addthis_share_json'])) {
862
+ $options['addthis_share_json'] = sanitize_text_field($data['addthis_share_json']);
863
+ }
864
 
865
+ if (isset ($data['above_chosen_list']) && strlen($data['above_chosen_list']) != 0)
866
+ {
867
+ $options['above_chosen_list'] = sanitize_text_field($data['above_chosen_list']);
868
+ }
869
+ else {
870
+ $options['above_chosen_list'] = "";
871
+ }
872
 
873
+ if (isset ($data['below_chosen_list']) && strlen($data['below_chosen_list']) != 0)
874
+ {
875
+ $options['below_chosen_list'] = sanitize_text_field($data['below_chosen_list']);
876
+ }
877
+ else {
878
+ $options['below_chosen_list'] = "";
879
+ }
880
 
881
+ if(isset ($data['addthis_sidebar_position'])){
882
+ $options['addthis_sidebar_position'] = $data['addthis_sidebar_position'];
883
+ }
884
 
885
+ if(isset ($data['addthis_sidebar_count'])){
886
+ $options['addthis_sidebar_count'] = $data['addthis_sidebar_count'];
887
+ }
888
 
889
+ if(isset ($data['addthis_sidebar_theme'])){
890
+ $options['addthis_sidebar_theme'] = $data['addthis_sidebar_theme'];
891
+ }
892
 
893
+ if(isset($data['addthis_environment'])){
894
+ $options['addthis_environment'] = $data['addthis_environment'];
895
+ }
896
 
897
+ if(isset ($data['addthis_plugin_controls'])){
898
+ $options['addthis_plugin_controls'] = $data['addthis_plugin_controls'];
899
+ }
 
 
 
900
 
901
+ return $options;
902
+ }
903
 
 
904
 
905
+ /**
906
+ * Formally registers AddThis settings. Only called in WP 2.7+.
907
+ */
908
+ function register_addthis_settings() {
909
+ register_setting('addthis', 'addthis_settings', 'addthis_save_settings');
910
+ }
911
 
912
+ /*
913
+ * Used to make sure excerpts above the head aren't displayed wrong
914
+ */
915
+ function addthis_add_content_filters()
916
+ {
917
+ global $addthis_did_filters_added;
918
+ global $addThisConfigs;
919
+ $addthis_did_filters_added = true;
920
 
921
+ $options = $addThisConfigs->getConfigs();
 
 
922
 
923
+ if ( ! empty( $options) ){
924
+ if (_addthis_excerpt_buttons_enabled()) {
925
+ add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt', 11);
926
+ }
927
 
928
+ if ( isset($options['addthis_aftertitle']) && $options['addthis_aftertitle'] == true)
929
+ add_filter('the_title', 'addthis_display_after_title', 11);
930
 
931
+ add_filter('the_content', 'addthis_display_social_widget', 15);
 
932
 
933
+ }
934
+ }
935
 
936
+ /**
937
+ * Adds WP filter so we can append the AddThis button to post content.
938
+ */
939
+ function addthis_init()
940
+ {
941
+ global $addThisConfigs;
942
+ add_action('wp_head', 'addthis_add_content_filters');
943
+
944
+ if ( addthis_get_wp_version() >= 2.7
945
+ || apply_filters('at_assume_latest', __return_false())
946
+ || apply_filters('addthis_assume_latest', __return_false())
947
+ ) {
948
+ if (is_admin()) {
949
+ add_action('admin_init', 'register_addthis_settings');
950
+ }
951
+ }
952
 
953
+ $options = $addThisConfigs->getConfigs();
954
+ $script_location = _addthis_js_location_base() . 'addthis.js' ;
955
+ $style_location = _addthis_css_location_base() . 'addthis.css' ;
956
 
957
+ wp_register_style('addthis', $style_location);
958
+ wp_register_script('addthis', $script_location, array('jquery-ui-tabs'));
959
 
960
+ add_action('admin_print_styles-index.php', 'addthis_print_style');
961
+ add_action('admin_print_scripts-index.php', 'addthis_print_script');
 
 
 
 
 
 
 
 
 
 
962
 
963
+ add_filter('admin_menu', 'addthis_admin_menu');
 
964
 
965
+ if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
966
+ {
967
+ if ( get_option('addthis_product') !== false
968
+ && !is_array($options)
969
+ ) {
970
+ addthis_options_200();
971
+ }
 
972
 
973
+ // Upgrade to 240 and add at 300
974
+ if (!isset($options['atversion']) || empty($options['atversion'])) {
975
+ addthis_options_240();
976
+ }
977
+ }
978
+ add_action( 'addthis_widget', 'addthis_print_widget', 10, 3);
979
  }
 
980
 
981
+ /**
982
+ * Places our options into a global associative array.
983
+ * @refactor
984
+ */
985
+ function addthis_set_addthis_settings()
986
+ {
987
+ global $addthis_settings;
988
+ $product = get_option('addthis_product');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
989
 
 
 
990
 
991
+ $style = get_option('addthis_style');
992
+ if (strlen($style) == 0) $style = 'share';
993
+ $addthis_settings['style'] = $style;
 
 
 
 
994
 
995
+ $addthis_settings['menu_type'] = get_option('addthis_menu_type');
 
 
996
 
997
+ $addthis_settings['fallback_username'] = get_option('addthis_fallback_username');
 
 
 
 
998
 
999
+ $language = get_option('addthis_language');
1000
+ $addthis_settings['language'] = $language;
1001
 
1002
+ $atversion = get_option('atversion');
1003
+ $addthis_settings['atversion'] = $atversion;
1004
 
1005
+ $advopts = array('brand', 'append_data', 'language', 'header_background', 'header_color');
1006
+ $addthis_settings['customization'] = '';
1007
+ for ($i = 0; $i < count($advopts); $i++)
1008
+ {
1009
+ $opt = $advopts[$i];
1010
+ $val = get_option("addthis_$opt");
1011
+ if (isset($val) && strlen($val)) $addthis_settings['customization'] .= "var addthis_$opt = '$val';";
1012
+ }
1013
+ }
1014
 
1015
+ add_action('widgets_init', 'addthis_widget_init');
1016
 
1017
+ function addthis_widget_init()
1018
+ {
1019
+ require_once('addthis_sidebar_widget.php');
1020
+ //require_once('addthis_content_feed_widget.php');
1021
+ register_widget('AddThisSidebarWidget');
1022
+ //register_widget('AddThisContentFeedWidget');
1023
+ }
1024
 
1025
+ function addthis_sidebar_widget($args)
1026
+ {
1027
+ extract($args);
1028
+ echo $before_widget;
1029
+ echo $before_title . $after_title . addthis_social_widget('', true);
1030
+ echo $after_widget;
1031
+ }
1032
 
1033
+ // essentially replace wp_trim_excerpt until we have something better to use here
1034
+ function addthis_remove_tag($content, $text = '')
1035
+ {
1036
+ global $addThisConfigs;
1037
+ $options = $addThisConfigs->getConfigs();
1038
 
1039
+ $raw_excerpt = $text;
1040
+ if ( '' == $text ) {
1041
 
1042
+ $text = get_the_content('');
1043
+ $text = strip_shortcodes( $text );
 
1044
 
1045
+ remove_filter('the_content', 'addthis_display_social_widget', 15);
 
 
1046
 
1047
+ $text = apply_filters('the_content', $text);
 
1048
 
1049
+ add_filter('the_content', 'addthis_display_social_widget', 15);
 
 
 
 
 
 
1050
 
1051
+ $text = str_replace(']]>', ']]&gt;', $text);
 
 
 
 
 
 
1052
 
1053
+ // 3.3 and earlier
1054
+ if (! function_exists('wp_trim_words'))
1055
+ $text = strip_tags($text);
1056
+ $excerpt_length = apply_filters('excerpt_length', 55);
1057
+ $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
1058
 
1059
+ // 3.3 and later
1060
+ if (function_exists('wp_trim_words'))
1061
+ {
1062
+ $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
1063
+ }
1064
+ else
1065
+ {
1066
+ $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
1067
+ if ( count($words) > $excerpt_length ) {
1068
+ array_pop($words);
1069
+ $text = implode(' ', $words);
1070
+ $text = $text . $excerpt_more;
1071
+ } else {
1072
+ $text = implode(' ', $words);
1073
+ }
1074
+ }
1075
+ if (!_addthis_excerpt_buttons_enabled()) {
1076
+ return $text;
1077
+ }
1078
+ return addthis_display_social_widget($text, false, false);
1079
+ }
1080
+ else
1081
+ {
1082
+ return $content;
1083
+ }
1084
+ }
1085
 
1086
+ /**
1087
+ * so named because it is added "later then the standard filter and all the WP internal filters"
1088
+ */
1089
+ function addthis_late_widget($link_text)
1090
+ {
1091
+ global $addThisConfigs;
1092
+ remove_filter('get_the_excerpt', 'addthis_late_widget');
1093
+ $options = $addThisConfigs->getConfigs();
1094
 
1095
+ if (!_addthis_excerpt_buttons_enabled()) {
1096
+ return $link_text;
1097
+ }
1098
 
1099
+ global $addthis_styles, $addthis_new_styles;
1100
+ $styles = array_merge($addthis_styles, $addthis_new_styles);
1101
 
1102
+ $url = get_permalink();
1103
+ $title = get_the_title();
1104
+ $url_above = '';
1105
+ $url_below = "addthis:url='$url' ";
1106
+ $url_below .= "addthis:title='". esc_attr( $title) ." '";
1107
 
1108
+ if (has_excerpt() && ! is_attachment() && isset($options['below']) && $options['below'] == 'custom')
1109
+ {
1110
+ $belowOptions['size'] = $options['below_custom_size'];
1111
+ if ($options['below_do_custom_services'])
1112
+ $belowOptions['services'] = $options['below_custom_services'];
1113
+ if ($options['below_do_custom_preferred'])
1114
+ $belowOptions['preferred'] = $options['below_custom_preferred'];
1115
+ $belowOptions['more'] = $options['below_custom_more'];
1116
+ return $link_text . apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
1117
+ }
1118
 
1119
+ elseif ( isset ($styles[$options['below']]) && has_excerpt() && ! is_attachment() )
1120
+ {
1121
+ $below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
1122
+ }
1123
+ else
1124
+ {
1125
+ $below = apply_filters('addthis_below_content','' );
1126
+ }
1127
+ return $link_text . sprintf($below, $url_below);
1128
+ }
1129
 
 
 
1130
 
1131
+ function addthis_display_social_widget_excerpt($content)
1132
+ {
1133
+ // I don't think has_excerpt() is always necessarily true when calling "get_the_excerpt()",
1134
+ // but since this function is only as a get_the_excerpt() filter, we should probably
1135
+ // not care whether or not an excerpt is there since the caller obviously wants one.
1136
+ // needs testing/understanding.
 
 
 
 
 
1137
 
1138
+ if (has_excerpt() && _addthis_excerpt_buttons_enabled()) {
1139
+ return addthis_display_social_widget($content, true, true);
1140
+ } else {
1141
+ return $content;
1142
+ }
1143
  }
 
 
 
 
 
 
 
 
 
1144
 
1145
+ function addthis_display_widget_above($styles, $url, $title, $options) {
1146
+ $above = '';
1147
+ if ($options['addthis_above_enabled'] == true){
1148
+ if (isset($styles[$options['above']])) {
1149
+ if (isset($options['above_chosen_list']) && strlen($options['above_chosen_list']) != 0) {
1150
+ if (isset($options['above']) && $options['above'] == 'large_toolbox') {
1151
+ $aboveOptions['size'] = '32';
1152
+ } elseif (isset($options['above']) && $options['above'] == 'small_toolbox') {
1153
+ $aboveOptions['size'] = '16';
1154
+ }
1155
+ $aboveOptions['type'] = $options['above'];
1156
+ $aboveOptions['services'] = $options['above_chosen_list'];
1157
+ $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title));
1158
+ } else {
1159
+ $above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
1160
+ }
1161
+ } elseif ($options['above'] == 'custom') {
1162
+ $aboveOptions['size'] = $options['above_custom_size'];
1163
+ if ($options['above_do_custom_services'])
1164
+ $aboveOptions['services'] = $options['above_custom_services'];
1165
+ if ($options['above_do_custom_preferred'])
1166
+ $aboveOptions['preferred'] = $options['above_custom_preferred'];
1167
+ $aboveOptions['more'] = $options['above_custom_more'];
1168
+ $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title));
1169
+ } elseif ($options['above'] == 'custom_string') {
1170
+ $custom = preg_replace('/<\s*div\s*/', '<div %1$s ', $options['above_custom_string']);
1171
+ $above = apply_filters('addthis_above_content', $custom);
1172
+ }
1173
+ }
1174
+ return $above;
1175
+ }
1176
 
1177
+ function addthis_display_widget_below($styles, $url, $title, $options) {
1178
+ $below = '';
1179
+ if ($options['addthis_below_enabled'] == true){
1180
+ if (isset($styles[$options['below']])) {
1181
+ if (isset($options['below_chosen_list']) && strlen($options['below_chosen_list']) != 0) {
1182
+ if (isset($options['below']) && $options['below'] == 'large_toolbox') {
1183
+ $belowOptions['size'] = '32';
1184
+ } elseif (isset($options['below']) && $options['below'] == 'small_toolbox') {
1185
+ $belowOptions['size'] = '16';
1186
+ }
1187
+ $belowOptions['type'] = $options['below'];
1188
+ $belowOptions['services'] = $options['below_chosen_list'];
1189
+ $below = apply_filters('addthis_above_content', addthis_custom_toolbox($belowOptions, $url, $title));
1190
+ } else {
1191
+ $below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
1192
+ }
1193
+ } elseif ($options['below'] == 'custom') {
1194
+ $belowOptions['size'] = $options['below_custom_size'];
1195
+ $belowOptions['services'] = $options['below_custom_services'];
1196
+ $belowOptions['preferred'] = $options['below_custom_preferred'];
1197
+ $belowOptions['more'] = $options['below_custom_more'];
1198
+ $below = apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title));
1199
+ } elseif ($options['below'] == 'custom_string') {
1200
+ $custom = preg_replace('/<\s*div\s*/', '<div %1$s ', $options['below_custom_string']);
1201
+ $below = apply_filters('addthis_below_content', $custom);
1202
+ }
1203
  }
1204
+ return $below;
1205
  }
1206
 
1207
+ function addthis_display_social_widget($content, $filtered = true, $below_excerpt = false)
1208
+ {
1209
+ global $addthis_styles, $addthis_new_styles, $post;
1210
+ global $addThisConfigs;
1211
 
1212
+ $styles = array_merge($addthis_styles, $addthis_new_styles);
1213
+ $options = $addThisConfigs->getConfigs();
 
1214
 
1215
+ $templateType = _addthis_determine_template_type();
 
1216
 
1217
+ // get configs for this template type
1218
+ if (is_string($templateType)) {
1219
+ $fieldList = $addThisConfigs->getFieldsForContentTypeSharingLocations($templateType);
1220
+ foreach ($fieldList as $key => $field) {
1221
+ $fieldList[$field['location']] = $field;
1222
+ unset($fieldList[$key]);
1223
+ }
1224
 
1225
+ $aboveFieldName = $fieldList['above']['fieldName'];
1226
+ $belowFieldName = $fieldList['below']['fieldName'];
1227
+ $displayAbove = (isset($options[$aboveFieldName]) && $options[$aboveFieldName] == true ) ? true : false;
1228
+ $displayBelow = (isset($options[$belowFieldName]) && $options[$belowFieldName] == true ) ? true : false;
1229
+ } else {
1230
+ $displayAbove = false;
1231
+ $displayBelow = false;
1232
+ }
1233
 
1234
+ if ( $templateType === 'home' ) {
1235
+ $templateIsAnExcerpt = (boolean)(strpos($post->post_content, '<!--more-->') != false);
1236
+ if ($templateIsAnExcerpt) {
1237
+ if ($displayAbove && !_addthis_excerpt_buttons_enabled_above()) {
1238
+ $displayAbove = false;
1239
+ }
1240
 
1241
+ if ($displayBelow && !_addthis_excerpt_buttons_enabled_below()) {
1242
+ $displayBelow = false;
1243
+ }
1244
+ }
1245
+ }
1246
 
1247
+ $custom_fields = get_post_custom($post->ID);
1248
+ if ( isset($custom_fields['addthis_exclude'])
1249
+ && $custom_fields['addthis_exclude'][0] == 'true'
1250
+ ) {
1251
+ $displayAbove = false;
1252
+ $displayBelow = false;
1253
+ }
1254
 
1255
+ $displayAbove = apply_filters('addthis_post_exclude', $displayAbove);
1256
+ $displayBelow = apply_filters('addthis_post_exclude', $displayBelow);
1257
+
1258
+ remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
1259
+ remove_filter('get_the_excerpt', 'addthis_late_widget');
1260
+ $url = get_permalink();
1261
+ $title = get_the_title();
1262
+ $url_above = "addthis:url='$url' ";
1263
+ $url_above .= "addthis:title='". esc_attr( $title) ." '";
1264
+ $url_below = "addthis:url='$url' ";
1265
+ $url_below .= "addthis:title='". esc_attr( $title) ." '";
1266
+
1267
+ // Still here? Well let's add some social goodness
1268
+ if ( isset($options['above'])
1269
+ && $options['above'] != 'none'
1270
+ && $options['above'] != 'disable'
1271
+ && $displayAbove
1272
+ ) {
1273
+ $above = addthis_display_widget_above($styles, $url, $title, $options);
1274
+ } elseif ($displayAbove) {
1275
+ $above = apply_filters('addthis_above_content', '');
1276
+ } else {
1277
+ $above = '';
1278
+ }
1279
 
1280
+ if ( isset($options['below'])
1281
+ && $options['below'] != 'none'
1282
+ && $options['below'] != 'disable'
1283
+ && $displayBelow
1284
+ && ! $below_excerpt
1285
+ ) {
1286
+ $below = addthis_display_widget_below($styles, $url, $title, $options);
1287
+ } elseif ( $below_excerpt
1288
+ && $displayBelow
1289
+ && $options['below'] != 'none'
1290
+ ) {
1291
+ $below = apply_filters('addthis_below_content','' );
1292
+
1293
+
1294
+ if (_addthis_excerpt_buttons_enabled()) {
1295
+ add_filter('get_the_excerpt', 'addthis_late_widget', 14);
1296
+ }
1297
+ } elseif ($displayBelow) {
1298
+ $below = apply_filters('addthis_below_content', '');
1299
+ } else {
1300
+ $below = '';
1301
+ }
1302
 
1303
+ $at_flag = get_post_meta( $post->ID, '_at_widget', TRUE );
1304
+ if ($at_flag !== '0') {
1305
+ if ($displayAbove && isset($above)) {
1306
+ $content = sprintf($above, $url_above) . $content;
1307
+ }
1308
+ if ($displayBelow && isset($below)) {
1309
+ $content = $content . sprintf($below, $url_below);
1310
+ }
1311
+ }
1312
 
1313
+ if (($displayAbove || $displayBelow) && $filtered) {
1314
+ add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11, 2);
1315
+ }
1316
 
1317
+ return $content;
1318
+ }
 
 
 
 
 
 
1319
 
1320
+ add_action('wp_head', 'addthis_register_script_in_addjs', 20);
1321
 
1322
+ function addthis_register_script_in_addjs(){
1323
+ global $addthis_addjs;
1324
+ $script = addthis_output_script(true, true);
1325
+ $addthis_addjs->addToScript($script);
1326
 
1327
+ $addthis_sidebar = addthis_sidebar_script();
1328
+ $addthis_addjs->addAfterScript($addthis_sidebar);
1329
+ }
1330
 
1331
+ //add_action('wp_footer', 'addthis_output_script');
 
1332
 
1333
+ /**
1334
+ * Check to see if our Javascript has been outputted yet. If it hasn't, return it. Else, return false.
1335
+ *
1336
+ * @return mixed
1337
+ */
1338
+ function addthis_output_script($return = false, $justConfig = false )
1339
+ {
1340
+ global $addThisConfigs;
1341
+ $options = $addThisConfigs->getConfigs();
1342
 
1343
+ $script = "\n<!-- AddThis Button Begin -->\n"
1344
+ .'<script type="text/javascript">'
1345
+ ."var addthis_product = '".ADDTHIS_PRODUCT_VERSION."';\n";
 
 
1346
 
 
 
 
 
 
 
 
 
 
 
1347
 
1348
+ $pub = $options['addthis_profile'];
1349
+ if (empty($options['addthis_profile'])) {
1350
+ $pub = 'wp-'.cuid();
1351
+ }
1352
+ $pub = urlencode($pub);
1353
 
1354
+ $addthis_config = array();
1355
+ $addthis_share = array();
1356
 
1357
+ $addthis_config["data_track_clickback"] = (isset($options['addthis_append_data']) && $options['addthis_append_data'] == true);
 
 
 
 
 
 
 
1358
 
1359
+ if ( isset($options['data_ga_property']) ){
1360
+ $addthis_config['data_ga_property'] = $options['data_ga_property'];
1361
+ $addthis_config['data_ga_social'] = true;
1362
+ }
 
 
 
1363
 
1364
+ $addthis_config["data_track_addressbar"] = (isset($options['addthis_addressbar']) && $options['addthis_addressbar'] == true);
 
 
1365
 
1366
+ if ( isset($options['addthis_language']) && strlen($options['addthis_language']) == 2)
1367
+ $addthis_config['ui_language'] = $options['addthis_language'];
1368
 
1369
+ if ( isset($options['atversion']))
1370
+ $addthis_config['ui_atversion'] = isset($options['atversion_update_status']) && $options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $options['atversion'] : ADDTHIS_ATVERSION;
 
 
1371
 
1372
+ if ( isset($options['addthis_header_background']) )
1373
+ $addthis_config['ui_header_background'] = $options['addthis_header_background'];
1374
 
1375
+ if ( isset($options['addthis_header_color']) )
1376
+ $addthis_config['ui_header_color'] = $options['addthis_header_color'];
1377
 
1378
+ if ( isset($options['addthis_brand']) )
1379
+ $addthis_config['ui_cobrand'] = $options['addthis_brand'];
1380
 
1381
+ if (isset($options['addthis_508']) && $options['addthis_508'] == true)
1382
+ $addthis_config['ui_508_compliant'] = true;
 
1383
 
1384
+ $addthis_config = apply_filters('addthis_config_js_var', $addthis_config);
1385
+ $addthis_config_json = array_key_exists('addthis_config_json', $options) ? $options['addthis_config_json'] : '';
1386
+ $script = merge_config_with_json_config($script, $addthis_config, $addthis_config_json);
1387
 
1388
+ if (isset($options['addthis_twitter_template'])){
1389
+ //The following twitter template translation is deprecated and replaced with via
1390
+ //$addthis_share['templates']['twitter'] = esc_js($options['addthis_twitter_template']);
1391
+ $addthis_share['passthrough']['twitter']['via'] = esc_js(get_first_twitter_username($options['addthis_twitter_template']));
 
 
 
1392
 
 
 
 
 
1393
  }
1394
+ if (isset($options['addthis_bitly']) && $options['addthis_bitly']) {
1395
+ $addthis_share['url_transforms']['shorten']['twitter'] = 'bitly';
1396
+ $addthis_share['shorteners']['bitly'] = new stdClass();
1397
+ }
1398
+
1399
+ if ($justConfig)
1400
  {
1401
+ $return = '';
1402
+ $share = apply_filters('addthis_share_js_var', $addthis_share );
1403
+ if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '') {
1404
+ $addthis_json_share = array_key_exists('addthis_share_json', $options) ? $options['addthis_share_json'] : '';
1405
+ $return .= merge_share_with_json_share($addthis_share, $addthis_json_share);
1406
+ }
1407
+ else
1408
+ {
1409
+ if (! empty($share) )
1410
+ $return .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1411
  }
1412
+ $return .= "\n";
1413
+
1414
+ $return = merge_config_with_json_config($return, $addthis_config, $addthis_config_json);
1415
+
1416
+ $return .= "\n";
1417
+
1418
+ if( isset($options['addthis_plugin_controls'])
1419
+ && $options['addthis_plugin_controls'] != "AddThis"
1420
+ ) {
1421
+ $return .= "addthis_config.ignore_server_config = true;";
1422
+ $return .= "\n";
1423
+ }
1424
+
1425
+ return $return;
1426
  }
 
 
 
 
 
 
 
 
 
1427
 
1428
 
1429
+ if ( isset( $options['addthis_share_json'] ) && $options['addthis_share_json'] != '')
1430
+ $script .= merge_share_with_json_share($addthis_share, $addthis_json_share);
1431
+ else
1432
+ $script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
1433
+ $script .= '</script>';
 
1434
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1435
 
1436
+ $script .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#pubid='.$pub.'"></script>';
 
1437
 
1438
+
1439
+ if ( ! is_admin() && ! is_feed() )
1440
+ echo $script;
1441
+ elseif ($return == true && ! is_admin() && ! is_feed() )
1442
+ return $script;
 
 
 
 
 
 
 
 
 
 
 
 
 
1443
  }
 
1444
 
1445
+ function addthis_sidebar_script(){
1446
+ global $addThisConfigs;
1447
+ $options = $addThisConfigs->getConfigs();
1448
+ $return = '';
1449
 
1450
+ if ($options['addthis_sidebar_enabled'] != true) {
1451
+ return $return;
1452
+ }
1453
 
1454
+ $templateType = _addthis_determine_template_type();
1455
 
1456
+ if (is_string($templateType)) {
1457
+ $fieldList = $addThisConfigs->getFieldsForContentTypeSharingLocations($templateType, 'sidebar');
1458
+ $fieldName = $fieldList[0]['fieldName'];
1459
+ $display = (isset($options[$fieldName]) && $options[$fieldName]) ? true : false;
1460
+ } else {
1461
+ echo "templateType wasn't a string :-( <br />\n";
1462
+ $display = false;
1463
+ }
1464
+
1465
+ if (!$display) {
1466
+ return $return;
1467
+ }
1468
+
1469
+ $return .= "
1470
+ (function() {
1471
+ var at_interval = setInterval(function () {
1472
+ if(window.addthis) {
1473
+ clearInterval(at_interval);
1474
+ addthis.layers(
1475
+ {
1476
+ 'theme' : '".strtolower($options['addthis_sidebar_theme'])."',
1477
+ 'share' : {
1478
+ 'position' : '".$options['addthis_sidebar_position']."',
1479
+ 'numPreferredServices' : ".$options['addthis_sidebar_count']."
1480
+ }
1481
+ }
1482
+ );
1483
+ }
1484
+ },1000)
1485
+ }());";
1486
+
1487
+ return $return;
1488
+ }
1489
 
1490
+ /*
1491
+ * Merge the AddThis settings with that given using JSON format
1492
+ * @param String $appendString - The string to build and return the script
1493
+ * @param array $addthis_config - The setting array for AddThis config
1494
+ * @param String $addthis_json_config - The JSON String
1495
+ * @return String $appendString - The string to build and return the script
1496
+ */
1497
+ function merge_config_with_json_config($append_string, $addthis_config, $addthis_json_config) {
1498
+ if ( isset( $addthis_json_config ) && trim($addthis_json_config) != '') {
1499
+ $addthis_config_json_list = json_decode($addthis_json_config, true);
1500
+ if (! empty ($addthis_config_json_list) && ! empty ($addthis_config)) {
1501
+ foreach($addthis_config_json_list as $key_json => $json_config_value) {
1502
+ $addthis_config[$key_json] = $json_config_value;
1503
+ }
1504
  }
1505
+ }
1506
+ if (! empty ($addthis_config) )
1507
+ $append_string .= 'var addthis_config = '. json_encode($addthis_config) .';';
1508
+ return $append_string;
1509
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1510
 
1511
+ /*
1512
+ * Merge the AddThis settings with that given using JSON format
1513
+ * @param String $appendString - The string to build and return the script
1514
+ * @param array $addthis_share - The setting array for AddThis share
1515
+ * @param String $addthis_json_share - The JSON String
1516
+ * @return String $appendString - The string to build and return the script
1517
+ */
1518
+ function merge_share_with_json_share($addthis_share, $addthis_json_share) {
1519
+ $append_string = '';
1520
+ if ( isset( $addthis_json_share ) && trim($addthis_json_share) != '') {
1521
+ $addthis_share_json_list = json_decode($addthis_json_share, true);
1522
+ if (! empty ($addthis_share_json_list) && ! empty ($addthis_share)) {
1523
+ foreach($addthis_share_json_list as $key_json => $json_share_value) {
1524
+ $addthis_share[$key_json] = $json_share_value;
1525
+ }
1526
  }
 
 
 
 
 
 
 
 
 
1527
  }
1528
+ if (! empty ($addthis_share) )
1529
+ $append_string = 'if (typeof(addthis_share) == "undefined"){ addthis_share = '. json_encode($addthis_share) .';}';
1530
+ return $append_string;
1531
+ }
 
 
 
 
 
 
 
 
 
1532
 
1533
+ /**
1534
+ * Appends AddThis button to post content.
1535
+ */
1536
+ function addthis_social_widget($content, $onSidebar = false, $url = null, $title = null)
1537
+ {
1538
+ addthis_set_addthis_settings();
1539
+ global $addthis_settings;
1540
 
1541
+ // add nothing to RSS feed or search results; control adding to static/archive/category pages
1542
+ if (!$onSidebar)
1543
+ {
1544
+ if ( $addthis_settings['sidebar_only']
1545
+ || is_feed()
1546
+ || is_search()
1547
+ || is_home()
1548
+ || is_page()
1549
+ || is_archive()
1550
+ || is_category()
1551
+ ) {
1552
+ return $content;
1553
+ }
1554
+ }
1555
 
1556
+ $pub = $addthis_settings['addthis_profile'];
1557
+ if (!$pub) {
1558
+ $pub = 'wp-'.cuid();
1559
+ }
1560
+ $pub = urlencode($pub);
1561
 
1562
+ $link = !is_null($url) ? $url : ($onSidebar ? get_bloginfo('url') : get_permalink());
1563
+ $title = !is_null($title) ? $title : ($onSidebar ? get_bloginfo('title') : the_title('', '', false));
 
 
1564
 
1565
+ $content .= "\n<!-- AddThis Button BEGIN -->\n"
1566
+ .'<script type="text/javascript">'
1567
+ ."\n//<!--\n"
1568
+ ."var addthis_product = '".ADDTHIS_PRODUCT_VERSION."';\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1569
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1570
 
1571
+ if (strlen($addthis_settings['customization']))
 
 
 
1572
  {
1573
+ $content .= ($addthis_settings['customization']) . "\n";
1574
+ }
1575
 
1576
+ if ($addthis_settings['menu_type'] === 'dropdown')
1577
+ {
1578
+ $content .= <<<EOF
1579
+ //-->
1580
+ </script>
1581
+ <div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" class="addthis_button" addthis:url="$link" addthis:title="$title">
1582
+ EOF;
1583
+ $content .= ($addthis_settings['language'] == '' ? '' /* no hardcoded image -- we'll choose the language automatically */ : addthis_get_button_img()) . '</a><script type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
1584
  }
1585
+ else if ($addthis_settings['menu_type'] === 'toolbox')
1586
  {
1587
+ $content .= "\n//-->\n</script>\n";
1588
+ $content .= <<<EOF
1589
+ <div class="addthis_container addthis_toolbox addthis_default_style" addthis:url="$link" addthis:title="$title"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span>
1590
+ EOF;
1591
+ $content .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
1592
  }
1593
+ else
1594
+ {
1595
+ $link = urlencode($link);
1596
+ $title = urlencode($title);
1597
+ $content .= <<<EOF
1598
+ //-->
1599
+ </script>
1600
+ <div class="addthis_container"><a href="//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub" onclick="window.open('//www.addthis.com/bookmark.php?v='.$atversion.'&amp;username=$pub&amp;url=$link&amp;title=$title', 'ext_addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank">
1601
+ EOF;
1602
+ $content .= addthis_get_button_img() . '</a></div>';
1603
+ }
1604
+ $content .= "\n<!-- AddThis Button END -->";
1605
+
1606
+ return $content;
1607
  }
 
 
1608
 
1609
+ /**
1610
+ * Generates img tag for share/bookmark button.
1611
+ */
1612
+ function addthis_get_button_img( $btnStyle = false )
1613
+ {
1614
+ global $addthis_settings;
1615
+ global $addthis_styles;
1616
+ global $addThisConfigs;
1617
+ $options = $addThisConfigs->getConfigs();
1618
 
1619
+ $language = $options['language'];
1620
 
1621
+ if ($btnStyle == false)
1622
+ $btnStyle = $addthis_settings['style'];
1623
+ if ($addthis_settings['language'] != 'en')
1624
+ {
1625
+ // We use a translation of the word 'share' for all verbal buttons
1626
+ switch ($btnStyle)
1627
+ {
1628
+ case 'bookmark':
1629
+ case 'addthis':
1630
+ case 'bookmark-sm':
1631
+ $btnStyle = 'share';
1632
+ }
1633
+ }
1634
 
1635
+ if (!isset($addthis_styles[$btnStyle])) $btnStyle = 'share';
1636
+ $btnRecord = $addthis_styles[$btnStyle];
1637
+ $btnUrl = (strpos(trim($btnRecord['img']), '//') !== 0 ? "//s7.addthis.com/static/btn/v2/" : "") . $btnRecord['img'];
1638
+
1639
+ if (strpos($btnUrl, '%lang%') !== false)
1640
+ {
1641
+ $btnUrl = str_replace('%lang%', strlen($language) ? $language : 'en', $btnUrl);
1642
+ }
1643
+ $btnWidth = $btnRecord['w'];
1644
+ $btnHeight = $btnRecord['h'];
1645
+ return <<<EOF
1646
+ <img src="$btnUrl" width="$btnWidth" height="$btnHeight" style="border:0" alt="Bookmark and Share"/>
1647
+ EOF;
1648
+ }
1649
 
1650
+ function addthis_options_page_scripts()
1651
+ {
1652
+ $jsRootUrl = _addthis_js_location_base();
1653
+ $imgRootUrl = _addthis_image_location_base();
1654
+
1655
+ if ( addthis_get_wp_version() >= 3.2
1656
+ || apply_filters('at_assume_latest', __return_false() )
1657
+ || apply_filters('addthis_assume_latest', __return_false() )
1658
+ ) {
1659
+ $optionsJsUrl = $jsRootUrl . 'options-page.32.js';
1660
+ } else {
1661
+ $optionsJsUrl = $jsRootUrl . 'options-page.js';
1662
+ }
1663
 
1664
+ wp_enqueue_script(
1665
+ 'addthis_options_page_script',
1666
+ $optionsJsUrl,
1667
+ array('jquery-ui-tabs', 'thickbox')
1668
+ );
1669
+ wp_enqueue_script('addthis_core', $jsRootUrl . 'core-1.1.1.js');
1670
+ wp_enqueue_script('addthis_lr', $jsRootUrl . 'lr.js');
1671
+ wp_enqueue_script('addthis_qtip_script', $jsRootUrl . 'jquery.qtip.min.js');
1672
+ wp_enqueue_script('addthis_ui_script', $jsRootUrl . 'jqueryui.sortable.js');
1673
+ wp_enqueue_script('addthis_selectbox', $jsRootUrl . 'jquery.selectBoxIt.min.js');
1674
+ wp_enqueue_script('', $jsRootUrl . 'jquery.messagebox.js');
1675
+ wp_enqueue_script('', $jsRootUrl . 'jquery.atjax.js');
1676
+ wp_enqueue_script('addthis_lodash_script', $jsRootUrl . 'lodash-0.10.0.js');
1677
+ wp_enqueue_script('addthis_services_script', $jsRootUrl . 'gtc-sharing-personalize.js');
1678
+ wp_enqueue_script('addthis_service_script', $jsRootUrl . 'gtc.cover.js');
1679
+ wp_localize_script(
1680
+ 'addthis_services_script',
1681
+ 'addthis_params',
1682
+ array('img_base' => $imgRootUrl)
1683
+ );
1684
+ wp_localize_script(
1685
+ 'addthis_options_page_script',
1686
+ 'addthis_option_params',
1687
+ array('wp_ajax_url'=> admin_url('admin-ajax.php'),
1688
+ 'addthis_validate_action' => 'validate_addthis_api_credentials',
1689
+ 'img_base' => $imgRootUrl)
1690
+ );
1691
+ }
1692
 
1693
+ function addthis_options_page_style()
1694
+ {
1695
+ $cssRootUrl = _addthis_css_location_base();
1696
+ wp_enqueue_style('addthis_options_page_style', $cssRootUrl . 'options-page.css');
1697
+ wp_enqueue_style('addthis_general_style', $cssRootUrl . 'style.css');
1698
+ wp_enqueue_style('thickbox');
1699
+ wp_enqueue_style('addthis_services_style', $cssRootUrl . 'gtc.sharing-personalize.css');
1700
+ wp_enqueue_style('addthis_bootstrap_style', $cssRootUrl . 'bootstrap.css');
1701
+ wp_enqueue_style('addthis_widget', 'https://ct1.addthis.com/static/r07/widget114.css');
1702
+ wp_enqueue_style('addthis_widget_big', 'https://ct1.addthis.com/static/r07/widgetbig056.css');
1703
+ }
1704
 
1705
+ function addthis_admin_menu()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1706
  {
1707
+ $addthis = add_options_page('AddThis Plugin Options', 'AddThis Sharing Buttons', 'manage_options', basename(__FILE__), 'addthis_plugin_options_php4');
1708
+ add_action('admin_print_scripts-' . $addthis, 'addthis_options_page_scripts');
1709
+ add_action('admin_print_styles-' . $addthis, 'addthis_options_page_style');
1710
+ }
 
 
 
 
 
 
 
 
1711
 
1712
+ function addthis_plugin_options_php4() {
1713
+ global $current_user;
1714
+ $user_id = $current_user->ID;
1715
+ global $addThisConfigs;
1716
+ $options = $addThisConfigs->getConfigs();
1717
+
1718
+ if (get_user_meta($user_id, 'addthis_nag_updated_options') )
1719
+ delete_user_meta($user_id, 'addthis_nag_updated_options', 'true');
1720
+
1721
+ ?>
1722
+ <div class="wrap">
1723
+ <h2 class='placeholder'>&nbsp;</h2>
1724
+
1725
+ <form id="addthis_settings" method="post" action="options.php">
1726
+ <?php
1727
+ // use the old-school settings style in older versions of wordpress
1728
+ if ( addthis_get_wp_version() >= 2.7
1729
+ || apply_filters('at_assume_latest', __return_false() )
1730
+ || apply_filters('addthis_assume_latest', __return_false() )
1731
+ ) {
1732
+ settings_fields('addthis');
1733
+ } else {
1734
+ wp_nonce_field('update-options');
1735
+ }
1736
+ ?>
1737
 
1738
+ <div class="Header">
1739
+ <h1><em>AddThis</em> Sharing Buttons</h1>
 
1740
 
1741
+ <span class="preview-save-btns">
1742
+ <?php echo _addthis_settings_buttons(); ?>
1743
+ </span>
1744
+ </div>
1745
 
1746
+ <?php
1747
+ if (_addthis_is_csr_form()) {
1748
+ // Get Confirmation form
1749
+ echo addthis_profile_id_csr_confirmation();
1750
+ } else {
1751
+ addthis_wordpress_mode_tabs();
1752
+ }
1753
+ ?>
1754
+
1755
+ <div class="Btn-container-end">
1756
+ <?php echo _addthis_settings_buttons(); ?>
1757
+ </div>
1758
 
1759
+ </form>
1760
+ </div>
1761
+ <?php
1762
  }
1763
+ add_action('init', 'addthis_init');
1764
 
1765
+ function addthis_wordpress_mode_tabs() {
1766
+ global $addthis_styles;
1767
+ global $addthis_languages;
1768
+ global $addThisConfigs;
1769
+ $options = $addThisConfigs->getConfigs();
1770
 
1771
+ $version_notification_content = _addthis_version_notification(
1772
+ $options['atversion_update_status'],
1773
+ $options['atversion']
1774
+ );
 
 
1775
 
1776
+ ?>
1777
+ <div class="Main-content" id="tabs">
1778
+ <ul class="Tabbed-nav">
1779
+ <li class="Tabbed-nav-item"><a href="#tabs-1">Sharing Tools</a></li>
1780
+ <li class="Tabbed-nav-item"><a href="#tabs-2">Advanced Options</a></li>
1781
+ </ul>
1782
+
1783
+ <div id="tabs-1">
1784
+ <?php echo $version_notification_content; ?>
1785
+ <input
1786
+ type="hidden"
1787
+ value="<?php echo $options['atversion']?>"
1788
+ name="addthis_settings[atversion]"
1789
+ id="addthis_atversion_hidden" />
1790
+ <input
1791
+ type="hidden"
1792
+ value="<?php echo $options['atversion_update_status']?>"
1793
+ name="addthis_settings[atversion_update_status]"
1794
+ id="addthis_atversion_update_status" />
1795
+ <input
1796
+ type="hidden"
1797
+ value="<?php echo $options['credential_validation_status']?>"
1798
+ name="addthis_settings[credential_validation_status]"
1799
+ id="addthis_credential_validation_status" />
1800
+
1801
+ <div class="Card" id="Card-above-post">
1802
+ <div class="Card-hd">
1803
+ <div class="at-tool-toggle">
1804
+ <input
1805
+ type="checkbox"
1806
+ value="true"
1807
+ name="addthis_settings[addthis_above_enabled]"
1808
+ class="addthis-toggle-cb"
1809
+ id="addthis_above_enabled"
1810
+ style="display:none;" <?php echo ( $options['addthis_above_enabled'] != false ? 'checked="checked"' : ''); ?>/>
1811
+ <div
1812
+ id="addthis_above_enabled_switch"
1813
+ class="switch <?php echo ( $options['addthis_above_enabled'] != false ? 'switchOn' : ''); ?>">
1814
+ </div>
1815
+ </div>
1816
+ <h3 class="Card-hd-title">Sharing Buttons Above Content</h3>
1817
+ <ul class="Tabbed-nav">
1818
+ <li class="Tabbed-nav-item"><a href="#top-1">Style</a></li>
1819
+ <li class="Tabbed-nav-item"><a href="#top-2">Options</a></li>
1820
+ </ul>
1821
+ </div>
1822
+ <div class="addthis_above_enabled_overlay" >
1823
+ <div class="Card-bd">
1824
+ <div id="top-1">
1825
+ <?php _addthis_choose_icons('above', $options ); ?>
1826
+ </div>
1827
+ <div id="top-2">
1828
+ <?php _addthis_print_template_checkboxes('above') ?>
1829
+ </div>
1830
+ </div>
1831
+ </div>
1832
+ </div>
1833
 
 
 
 
 
 
1834
 
1835
+ <div class="Card" id="Card-below-post">
1836
+ <div class="Card-hd">
1837
+ <div class="at-tool-toggle">
1838
+ <input
1839
+ type="checkbox"
1840
+ value="true"
1841
+ name="addthis_settings[addthis_below_enabled]"
1842
+ class="addthis-toggle-cb"
1843
+ id="addthis_below_enabled"
1844
+ style="display:none;" <?php echo ( $options['addthis_below_enabled'] != false ? 'checked="checked"' : ''); ?>/>
1845
+ <div
1846
+ id="addthis_below_enabled_switch"
1847
+ class="switch <?php echo ( $options['addthis_below_enabled'] != false ? 'switchOn' : ''); ?>">
1848
+ </div>
1849
+ </div>
1850
+ <h3 class="Card-hd-title">Sharing Buttons Below Content</h3>
1851
+ <ul class="Tabbed-nav">
1852
+ <li class="Tabbed-nav-item"><a href="#bottom-1">Style</a></li>
1853
+ <li class="Tabbed-nav-item"><a href="#bottom-2">Options</a></li>
1854
+ </ul>
1855
+ </div>
1856
+ <div class="addthis_below_enabled_overlay">
1857
+ <div class="Card-bd">
1858
+ <div id="bottom-1">
1859
+ <?php _addthis_choose_icons('below', $options ); ?>
1860
+ </div>
1861
+ <div id="bottom-2">
1862
+ <?php _addthis_print_template_checkboxes('below') ?>
1863
+ </div>
1864
+ </div>
1865
+ </div>
1866
+ </div>
1867
+
1868
+
1869
+ <div class="Card" id="Card-side-sharing">
1870
+ <div class="Card-hd">
1871
+ <div class="at-tool-toggle">
1872
+ <input
1873
+ type="checkbox"
1874
+ value="true"
1875
+ name="addthis_settings[addthis_sidebar_enabled]"
1876
+ class="addthis-toggle-cb" id="addthis_sidebar_enabled"
1877
+ style="display:none;" <?php echo ( $options['addthis_sidebar_enabled'] != false ? 'checked="checked"' : ''); ?>/>
1878
+ <div
1879
+ id="addthis_sidebar_enabled_switch"
1880
+ class="switch <?php echo ( $options['addthis_sidebar_enabled'] != false ? 'switchOn' : ''); ?>">
1881
+ </div>
1882
+ </div>
1883
+ <h3 class="Card-hd-title">Sharing Sidebar</h3>
1884
+ <ul class="Tabbed-nav">
1885
+ <li class="Tabbed-nav-item"><a href="#side-1">Style</a></li>
1886
+ <li class="Tabbed-nav-item"><a href="#side-2">Options</a></li>
1887
+ </ul>
1888
+ </div>
1889
+ <div class="addthis_sidebar_enabled_overlay">
1890
+ <div class="Card-bd">
1891
+ <div id="side-1">
1892
+ <p>These buttons will appear on the side of the page, along the edge.</p>
1893
+ <img src="<?php echo _addthis_image_location_base() . 'sidebar_theme_light.png'; ?>" />
1894
+ <ul>
1895
+ <li>
1896
+ <strong>Position</strong><br />
1897
+ <label for="addthis_sidebar_position">Left</label>
1898
+ <input
1899
+ type="radio"
1900
+ id="addthis_sidebar_position"
1901
+ name="addthis_settings[addthis_sidebar_position]"
1902
+ value="left" <?php echo ( $options['addthis_sidebar_position'] == 'left' ? 'checked="checked"' : ''); ?>/>
1903
+ <br />
1904
+ <label for="addthis_sidebar_position">Right</label>
1905
+ <input
1906
+ type="radio"
1907
+ id="addthis_sidebar_position"
1908
+ name="addthis_settings[addthis_sidebar_position]"
1909
+ value="right" <?php echo ( $options['addthis_sidebar_position'] == 'right' ? 'checked="checked"' : ''); ?>/></td>
1910
+ </li>
1911
+ </ul>
1912
+ </div>
1913
+ <div id="side-2">
1914
+ <?php _addthis_print_template_checkboxes('sidebar') ?>
1915
+ <ul>
1916
+ <li>
1917
+ <label for="addthis_sidebar_count">
1918
+ <strong>Buttons</strong>
1919
+ <span class="at-wp-tooltip" tooltip="The number of social sharing buttons to show in the side sharing tool.">&quest;</span>
1920
+ </label>
1921
+ <select id="addthis_sidebar_count" name="addthis_settings[addthis_sidebar_count]">
1922
+ <?php
1923
+ for($i=1;$i<7;$i++){
1924
+ echo '<option value="'.$i.'"'.($options['addthis_sidebar_count'] == $i? " selected='selected'":"").'>'.$i.'</option>';
1925
+ }
1926
+ ?>
1927
+ </select>
1928
+ </li>
1929
+ <li>
1930
+ <label for="addthis_sidebar_theme">
1931
+ <strong>Theme</strong>
1932
+ <span class="at-wp-tooltip" tooltip="You can select the background color that better matches the look of your site for the expand/minimize arrow on the side sharing tool.">&quest;</span>
1933
+ </label>
1934
+ <select id="addthis_sidebar_theme" name="addthis_settings[addthis_sidebar_theme]">
1935
+ <?php
1936
+ $themes = array("Transparent","Light","Gray","Dark");
1937
+ foreach ($themes as $theme) {
1938
+ echo '<option value="'.$theme.'"'.($options['addthis_sidebar_theme'] == $theme ? " selected='selected'":"").'>'.$theme.'</option>';
1939
+ }
1940
+ ?>
1941
+ </select>
1942
+ <br />
1943
+ <img src="<?php echo _addthis_image_location_base() . 'sidebar_theme_light.png'; ?>" id="sbpreview_Light"/>
1944
+ <img src="<?php echo _addthis_image_location_base() . 'sidebar_theme_gray.png'; ?>" id="sbpreview_Gray"/>
1945
+ <img src="<?php echo _addthis_image_location_base() . 'sidebar_theme_dark.png'; ?>" id="sbpreview_Dark"/>
1946
+ <img src="<?php echo _addthis_image_location_base() . 'sidebar_theme_light.png'; ?>" id="sbpreview_Transparent"/>
1947
+ </li>
1948
+ </ul>
1949
+ </div>
1950
+ </div>
1951
+ </div>
1952
+ </div>
1953
+ </div>
1954
+ <div id="tabs-2">
1955
+ <?php echo $version_notification_content?>
1956
+
1957
+ <div class="Card">
1958
+ <div class="Card-hd">
1959
+ <h3 class="Card-hd-title">Tracking</h3>
1960
+ </div>
1961
+ <div class="Card-bd">
1962
+ <ul class="Card-option-list">
1963
+ <li>
1964
+ <ul>
1965
+ <li>
1966
+ <input
1967
+ id="addthis_append_data"
1968
+ type="checkbox"
1969
+ name="addthis_settings[addthis_append_data]"
1970
+ value="true" <?php echo $options['addthis_append_data'] == true ? 'checked="checked"' : ''; ?>/>
1971
+ <label for="addthis_append_data">
1972
+ <strong><?php _e("Clickbacks", 'addthis_trans_domain' ); ?></strong> (Recommended)
1973
+ </label>
1974
+ <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.">&quest;</span>
1975
+ </li>
1976
+ <li>
1977
+ <input
1978
+ type="checkbox"
1979
+ id="addthis_addressbar"
1980
+ name="addthis_settings[addthis_addressbar]"
1981
+ value="true" <?php echo ($options['addthis_addressbar'] == true ? 'checked="checked"' : ''); ?>/>
1982
+ <label for="addthis_addressbar">
1983
+ <strong><?php _e("Address bar shares", 'addthis_trans_domain' ); ?></strong>
1984
+ </label>
1985
+ <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.">&quest;</span>
1986
+ </li>
1987
+ <li>
1988
+ <input
1989
+ id="addthis_bitly"
1990
+ type="checkbox"
1991
+ name="addthis_settings[addthis_bitly]"
1992
+ value="true" <?php echo ($options['addthis_bitly'] == true ? 'checked="checked"' : ''); ?>/>
1993
+ <label for="addthis_bitly">
1994
+ <strong><?php _e("Bitly URL shortening for Twitter", 'addthis_trans_domain' ); ?></strong>
1995
+ </label>
1996
+ <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.">&quest;</span>
1997
+ </li>
1998
+ </ul>
1999
+ </li>
2000
+ <li>
2001
+ <label for="data_ga_property">
2002
+ <strong><?php _e("Google Analytics property ID", 'addthis_trans_domain' ); ?></strong>
2003
+ </label>
2004
+ <input
2005
+ id="data_ga_property"
2006
+ type="text"
2007
+ name="addthis_settings[data_ga_property]"
2008
+ value="<?php echo $options['data_ga_property'] ?>"/>
2009
+ </li>
2010
+ </ul>
2011
+ </div>
2012
+ </div>
2013
+
2014
+ <div class="Card">
2015
+ <div class="Card-hd">
2016
+ <h3 class="Card-hd-title">Display Options</h3>
2017
+ </div>
2018
+ <div class="Card-bd">
2019
+ <ul class="Card-option-list">
2020
+ <li>
2021
+ <ul>
2022
+ <li>
2023
+ <input
2024
+ id="addthis_asynchronous_loading"
2025
+ type="checkbox"
2026
+ name="addthis_settings[addthis_asynchronous_loading]"
2027
+ value="true" <?php echo ($options['addthis_asynchronous_loading'] == true ? 'checked="checked"' : ''); ?>/>
2028
+ <label for="addthis_asynchronous_loading">
2029
+ <strong><?php _e("Asynchronous loading", 'addthis_trans_domain' ); ?></strong> (Recommended)
2030
+ </label>
2031
+ <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.">&quest;</span>
2032
+ </li>
2033
+ <li>
2034
+ <input
2035
+ id="addthis_508"
2036
+ type="checkbox"
2037
+ name="addthis_settings[addthis_508]" v
2038
+ alue="true" <?php echo ($options['addthis_508'] == true ? 'checked="checked"' : ''); ?>/>
2039
+ <label for="addthis_508">
2040
+ <strong><?php _e("Enhanced accessibility", 'addthis_trans_domain' ); ?></strong>
2041
+ </label>
2042
+ <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.">&quest;</span>
2043
+ </li>
2044
+ </ul>
2045
+ </li>
2046
+ <li>
2047
+ <label id="addthis_twitter_template">
2048
+ <strong><?php _e("Twitter via", 'addthis_trans_domain' ); ?></strong>
2049
+ <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.">&quest;</span>
2050
+ </label>
2051
+ <input
2052
+ id="addthis_twitter_template"
2053
+ type="text"
2054
+ name="addthis_settings[addthis_twitter_template]"
2055
+ value="<?php echo get_first_twitter_username($options['addthis_twitter_template']) ; ?>" />
2056
+ </li>
2057
+ </ul>
2058
+ </div>
2059
+ </div>
2060
+
2061
+ <div class="Card">
2062
+ <div class="Card-hd">
2063
+ <h3 class="Card-hd-title">Additional Options</h3>
2064
+ </div>
2065
+ <div class="Card-bd">
2066
+ <ul class="Card-option-list">
2067
+ <li>
2068
+ <p class="Card-description">
2069
+ For more details on the following options, see <a href="//support.addthis.com/customer/portal/articles/381263-addthis-client-api">our customization documentation</a>.
2070
+ Important: AddThis optimizes displayed services based on popularity and language, and personalizes the list for
2071
+ each user. You may decrease sharing by overriding these features.
2072
+ </p>
2073
+ </li>
2074
+ <li>
2075
+ <label for="addthis_language">
2076
+ <strong><?php _e("Language", 'addthis_trans_domain' ); ?></strong>
2077
+ </label>
2078
+ <select id="addthis_language" name="addthis_settings[addthis_language]">
2079
+ <?php
2080
+ $curlng = $options['addthis_language'];
2081
+ foreach ($addthis_languages as $lng=>$name)
2082
+ {
2083
+ echo "<option value=\"$lng\"". ($lng == $curlng ? " selected='selected'":""). ">$name</option>";
2084
+ }
2085
+ ?>
2086
+ </select>
2087
+ </li>
2088
+ <li>
2089
+ <h4><strong>Global Advanced API Configuration</strong></h4>
2090
+ <ul>
2091
+ <li>
2092
+ <label for="addthis_config_json">
2093
+ <?php _e("addthis_config values (json format)", 'addthis_trans_domain' ); ?>
2094
+ </label>
2095
+ <br/>
2096
+ <small>ex:- <i>{ "services_exclude": "print" }</i></small>
2097
+ <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>
2098
+ <textarea
2099
+ id="addthis_config_json"
2100
+ rows='3'
2101
+ cols='60'
2102
+ type="text"
2103
+ name="addthis_settings[addthis_config_json]"
2104
+ id="addthis-config-json"/><?php echo $options['addthis_config_json']; ?></textarea>
2105
+ <span id="config-error" class="hidden error_text">Invalid JSON format</span>
2106
+ </li>
2107
+ <li>
2108
+ <label for="addthis_share_json">
2109
+ <?php _e("addthis_share values (json format)", 'addthis_trans_domain' ); ?>
2110
+ </label>
2111
+ <br/>
2112
+ <small>ex:- <i>{ "url" : "http://www.yourdomain.com", "title" : "Custom Title" }</i></small>
2113
+ <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>
2114
+ <textarea
2115
+ id="addthis_share_json"
2116
+ rows='3'
2117
+ cols='60'
2118
+ type="text"
2119
+ name="addthis_settings[addthis_share_json]"
2120
+ id="addthis-share-json"/><?php echo $options['addthis_share_json']; ?></textarea>
2121
+ <span id="share-error" class="hidden error_text">Invalid JSON format</span>
2122
+ </li>
2123
+ </ul>
2124
+ </li>
2125
+ </ul>
2126
+ </div>
2127
+ </div>
2128
+
2129
+ <?php echo _addthis_profile_id_card($options['credential_validation_status']); ?>
2130
+
2131
+ <?php echo _addthis_mode_card(); ?>
2132
+ </div>
2133
+ </div>
2134
+ <?php
2135
  }
2136
+
2137
+ /* 2.9 compatability functions
2138
+ */
2139
+
2140
+ if (! function_exists('get_user_meta'))
2141
+ {
2142
+ function get_user_meta($userid, $metakey, $ignored='')
2143
+ {
2144
+ $userdata = get_userdata($userid);
2145
+ if (isset($userdata->{$metakey}) )
2146
+ return $userdata->{$metakey};
2147
+ else
2148
+ return false;
 
 
 
 
2149
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2150
 
2151
+ }
2152
+ if (! function_exists('delete_user_meta'))
2153
  {
2154
+ function delete_user_meta($userid, $metakey, $ignored = '')
2155
+ {
2156
+ return delete_usermeta($userid, $metakey);
2157
+ }
 
 
 
2158
  }
2159
 
2160
+ if (! function_exists('add_user_meta'))
2161
+ {
2162
+ function add_user_meta($userid, $metakey, $metavalue)
2163
+ {
2164
+ return update_usermeta($userid, $metakey, $metavalue);
2165
+ }
2166
+ }
2167
+ if (! function_exists('get_home_url'))
2168
+ {
2169
+ function get_home_url()
2170
+ {
2171
+ return get_option( 'home' );
2172
+ }
2173
  }
 
 
 
 
 
 
 
 
 
 
2174
 
2175
+ if (! function_exists('__return_false'))
2176
+ {
2177
+ function __return_false()
2178
+ {
2179
+ return false;
2180
+ }
2181
+ }
2182
 
2183
+ if (! function_exists('__return_true'))
2184
  {
2185
+ function __return_true()
2186
+ {
2187
+ return true;
2188
+ }
2189
  }
2190
 
2191
+ if (! function_exists('esc_textarea'))
2192
  {
2193
+ function esc_textarea($text)
2194
+ {
2195
+ $safe_text = htmlspecialchars( $text, ENT_QUOTES );
2196
+ return $safe_text;
2197
+ }
2198
+
 
2199
  }
2200
+
2201
+ /**
2202
+ * Parse for the first twitter username in the given string
2203
+ * @param String $raw_twitter_username Raw string containing twitter usernames
2204
+ * @return String twitter username
2205
+ */
2206
+ if (! function_exists('get_first_twitter_username'))
2207
  {
2208
+ function get_first_twitter_username($raw_twitter_username)
2209
+ {
2210
+ $twitter_username = '';
2211
+ preg_match_all('/@(\w+)\b/i', $raw_twitter_username, $twitter_via_matches);
2212
+ if (count($twitter_via_matches[1]) == 0) {
2213
+ //To handle strings without @
2214
+ preg_match_all('/(\w+)\b/i', $raw_twitter_username, $twitter_via_refined_matches);
2215
+ if (count($twitter_via_refined_matches[1]) > 0) {
2216
+ $twitter_username = $twitter_via_refined_matches[1][0];
2217
+ }
2218
+ } else {
2219
+ $twitter_username = $twitter_via_matches[1][0];
2220
  }
2221
+ return $twitter_username;
2222
  }
 
2223
  }
2224
+
2225
+ // check for pro user
2226
+ function at_share_is_pro_user() {
2227
+ global $addThisConfigs;
2228
+ $isPro = false;
2229
+ $options = $addThisConfigs->getConfigs();
2230
+
2231
+ if (!empty($options['addthis_profile'])) {
2232
+ $request = wp_remote_get( "http://q.addthis.com/feeds/1.0/config.json?pubid=" . $options['addthis_profile'] );
2233
+ $server_output = wp_remote_retrieve_body( $request );
2234
+ $array = json_decode($server_output);
2235
+ // check for pro user
2236
+ if (is_array($array) && array_key_exists('_default',$array)) {
2237
+ $isPro = true;
2238
+ } else {
2239
+ $isPro = false;
2240
+ }
2241
+ }
2242
+ return $isPro;
2243
+ }
2244
+
2245
+ require_once('addthis_post_metabox.php');
2246
+
2247
+ function addthis_deactivation_hook()
2248
  {
2249
+ if (get_option('addthis_run_once')) {
2250
+ delete_option('addthis_run_once');
2251
+ }
 
 
 
 
 
2252
  }
 
2253
 
2254
+ // Deactivation
2255
+ register_deactivation_hook(__FILE__, 'addthis_deactivation_hook');
2256
  }
2257
 
2258
+ function _addthis_profile_setup_url() {
2259
+ $pubName = get_bloginfo('name');
 
 
 
 
 
 
 
 
 
 
 
2260
 
2261
+ if (!preg_match('/^[A-Za-z0-9 _\-\(\)]*$/', $pubName)) {
2262
+ // if title not match, get domain
2263
+ $url = get_option('siteurl');
2264
+ $urlobj = parse_url($url);
2265
+ $domain = $urlobj['host'];
2266
+
2267
+ if (preg_match(
2268
+ '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i',
2269
+ $domain, $regs
2270
+ )) {
2271
+ $domainArray = explode(".", $regs['domain']);
2272
+ $pubName = $domainArray[0];
2273
+ } else {
2274
+ $pubName = '';
2275
  }
2276
+ $pubName = str_replace('.', '', $pubName);
2277
  }
2278
 
2279
+ if (!preg_match('/^[A-Za-z0-9 _\-\(\)]*$/', $pubName) || $pubName == '') {
2280
+ // if domain not match, get loggedin username
2281
+ $currentUser = wp_get_current_user();
2282
+ $pubName = $currentUser->user_login;
 
 
 
2283
  }
 
 
 
 
 
 
2284
 
2285
+ $profileSetupUrl = 'https://www.addthis.com/settings/plugin-pubs'
2286
+ . '?cms=wp&pubname='
2287
+ . urlencode($pubName)
2288
+ . '&wp_redirect='
2289
+ . str_replace(
2290
+ '.',
2291
+ '%2E',
2292
+ urlencode(admin_url("options-general.php?page=addthis_social_widget"))
2293
+ );
 
 
 
 
 
 
 
 
 
 
 
 
2294
 
2295
+ return $profileSetupUrl;
2296
  }
2297
 
2298
+ function _addthis_analytics_url() {
2299
+ global $addThisConfigs;
2300
+ $addthis_options = $addThisConfigs->getConfigs();
2301
+ $analyticsUrl = 'https://www.addthis.com/dashboard#analytics/' . $addthis_options['addthis_profile'];
2302
+ return $analyticsUrl;
 
 
 
 
 
2303
  }
2304
 
2305
+ function _addthis_tools_url() {
2306
+ global $addThisConfigs;
2307
+ $addthis_options = $addThisConfigs->getConfigs();
2308
+ $toolsUrl = 'https://www.addthis.com/settings/plugin-pubs?cms=wp&pubid=' . $addthis_options['addthis_profile'];
2309
+ return $toolsUrl;
2310
  }
2311
 
2312
+ function _addthis_profile_id_card($credential_validation_status = false) {
2313
+ global $addThisConfigs;
2314
+ $addthis_options = $addThisConfigs->getConfigs();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2315
 
2316
+ $fieldId = 'addthis_profile';
2317
+ $noPubIdDescription = 'To begin tracking analytics on social shares from your site, use the button below to set up an AddThis account at addthis.com and create a profile for your site. This process will require an email address.';
2318
+ $noPubIdButtonText = "AddThis profile setup";
2319
+ $pubIdDescription = 'To see analytics on social shares from your site, use the button below. It will take you to Analytics on addthis.com.';
2320
+ $pubIdButtonText = "Your analytics on addthis.com";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2321
 
2322
+ $securitySnippet = '';
2323
+ if ($credential_validation_status == 1) {
2324
+ $securitySnippet = '<span class="success_text">&#10004; Valid AddThis Profile ID</span>';
2325
+ }
 
 
 
 
2326
 
2327
+ // because i can't figure out how to bring these two in line... :-(
2328
+ if ($addthis_options['addthis_plugin_controls'] != "AddThis") {
2329
+ $fieldName = 'addthis_settings[addthis_profile]';
2330
+ $security = '';
2331
+ } else {
2332
+ $fieldName = 'pubid';
2333
+ $security = wp_nonce_field('update_' . $fieldName, $fieldName . '_nonce');
2334
+ }
2335
 
2336
+ if (empty($addthis_options['addthis_profile'])) {
2337
+ $description = $noPubIdDescription;
2338
+ $buttonUrl = _addthis_profile_setup_url();
2339
+ $buttonText = $noPubIdButtonText;
2340
+ $alternatePath = '<p>Alternately, you can input your profile id manually below.</p>';
2341
+ $target = '';
2342
 
2343
+ } else {
2344
+ $description = $pubIdDescription;
2345
+ $buttonUrl = _addthis_analytics_url();
2346
+ $buttonText = $pubIdButtonText;
2347
+ $alternatePath = '';
2348
+ $target = 'target="_blank"';
2349
+ }
2350
+
2351
+ $html = '
2352
+ <div class="Card">
2353
+ <div class="Card-hd">
2354
+ <h3 class="Card-hd-title">AddThis Analytics</h3>
2355
+ </div>
2356
+ <div class="Card-bd">
2357
+ <div class="addthis_description">
2358
+ ' . $description . '
2359
+ </div>
2360
+ <div class="Btn-container-card">
2361
+ <a
2362
+ class="Btn Btn-blue"
2363
+ ' . $target . '
2364
+ href="' . $buttonUrl . '"> ' . $buttonText . ' &#8594;
2365
+ </a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2366
  </div>
2367
+ ' . $alternatePath . '
2368
+ <label for="' . $fieldId . '">
2369
+ <strong>AddThis Profile ID</strong>
2370
+ </label>
2371
+ <ul class="Profile-widget">
2372
+ <li>
2373
+ <input
2374
+ id="' . $fieldId . '"
2375
+ type="text"
2376
+ name="' . $fieldName . '"
2377
+ value="' . $addthis_options['addthis_profile'] . '"
2378
+ autofill="off"
2379
+ autocomplete="off"
2380
+ />
2381
+ '
2382
+ . $security
2383
+ . '
2384
+ </li>
2385
+ <li>
2386
+ ' . $securitySnippet . '
2387
+ </li>
2388
+ </ul>
2389
+ </div>
2390
+ </div>
2391
+ ';
2392
 
2393
+ return $html;
2394
+ }
 
 
 
2395
 
2396
+ function _addthis_mode_card() {
2397
+ global $addThisConfigs;
2398
+ $addthis_options = $addThisConfigs->getConfigs();
2399
+
2400
+ $wordPressChecked = '';
2401
+ $addThisChecked = '';
2402
+ $checked = 'checked="checked"';
2403
+ if ($addthis_options['addthis_plugin_controls'] != 'AddThis') {
2404
+ $wordPressChecked = $checked;
2405
+ $fieldName = 'addthis_settings[addthis_plugin_controls]';
2406
+ $fieldId = 'addthis_plugin_controls';
2407
+ $tbody = '<tbody></tbody>';
2408
+ } else {
2409
+ $addThisChecked = $checked;
2410
+ $fieldName = 'addthis_plugin_controls';
2411
+ $fieldId = 'downgrade-plugin';
2412
+ $tbody = '
2413
+ <tbody>
2414
+ <tr>
2415
+ <th role="rowheader" scope="row">Sharing buttons above content</td>
2416
+ <td>
2417
+ <span class="at-icon-check">
2418
+ <span class="at-icon-fallback-text">Has this Feature</span>
2419
+ </span>
2420
+ </td>
2421
+ <td>
2422
+ <span class="at-icon-check">
2423
+ <span class="at-icon-fallback-text">Has this Feature</span>
2424
+ </span>
2425
+ </td>
2426
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2427
  <tr>
2428
+ <th role="rowheader" scope="row">Sharing buttons below content</td>
2429
+ <td>
2430
+ <span class="at-icon-check">
2431
+ <span class="at-icon-fallback-text">Has this Feature</span>
2432
+ </span>
2433
+ </td>
2434
+ <td>
2435
+ <span class="at-icon-check">
2436
+ <span class="at-icon-fallback-text">Has this Feature</span>
2437
+ </span>
2438
+ </td>
2439
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2440
  <tr>
2441
+ <th role="rowheader" scope="row">Sharing sidebar</td>
2442
+ <td>
2443
+ <span class="at-icon-check">
2444
+ <span class="at-icon-fallback-text">Has this Feature</span>
2445
+ </span>
2446
+ </td>
2447
+ <td>
2448
+ <span class="at-icon-check">
2449
+ <span class="at-icon-fallback-text">Has this Feature</span>
2450
+ </span>
2451
+ </td>
2452
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2453
  <tr>
2454
+ <th role="rowheader" scope="row">Mobile toolbar</td>
2455
+ <td>
2456
+ <span class="at-hidden-cell-content">Does not have this feature</span>
2457
+ </td>
2458
+ <td>
2459
+ <span class="at-icon-check">
2460
+ <span class="at-icon-fallback-text">Has this Feature</span>
2461
+ </span>
2462
+ </td>
2463
  </tr>
2464
+ <tr>
2465
+ <th role="rowheader" scope="row">Newsletter sharing buttons</td>
2466
+ <td>
2467
+ <span class="at-hidden-cell-content">Does not have this feature</span>
2468
+ </td>
2469
+ <td>
2470
+ <span class="at-icon-check">
2471
+ <span class="at-icon-fallback-text">Has this Feature</span>
2472
+ </span>
2473
+ </td>
2474
+ </tr>
2475
+ <tr>
2476
+ <th role="rowheader" scope="row">Follow header</td>
2477
+ <td>
2478
+ <span class="at-hidden-cell-content">Does not have this feature</span>
2479
+ </td>
2480
+ <td>
2481
+ <span class="at-icon-check">
2482
+ <span class="at-icon-fallback-text">Has this Feature</span>
2483
+ </span>
2484
+ </td>
2485
+ </tr>
2486
+ <tr>
2487
+ <th role="rowheader" scope="row">Horizontal follow buttons</td>
2488
+ <td><span class="at-hidden-cell-content">Does not have this feature</span></td>
2489
+ <td>
2490
+ <span class="at-icon-check">
2491
+ <span class="at-icon-fallback-text">Has this Feature</span>
2492
+ </span>
2493
+ </td>
2494
+ </tr>
2495
+ <tr>
2496
+ <th role="rowheader" scope="row">Vertical follow buttons</td>
2497
+ <td><span class="at-hidden-cell-content">Does not have this feature</span></td>
2498
+ <td>
2499
+ <span class="at-icon-check">
2500
+ <span class="at-icon-fallback-text">Has this Feature</span>
2501
+ </span>
2502
+ </td>
2503
+ </tr>
2504
+ <tr>
2505
+ <th role="rowheader" scope="row">What\'s next</td>
2506
+ <td><span class="at-hidden-cell-content">Does not have this feature</span></td>
2507
+ <td>
2508
+ <span class="at-icon-check">
2509
+ <span class="at-icon-fallback-text">Has this Feature</span>
2510
+ </span>
2511
+ </td>
2512
+ </tr>
2513
+ <tr>
2514
+ <th role="rowheader" scope="row">Recommended content footer</td>
2515
+ <td><span class="at-hidden-cell-content">Does not have this feature</span></td>
2516
+ <td>
2517
+ <span class="at-icon-check">
2518
+ <span class="at-icon-fallback-text">Has this Feature</span>
2519
+ </span>
2520
+ </td>
2521
+ </tr>
2522
+ <tr>
2523
+ <th role="rowheader" scope="row">Horizontal recommended content</td>
2524
+ <td><span class="at-hidden-cell-content">Does not have this feature</span></td>
2525
+ <td>
2526
+ <span class="at-icon-check">
2527
+ <span class="at-icon-fallback-text">Has this Feature</span>
2528
+ </span>
2529
+ </td>
2530
+ </tr>
2531
+ <tr>
2532
+ <th role="rowheader" scope="row">Vertical recommended content</td>
2533
+ <td><span class="at-hidden-cell-content">Does not have this feature</span></td>
2534
+ <td>
2535
+ <span class="at-icon-check">
2536
+ <span class="at-icon-fallback-text">Has this Feature</span>
2537
+ </span>
2538
+ </td>
2539
+ </tr>
2540
+ <tr>
2541
+ <th role="rowheader" scope="row">Access to additional Pro tools for upgraded accounts</td>
2542
+ <td><span class="at-hidden-cell-content">Does not have this feature</span></td>
2543
+ <td>
2544
+ <span class="at-icon-check">
2545
+ <span class="at-icon-fallback-text">Has this Feature</span>
2546
+ </span>
2547
+ </td>
2548
+ </tr>
2549
+ </tbody>
2550
+ ';
2551
  }
2552
 
2553
+ $debugHtml = '';
2554
+ if (isset($_GET['debug']) || !empty($addthis_options["addthis_environment"])) {
2555
+ $debugHtml = '
2556
+ <label for="addthis_environment">
2557
+ <strong>Environment (test/dev/local)</strong>
2558
+ </label>
2559
+ <input
2560
+ type="textbox"
2561
+ id="addthis_environment"
2562
+ name="addthis_settings[addthis_environment]"
2563
+ value="' . $addthis_options["addthis_environment"] . '"
2564
+ />
2565
+ ';
2566
  }
 
2567
 
2568
+ $html = '
2569
+ <div class="Card">
2570
+ <div class="Card-hd">
2571
+ <h3 class="Card-hd-title">I want to control my plugin from...</h3>
2572
+ </div>
2573
+ <div class="Card-bd">
2574
+ <p class="Card-description">Regardless of your choice, analytics for shares of your site will be available to you on the AddThis website after you set up your AddThis profile ID.</p>
2575
+ <table class="at-comparison-table">
2576
+ <thead>
2577
+ <th role="columnheader" scope="col">
2578
+ <span class="at-hidden-cell-content">Feature List Column</span>
2579
+ </th>
2580
+ <th role="columnheader" scope="col">
2581
+ <input type="radio" id="wordpress-option" name="' . $fieldName . '" value="WordPress" ' . $wordPressChecked . ' />
2582
+ <label for="wordpress-option">
2583
+ <strong>WordPress</strong>
2584
+ </label>
2585
+ </th>
2586
+ <th role="columnheader" scope="col">
2587
+ <input type="radio" id="addthis-option" name="' . $fieldName . '" value="AddThis"' . $addThisChecked . '/>
2588
+ <label for="addthis-option">
2589
+ <strong>AddThis.com Dashboard</strong>
2590
+ </label>
2591
+ </th>
2592
+ </thead>
2593
+ ' . $tbody . '
2594
+ </table>
2595
+ <p>To see your choice reflected on these screens, save your changes.</p>
2596
+ ' . $debugHtml . '
2597
+ </div>
2598
+ </div>';
2599
+ return $html;
2600
+ }
2601
+
2602
+ function _addthis_is_csr_form() {
2603
+ global $addThisConfigs;
2604
+ $options = $addThisConfigs->getConfigs();
2605
+
2606
+ if ( isset($_GET['complete'], $_GET['pubid'])
2607
+ && $_GET['complete'] == 'true'
2608
+ && $_GET['pubid'] != $options['addthis_profile']
2609
+ ) {
2610
+ return true;
2611
  }
 
2612
 
2613
+ return false;
 
 
 
 
 
2614
  }
2615
 
2616
+ function _addthis_settings_buttons($includePreview = true) {
2617
+ $html = '';
2618
+ if (_addthis_is_csr_form()) {
2619
+ return $html;
 
2620
  }
 
2621
 
2622
+ if($includePreview) {
2623
+ $stylesheet = get_option('stylesheet');
2624
+ $template = get_option('template');
2625
+ $previewLink = esc_url(get_option('home') . '/');
2626
+ if (is_ssl()) {
2627
+ $previewLink = str_replace('http://', 'https://', $previewLink);
2628
+ }
2629
+ $queryArgs = array(
2630
+ 'preview' => 1,
2631
+ 'template' => $template,
2632
+ 'stylesheet' => $stylesheet,
2633
+ 'preview_iframe' => true,
2634
+ 'TB_iframe' => 'true'
2635
+ );
2636
+ $previewLink = htmlspecialchars(add_query_arg($queryArgs, $previewLink));
2637
+
2638
+ $previewHtml = '
2639
+ <a
2640
+ href="'.$previewLink.'"
2641
+ class="Btn thickbox thickbox-preview" >
2642
+ Preview
2643
+ </a>';
2644
+ $html .= $previewHtml;
2645
  }
2646
 
2647
+ $saveHtml = '
2648
+ <input
2649
+ type="submit"
2650
+ name="submit"
2651
+ value="Save Changes"
2652
+ class="Btn Btn-blue addthis-submit-button"
2653
+ />';
2654
+
2655
+ $html .= $saveHtml;
2656
+
2657
+ return $html;
2658
  }
2659
 
2660
  /**
2661
+ * Get HTML for new users with confirmation
2662
+ *
2663
+ * @return string
2664
  */
2665
+ function addthis_profile_id_csr_confirmation($fieldName = 'addthis_settings[addthis_profile]')
2666
  {
2667
+ if (isset($_GET['advanced_settings'])) {
2668
+ $html = '
2669
+ <div>
2670
+ Here you can manually set your AddThis Profile ID - you can get this from your
2671
+ <a target="_blank" href="https://www.addthis.com/settings/publisher">
2672
+ Profile Settings
2673
+ </a>
2674
+ </div>';
2675
+ } else {
2676
+ $html = '
2677
+ <h2>You\'re almost done!</h2>
2678
+ <div>
2679
+ It\'s time to connect your AddThis account with Wordpress.
2680
+ </div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2681
  }
2682
+ $html .= '
2683
+ <form id="addthis-form" method="post" action="'.admin_url("options-general.php?page=addthis_social_widget").'">
2684
+ <div class="addthis_pub_id">
2685
+ <div class="icons wp_div">
2686
+ <img src="'.plugins_url('images/wordpress.png', __FILE__).'">
2687
+ <span>Your WordPress Site:</span>
2688
+ <input
2689
+ type="text"
2690
+ value="' . get_bloginfo('name') . '"
2691
+ name="pub_id"
2692
+ readonly=true
2693
+ onfocus="this.blur()"/>
2694
+ </div>
2695
+ <div class="icons arrow_div">
2696
+ <img src="'.plugins_url('images/arrow_right.png', __FILE__).'">
2697
+ <img src="'.plugins_url('images/arrow_left.png', __FILE__).'">
2698
+ </div>
2699
+ <div class="icons addthis_div">
2700
+ <img src="'.plugins_url('images/addthis.png', __FILE__).'">
2701
+ <span>AddThis Profile ID:</span>';
2702
+
2703
+ if (isset($_GET['pubid'])) {
2704
+ $pubId = $_GET['pubid'];
2705
+ } else {
2706
+ $pubId = $this->_pubid;
2707
  }
 
 
 
 
2708
 
2709
+ $html .= '
2710
+ <input
2711
+ type="text"
2712
+ value="'.$pubId.'"
2713
+ name="'.$fieldName.'"
2714
+ id="addthis_profile" >
2715
+ <input
2716
+ type="hidden"
2717
+ value="true"
2718
+ name="addthis_settings[addthis_csr_confirmation]"
2719
+ </div>
2720
+ </div>';
2721
+
2722
+ $submitButtonValue = "Confirm and Save Changes";
2723
+
2724
+ $html .= '
2725
+ <input
2726
+ type="submit"
2727
+ value="'.$submitButtonValue.'"
2728
+ name="submit"
2729
+ class="addthis_confirm_button">
2730
+ <button
2731
+ class="addthis_cancel_button"
2732
+ type="button"
2733
+ onclick="window.location=\''.admin_url("options-general.php?page=addthis_social_widget").'\';return false;">
2734
+ Cancel
2735
+ </button>
2736
+ ' . wp_nonce_field( 'update_pubid', 'pubid_nonce' ) . '
2737
+ </form>';
2738
+
2739
+ return $html;
2740
+ }
css/addthis.css CHANGED
@@ -1,3 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  #dashboard_addthis .addthis-tab {
2
  display: block;
3
  background: #fff;
@@ -121,7 +141,7 @@ float:right;
121
  }
122
  #at_tabs .ui-state-active, #at_services_tabs .ui-state-active {
123
  font-weight: bold;
124
- }
125
  #at_tabs .at_time_period{
126
  float:left;
127
  padding: 0 7px;
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
  #dashboard_addthis .addthis-tab {
22
  display: block;
23
  background: #fff;
141
  }
142
  #at_tabs .ui-state-active, #at_services_tabs .ui-state-active {
143
  font-weight: bold;
144
+ }
145
  #at_tabs .at_time_period{
146
  float:left;
147
  padding: 0 7px;
css/gtc.sharing-personalize.css CHANGED
@@ -1,3 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .above-smart-sharing-container, .below-smart-sharing-container {
2
  display: inline-block;
3
  width: 550px;
@@ -189,8 +209,6 @@ li.sortable-placeholder {
189
  max-width: 40px !important;
190
  }
191
  .vertical-drag, .horizontal-drag {
192
- position: absolute;
193
- max-width: 60px;
194
  display: none;
195
  left: 255px;
196
  z-index: 0;
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
  .above-smart-sharing-container, .below-smart-sharing-container {
22
  display: inline-block;
23
  width: 550px;
209
  max-width: 40px !important;
210
  }
211
  .vertical-drag, .horizontal-drag {
 
 
212
  display: none;
213
  left: 255px;
214
  z-index: 0;
css/options-page.css CHANGED
@@ -1,140 +1,255 @@
1
- h3.page-title {
2
- float: left;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  }
4
- .page-header{
 
5
  border-bottom: 1px solid #CCCCCC;
6
- padding-bottom: 0;
7
- width: 100%;
8
- height:63px;
9
- float: left;
10
  }
11
- ul.nav-tab-wrapper {
12
- height: 57px;
13
- border-bottom: 1px solid #ccc;
14
- margin-bottom: 0;
15
- float: left;
16
- width: 92%;
17
- }
18
- ul.nav-tab-wrapper li:first-child {
19
- margin-left: 10px;
20
- }
21
- ul.nav-tab-wrapper li {
22
- float: left;
23
- border-bottom: none;
24
- padding: 14px 24px;
25
- margin: 0;
26
- /*border-bottom: 1px solid #CCCCCC;*/
27
- }
28
- ul.nav-tab-wrapper li a{
29
- text-decoration:none;
30
- color:#464646;
31
- }
32
- ul.nav-tab-wrapper li h2.nav-tab-wrapper{
33
- margin: 0;
34
- padding: 0;
35
- border: none;
36
- }
37
- ul.nav-tab-wrapper li.ui-tabs-selected{
38
- -moz-border-radius: 5px 5px 0 0;
39
- border-top:1px solid #ccc;
40
- border-left:1px solid #ccc;
41
- border-right: 1px solid #ccc;
42
- border-bottom: 1px solid #fff;
43
- padding-bottom: 13px;
44
- height: 29px;
45
- }
46
- li.ui-tabs-active{
47
- -moz-border-radius: 5px 5px 0 0 !important;
48
- border-top:1px solid #ccc !important;
49
- border-left:1px solid #ccc !important;
50
- border-right: 1px solid #ccc !important;
51
- border-bottom: 1px solid #fff !important;
52
- padding-bottom: 13px !important;
53
  }
54
- .select_row {
55
- line-height: 32px;
56
- padding-left:20px;
57
  }
58
- .select_row .radio {
59
- display: inline-block;
60
- line-height: 32px;
61
- float: left;
62
  }
63
- .radio input[type="radio"] {
64
- cursor: pointer;
 
65
  }
66
- .select_row label {
67
- line-height: 32px;
68
- padding-left: 10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  display: inline-block;
70
- width: 90%;
71
  }
72
- .select_row img {
73
- border: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
- .clear {
77
- height: 1px;
 
 
 
 
 
 
 
78
  }
79
- .mt20 { margin-top: 20px !important; }
80
 
81
- .description {
82
- margin-bottom: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
- .form-table {
85
- border-collapse: collapse;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  }
87
- .form-table td{
88
- padding: 5px;
89
  }
90
- .form-table fieldset {
91
- padding: 20px;
92
- margin-bottom: 20px;
93
- border: 1px solid #ccc;
94
- border-radius: 5px;
95
- -moz-border-radius: 5px;
96
- -webkit-border-radius: 5px;
97
  }
98
- .form-table fieldset .clear {
99
- height: 10px;
100
  }
101
 
102
- .submit {
103
- padding-top: 20px;
104
  }
105
- .submit a {
106
- margin-left: 20px;
 
107
  }
108
- .form-table tr th h2{
109
- width: 240px;
 
 
110
  }
111
  .org {
112
- color: #FE6D4C !important;
113
  }
114
  .helv {
115
- font-family: "Open Sans",Helvetica,arial,sans-serif;
116
- font-style: normal;
117
- font-weight: 300;
118
- letter-spacing: -0.05em;
119
- margin: 0px;
120
  }
121
  h3.helv {
122
- font-size: 24px;
123
- padding: 10px;
124
  }
125
  .more-info{
126
  float: left;
127
  width: 200px;
128
  }
129
- p.submit {
130
- clear: both;
131
- }
132
  #tabs{
133
- display:block;
134
- height: 100%;
135
- padding-bottom: 20px;
136
- }
137
- .ui-tabs-panel{
138
  }
139
  .wrap{
140
  width: 100%;
@@ -151,21 +266,13 @@ height: 40px;
151
  .get_the_code img{
152
  float: right;
153
  }
154
- .form-table .hidden{
155
- display: none;
156
- }
157
  h2.placeholder{
158
  font-size: 1px;
159
  padding: 1px;
160
  margin: 0px;
161
  height: 2px;
162
  }
163
- .page-header img.header-img{
164
- float: left;
165
- height: 36px;
166
- padding: 14px 6px 15px 0;
167
- width: 36px;
168
- }
169
  /*AddThis Version Notification*/
170
  .addthis-notification {
171
  border-radius: 3px 3px 3px 3px;
@@ -193,89 +300,75 @@ width: 36px;
193
  border-color: #D0E2C9;
194
  color: #6A9B58;
195
  }
196
- .addthis-title {
197
- color: #000;
198
- font-size: 36px;
199
- padding-left: 3px;
200
- font-family: "HelveticaNeueBold","HelveticaNeue-Bold","Helvetica Neue", Helvetica, "open sans",arial,sans-serif;
201
- font-weight: normal;
202
- }
203
- .addthis-plugin-name {
204
- color: gray;
205
- font-size: 36px;
206
- font-weight: normal;
207
- font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, "open sans",arial,sans-serif;
208
- }
209
-
210
  .enable-sharing-tool {
211
  padding-bottom: 12px;
212
  }
213
  #wpbody-content {
214
  font-family: Arial;
215
-
216
  }
217
  table.preview_box {
218
- margin-top: 15px;
219
- width: 550px;
220
- float: left;
221
  }
222
  .sharing-buttons-search {
223
- float: left;
224
- width: 100%;
225
- margin-top: 10px;
226
- border: 1px solid #CCC;
227
- border-radius: 5px;
228
  }
229
  .btn-search-rslt {
230
- float: left;
231
- width: 96%;
232
- border-bottom: 1px solid #CCC;
233
- height: 22px;
234
- padding: 3px;
235
  }
236
  .service-name {
237
- font-size: 13px;
238
  }
239
  .at300bs {
240
- background: url(//ct1.addthis.com/static/r07/widget056.gif) no-repeat left;
241
- overflow: hidden;
242
- display: block;
243
- background-position: 0 0;
244
- height: 16px;
245
- width: 16px;
246
- line-height: 16px!important;
247
- float: left;
248
  }
249
  .at300bs:hover {
250
- opacity: .8;
251
  }
252
  .disabled-service {
253
- opacity: .5;
254
- cursor: default !important;
255
  }
256
  .personalizedMessage {
257
- line-height: 20px;
258
  }
259
  .simple #personalizedMessage { left:627px; }
260
  /*sortable*/
261
  .connectedSortable {
262
- height: 170px;
263
- overflow: auto;
264
- margin: 0;
265
- padding: 10px 0 0 0;
266
  }
267
  .connectedSortable .ui-state-default, .connectedSortable .ui-state-highlight {
268
- border-bottom: 1px solid #CCC;
269
- padding-left: 10px;
270
- height: 32px;
271
- float: left;
272
- width: 95%;
273
- margin-bottom: 0;
274
- padding-top: 10px;
275
- cursor: move;
276
  }
277
  #above_sortable2, #below_sortable2 {
278
- height: 215px;
279
  }
280
  .addthis_counter.addthis_bubble_style {
281
  background: url(../../addthis/img/counters.gif) no-repeat!important;
@@ -294,13 +387,13 @@ height: 16px;
294
  width: 32px!important;
295
  }
296
  .addthis_32x32_style .addthis_counter.addthis_bubble_style {
297
- height: 32px;
298
  width: 60px!important;
299
  background-position: 0 -32px!important;
300
  }
301
 
302
  div#preview_floater {
303
-
304
  }
305
  .stick {
306
  position:fixed;
@@ -309,14 +402,14 @@ div#preview_floater {
309
  }
310
  .above_button_set, .below_button_set {
311
  position:relative;
312
- }
313
  .popover {
314
- width: 375px;
315
- line-height: 20px;
316
  }
317
  .customize-message-section {
318
- font-size: 11px;
319
- text-decoration: none;
320
  }
321
 
322
  .addthis_upgrade {
@@ -330,4 +423,156 @@ div#preview_floater {
330
  .addthis_upgrade a,
331
  .addthis_upgrade a:hover {
332
  color: #ffffff;
333
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
+ a,
22
+ a:hover,
23
+ a:visited {
24
+ text-decoration: none;
25
+ color: #359af9;
26
+ }
27
+ ol {
28
+ margin-left: 1.5em;
29
  }
30
+ .Main-content{
31
+ width: 98%;
32
  border-bottom: 1px solid #CCCCCC;
 
 
 
 
33
  }
34
+
35
+ .success_text {
36
+ color: #39C539;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
+ .error_text {
39
+ color: #F00;
 
40
  }
41
+ .hidden {
42
+ display: none;
 
 
43
  }
44
+ .horizontal-list-item {
45
+ display: inline-block;
46
+ margin-right: 10px;
47
  }
48
+
49
+ label + input,
50
+ label + select,
51
+ label + textarea {
52
+ display: block;
53
+ margin-top: 10px;
54
+ }
55
+ textarea {
56
+ display: block;
57
+ }
58
+
59
+
60
+ /* Nav */
61
+ .Tabbed-nav {
62
+ overflow: hidden;
63
+ border-bottom: 1px solid #ccc;
64
+ margin: 0;
65
+ padding-left: 20px;
66
+ padding-top: 1px; /* so entire focus outline shows */
67
+ }
68
+ .Tabbed-nav-item {
69
  display: inline-block;
70
+ position: relative;
71
  }
72
+ .Tabbed-nav-item a {
73
+ padding: 15px 7px;
74
+ text-transform: uppercase;
75
+ color: #464646;
76
+ font-size: 13px;
77
+ }
78
+ .Tabbed-nav-item.ui-tabs-active a {
79
+ display: inline-block;
80
+ color: #f8694d;
81
+ }
82
+ .ui-tabs-active:after {
83
+ content: '';
84
+ position: absolute;
85
+ bottom: -6px;
86
+ left: 0;
87
+ right: 0;
88
+ height: 3px;
89
+ background: #ff6e41;
90
+ -webkit-transition: all 0.3s ease;
91
+ -moz-transition: all 0.3s ease;
92
+ transition: all 0.3s ease;
93
  }
94
 
95
+ .Tabbed-nav-item-end {
96
+ float: right;
97
+ }
98
+ .Tabbed-nav .ui-tabs-selected {
99
+ height: 29px;
100
+ padding-bottom: 13px;
101
+ border-radius: 5px 5px 0 0;
102
+ border: 1px solid #ccc;
103
+ border-bottom: 1px solid #fff;
104
  }
 
105
 
106
+ /* Card */
107
+ .Card {
108
+ margin-top: 20px;
109
+ padding: 0;
110
+ background: #fff;
111
+ border: 1px solid #e2e5e8;
112
+ border-bottom-width: 2px;
113
+ border-radius: 3px;
114
+ color: #666;
115
+ font-size: 14px;
116
+ line-height: 1.4em;
117
+ }
118
+ .Card-hd {
119
+ border-bottom: 1px solid #ccc;
120
+ }
121
+ .Card-hd .Tabbed-nav {
122
+ border-bottom: 0;
123
+ }
124
+
125
+ .Card-hd-title {
126
+ margin: 20px 0 20px 25px;
127
+ padding: 0;
128
+ color: #333;
129
+ font-weight: normal;
130
+ font-size: 25px;
131
+ }
132
+ .Card-bd {
133
+ margin: 20px;
134
  }
135
+
136
+ .Card-legend {
137
+ font-weight: normal;
138
+ }
139
+ .Card-option-list > li {
140
+ margin-bottom: 20px;
141
+ }
142
+ .Sharing-Icons-options-container {
143
+ display: block;
144
+ margin-right: 10px;
145
+ vertical-align: top;
146
+ }
147
+ .Btn {
148
+ cursor: pointer;
149
+ display: inline-block;
150
+ padding: 0 1.25em;
151
+ height: 36px;
152
+ border: 1px solid #0295ff;
153
+ border-radius: 3px;
154
+ font-size: 13px;
155
+ line-height: 36px;
156
+ text-decoration: none;
157
+ }
158
+ .Btn-blue,
159
+ .Btn-blue:visited,
160
+ .Btn-blue:hover {
161
+ background: #0d99fc;
162
+ border: 1px solid #0d99fc;
163
+ border: none;
164
+ color: #fff;
165
+ }
166
+ .Btn-container-end {
167
+ padding: 20px;
168
+ text-align: right;
169
+ }
170
+ .Btn-container-card {
171
+ padding-bottom: 20px;
172
+ padding-top: 20px;
173
+ text-align: left;
174
+ }
175
+ .Header {
176
+ position: relative;
177
+ }
178
+ .Header .preview-save-btns {
179
+ position: absolute;
180
+ right: 20px;
181
+ bottom: -43px;
182
+ display: block;
183
+ }
184
+ .Header h1 {
185
+ padding: 0 0 0 40px;
186
+ margin: 0 0 0 25px;
187
+ line-height: 34px;
188
+ min-height: 40px;
189
+ background: url(//cache.addthis.com/icons/v1/thumbs/32x32/more.png) no-repeat 0px 0px;
190
+ color: #666;
191
+ font-style: normal;
192
+ font-weight: normal;
193
+ vertical-align: middle;
194
+ }
195
+ .Header em {
196
+ font-style: normal;
197
+ color: #000;
198
+ }
199
+ .Profile-widget {
200
+ margin: 0;
201
+ }
202
+ .Profile-widget li {
203
+ display: inline-block;
204
+ }
205
+
206
+ .select_row {
207
+ margin-bottom: 10px;
208
  }
209
+ .select_row .radio {
210
+ display: inline-block;
211
  }
212
+ .select_row label {
213
+ display: inline-block;
 
 
 
 
 
214
  }
215
+ .radio input[type="radio"] {
216
+ cursor: pointer;
217
  }
218
 
219
+ .select_row img {
220
+ border: none;
221
  }
222
+
223
+ .clear {
224
+ height: 1px;
225
  }
226
+ .mt20 { margin-top: 20px !important; }
227
+
228
+ .description {
229
+ margin-bottom: 20px;
230
  }
231
  .org {
232
+ color: #FE6D4C !important;
233
  }
234
  .helv {
235
+ font-family: "Open Sans",Helvetica,arial,sans-serif;
236
+ font-style: normal;
237
+ font-weight: 300;
238
+ letter-spacing: -0.05em;
239
+ margin: 0px;
240
  }
241
  h3.helv {
242
+ font-size: 24px;
243
+ padding: 10px;
244
  }
245
  .more-info{
246
  float: left;
247
  width: 200px;
248
  }
 
 
 
249
  #tabs{
250
+ display:block;
251
+ height: 100%;
252
+ padding-bottom: 20px;
 
 
253
  }
254
  .wrap{
255
  width: 100%;
266
  .get_the_code img{
267
  float: right;
268
  }
 
 
 
269
  h2.placeholder{
270
  font-size: 1px;
271
  padding: 1px;
272
  margin: 0px;
273
  height: 2px;
274
  }
275
+
 
 
 
 
 
276
  /*AddThis Version Notification*/
277
  .addthis-notification {
278
  border-radius: 3px 3px 3px 3px;
300
  border-color: #D0E2C9;
301
  color: #6A9B58;
302
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  .enable-sharing-tool {
304
  padding-bottom: 12px;
305
  }
306
  #wpbody-content {
307
  font-family: Arial;
308
+
309
  }
310
  table.preview_box {
311
+ margin-top: 15px;
312
+ width: 550px;
313
+ float: left;
314
  }
315
  .sharing-buttons-search {
316
+ float: left;
317
+ width: 100%;
318
+ margin-top: 10px;
319
+ border: 1px solid #CCC;
320
+ border-radius: 5px;
321
  }
322
  .btn-search-rslt {
323
+ float: left;
324
+ width: 96%;
325
+ border-bottom: 1px solid #CCC;
326
+ height: 22px;
327
+ padding: 3px;
328
  }
329
  .service-name {
330
+ font-size: 13px;
331
  }
332
  .at300bs {
333
+ background: url(//ct1.addthis.com/static/r07/widget056.gif) no-repeat left;
334
+ overflow: hidden;
335
+ display: block;
336
+ background-position: 0 0;
337
+ height: 16px;
338
+ width: 16px;
339
+ line-height: 16px!important;
340
+ float: left;
341
  }
342
  .at300bs:hover {
343
+ opacity: .8;
344
  }
345
  .disabled-service {
346
+ opacity: .5;
347
+ cursor: default !important;
348
  }
349
  .personalizedMessage {
350
+ line-height: 20px;
351
  }
352
  .simple #personalizedMessage { left:627px; }
353
  /*sortable*/
354
  .connectedSortable {
355
+ height: 170px;
356
+ overflow: auto;
357
+ margin: 0;
358
+ padding: 10px 0 0 0;
359
  }
360
  .connectedSortable .ui-state-default, .connectedSortable .ui-state-highlight {
361
+ border-bottom: 1px solid #CCC;
362
+ padding-left: 10px;
363
+ height: 32px;
364
+ float: left;
365
+ width: 95%;
366
+ margin-bottom: 0;
367
+ padding-top: 10px;
368
+ cursor: move;
369
  }
370
  #above_sortable2, #below_sortable2 {
371
+ height: 215px;
372
  }
373
  .addthis_counter.addthis_bubble_style {
374
  background: url(../../addthis/img/counters.gif) no-repeat!important;
387
  width: 32px!important;
388
  }
389
  .addthis_32x32_style .addthis_counter.addthis_bubble_style {
390
+ height: 32px;
391
  width: 60px!important;
392
  background-position: 0 -32px!important;
393
  }
394
 
395
  div#preview_floater {
396
+
397
  }
398
  .stick {
399
  position:fixed;
402
  }
403
  .above_button_set, .below_button_set {
404
  position:relative;
405
+ }
406
  .popover {
407
+ width: 375px;
408
+ line-height: 20px;
409
  }
410
  .customize-message-section {
411
+ font-size: 11px;
412
+ text-decoration: none;
413
  }
414
 
415
  .addthis_upgrade {
423
  .addthis_upgrade a,
424
  .addthis_upgrade a:hover {
425
  color: #ffffff;
426
+ }
427
+
428
+ /*Toggle Tool*/
429
+ .switch {
430
+ width: 62px;
431
+ height: 32px;
432
+ background: #E5E5E5;
433
+ z-index: 0;
434
+ margin: 0;
435
+ padding: 0;
436
+ appearance: none;
437
+ border: none;
438
+ cursor: pointer;
439
+ position: relative;
440
+ border-radius:16px; //IE 11
441
+ -moz-border-radius:16px; //Mozilla
442
+ -webkit-border-radius:16px; //Chrome and Safari
443
+ }
444
+
445
+ .switch:before {
446
+ content: ' ';
447
+ position: absolute;
448
+ left: 1px;
449
+ top: 1px;
450
+ width: 60px;
451
+ height: 30px;
452
+ background: #FF0000;
453
+ z-index: 1;
454
+ border-radius:16px; //IE 11
455
+ -moz-border-radius:16px; //Mozilla
456
+ -webkit-border-radius:16px; //Chrome and Safari
457
+ }
458
+
459
+ .switch:after {
460
+ content: ' ';
461
+ height: 29px;
462
+ width: 29px;
463
+ border-radius: 28px;
464
+ z-index: 2;
465
+ background: #FFFFFF;
466
+ position: absolute;
467
+ -webkit-transition-duration: 300ms;
468
+ transition-duration: 300ms;
469
+ top: 1px;
470
+ left: 1px;
471
+ -webkit-box-shadow: 0 2px 5px #999999;
472
+ box-shadow: 0 2px 5px #999999;
473
+ }
474
+
475
+ .switchOn, .switchOn:before {
476
+ background: #4cd964;
477
+ }
478
+ .switchOn:after {
479
+ left: 31px !important;
480
+ }
481
+
482
+ .at-tool-toggle {
483
+ float:right;
484
+ padding-right:40px;
485
+ }
486
+
487
+ .at-wp-tooltip{
488
+ display: inline-block;
489
+ position: relative;
490
+ padding: 1px 3px;
491
+ cursor: pointer;
492
+ border: 1px solid #333;
493
+ border-radius: 50%;
494
+ font-size: 11px;
495
+ line-height: 11px;
496
+ }
497
+
498
+ .at-wp-tooltip:hover:after{
499
+ position: absolute;
500
+ padding: 5px 15px;
501
+ left: 20%;
502
+ width: 320px;
503
+ background: #333;
504
+ background: rgba(0,0,0,.9);
505
+ border-radius: 5px;
506
+ bottom: 26px;
507
+ color: #fff;
508
+ content: attr(tooltip);
509
+ font-size: 13px;
510
+ line-height: 15px;
511
+ z-index: 98;
512
+ }
513
+ .at-wp-tooltip:hover:before{
514
+ position: absolute;
515
+ left: 50%;
516
+ border: solid;
517
+ border-color: #333 transparent;
518
+ border-width: 6px 6px 0 6px;
519
+ bottom: 20px;
520
+ content: "";
521
+ z-index: 99;
522
+ }
523
+
524
+ a.addthis_button, a.addthis_button:hover, a.addthis_button:focus, a.addthis_button:visited {
525
+ background-color: #279AF9;
526
+ color: white;
527
+ font-size: 24px;
528
+ text-decoration: none;
529
+ display: block;
530
+ width: 560px;
531
+ text-align: center;
532
+ border-radius: 3px;
533
+ margin-top: 20px;
534
+ height:62px;
535
+ padding-top: 38px;
536
+ }
537
+
538
+
539
+ /* Feature Comparison Table */
540
+ .at-comparison-table th,
541
+ .at-comparison-table td {
542
+ padding: 5px 10px;
543
+ }
544
+ .at-comparison-table td {
545
+ text-align: center;
546
+ }
547
+ .at-comparison-table input[type="radio"]:checked+label{
548
+ color: #FF6E41;
549
+ font-weight: bold;
550
+ }
551
+ .at-comparison-table thead th {
552
+ background-color: #FFF;
553
+ color: #666;
554
+ }
555
+ .at-comparison-table th[role="rowheader"] {
556
+ font-weight: normal;
557
+ text-align: left;
558
+ }
559
+ .at-comparison-table tr:nth-child(even) {
560
+ background-color: #F1F1F1;
561
+ }
562
+
563
+ .at-icon-check {
564
+ display: inline-block;
565
+ width: 16px;
566
+ height: 15px;
567
+ text-indent: -99999px;
568
+ background: url(http://cache.addthiscdn.com/www/15043058b529a/style/images/common/icon-check-blue.png) no-repeat 0 -1px;
569
+ }
570
+
571
+ .at-hidden-cell-content,
572
+ .at-icon-fallback-text {
573
+ position: absolute;
574
+ overflow: hidden;
575
+ height: 1px;
576
+ width: 1px;
577
+ clip: rect(0 0 0 0);
578
+ }
css/output.css CHANGED
@@ -1,10 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .entry-content .addthis_toolbox, .entry-content .addthis_button, .entry-header .addthis_toolbox, .entry-header .addthis_button {
2
- margin:10px 0 10px 0;
3
  }
4
  .addthis_button_tweet {
5
- min-width: 83px;
6
- float:left;
7
  }
8
  .atwidget iframe {
9
- max-width:none;
 
 
 
10
  }
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
  .entry-content .addthis_toolbox, .entry-content .addthis_button, .entry-header .addthis_toolbox, .entry-header .addthis_button {
22
+ margin:10px 0 10px 0;
23
  }
24
  .addthis_button_tweet {
25
+ min-width: 83px;
26
+ float:left;
27
  }
28
  .atwidget iframe {
29
+ max-width:none;
30
+ }
31
+ div.addthis_toolbox a, a.at-share-btn {
32
+ border: 0;
33
  }
css/style.css CHANGED
@@ -1,7 +1,22 @@
1
- p {
2
- font-size: 13px;
3
- line-height: 1.5;
4
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  .addthis_header{
7
  padding: 5px;
@@ -40,10 +55,10 @@ img.header-img {
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;
@@ -57,14 +72,24 @@ a.addthis_button, a.addthis_button:hover, a.addthis_button:focus {
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;
@@ -152,8 +177,9 @@ button.addthis_cancel_button:focus {
152
  float: left;
153
  margin: 15px 0;
154
  padding: 15px;
155
- text-align: center;
156
  font-weight: bold;
 
157
  }
158
 
159
  .addthis_updated {
@@ -192,6 +218,11 @@ a.addthis_configure, a.addthis_configure:hover {
192
  width: 160px;
193
  text-align: center;
194
  }
 
 
 
 
 
195
  .wp_div span, .addthis_div span {
196
  display: block;
197
  margin: 5px;
@@ -213,6 +244,7 @@ a.addthis_configure, a.addthis_configure:hover {
213
 
214
  .arrow_div{
215
  padding-top: 25px;
 
216
  }
217
  .arrow_div img{
218
  display: block;
@@ -256,4 +288,11 @@ a.addthis_configure, a.addthis_configure:hover {
256
 
257
  .hide {
258
  visibility: hidden;
 
 
 
 
 
 
 
259
  }
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
 
21
  .addthis_header{
22
  padding: 5px;
55
 
56
  .addthis_description{
57
  font-size: 14px;
58
+ width: 100%;
59
  }
60
 
61
+ a.addthis_button, a.addthis_button:hover, a.addthis_button:focus, a.addthis_button:visited {
62
  background-color: #279AF9;
63
  color: white;
64
  font-size: 24px;
72
  padding-top: 38px;
73
  }
74
 
75
+ a.addthis_next, a.addthis_next:hover, a.addthis_next:focus, a.addthis_next:visited {
76
+ background-color: #279AF9;
77
+ color: white;
78
+ font-size: 24px;
79
+ text-decoration: none;
80
+ display: block;
81
+ text-align: center;
82
+ border-radius: 3px;
83
+ margin-top: 20px;
84
+ height:62px;
85
+ padding-top: 38px;
86
  width: 200px;
87
  }
88
 
89
  input.addthis_confirm_button,
90
  input.addthis_confirm_button:hover,
91
  input.addthis_confirm_button:focus {
92
+ background-color: #279af9;
93
  border-radius: 3px 3px 3px 3px;
94
  color: white;
95
  display: block;
177
  float: left;
178
  margin: 15px 0;
179
  padding: 15px;
180
+ text-align: center;
181
  font-weight: bold;
182
+ width:408px;
183
  }
184
 
185
  .addthis_updated {
218
  width: 160px;
219
  text-align: center;
220
  }
221
+
222
+ .wp_div, .addthis_div input[type="text"]{
223
+ font-weight: normal;
224
+ }
225
+
226
  .wp_div span, .addthis_div span {
227
  display: block;
228
  margin: 5px;
244
 
245
  .arrow_div{
246
  padding-top: 25px;
247
+ margin-right: 22px;
248
  }
249
  .arrow_div img{
250
  display: block;
288
 
289
  .hide {
290
  visibility: hidden;
291
+ }
292
+
293
+ /*Upgrade message for 4.0 users*/
294
+ div.addthis_wrap .updated {
295
+ border-color: #FF6600;
296
+ margin-bottom: 60px;
297
+ margin-left: 0px;
298
  }
img/sidebar_theme_dark.png ADDED
Binary file
img/sidebar_theme_gray.png ADDED
Binary file
img/sidebar_theme_light.png ADDED
Binary file
img/toolbox-large.png CHANGED
Binary file
img/toolbox-small.png CHANGED
Binary file
includes/addthis_addjs.php DELETED
@@ -1,221 +0,0 @@
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
- private $_atPlugins = array(
17
- 'AddThis Social Bookmarking Widget' => array('http://wordpress.org/extend/plugins/addthis/', 'Share') ,
18
- 'AddThis Follow Widget' => array('http://wordpress.org/extend/plugins/addthis-follow/', 'Follow'),
19
- // 'AddThis Trending Content Widget' => array('http://wordpress.org/extend/plugins/addthis-trending', 'Trending' ),
20
- 'AddThis Welcome Bar' => array('http://wordpress.org/extend/plugins/addthis-welcome/', 'Welcome'),
21
- 'AddThis Social Sign In' => array('http://wordpress.org/extend/plugins/addthis-social-sign-in/', 'SSI'),
22
- );
23
- private $_atInstalled = array();
24
-
25
- var $pubid;
26
-
27
- var $jsToAdd;
28
-
29
- var $jsAfterAdd;
30
-
31
- var $atversion;
32
-
33
- var $productCode;
34
-
35
- const addjs_version = 1;
36
-
37
- /**
38
- *
39
- */
40
- public function __construct ($options){
41
- if ( did_action('addthis_addjs_created') !== 0){
42
- _doing_it_wrong( 'addthis_addjs', 'Only one instance of this class should be initialized. Look for the $addthis_addjs global first',1 );
43
- }
44
-
45
- $this->productCode = ADDTHIS_PRODUCT_VERSION;
46
-
47
- // We haven't added our JS yet. Or at least better not have.
48
- $this->_js_added = false;
49
-
50
- $this->_options = $options;
51
-
52
- // Version of AddThis code to use
53
- if (is_array($options)) {
54
- $this->atversion = array_key_exists('atversion_update_status', $options) && $options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $options['atversion'] : ADDTHIS_ATVERSION;
55
- }
56
- // set the cuid
57
- $base = get_option('home');
58
- $cuid = hash_hmac('md5', $base, 'addthis');
59
- $this->_cuid = $cuid;
60
-
61
- // If the footer option isn't set, check for it
62
- if (! isset($this->_options['wpfooter']) && current_user_can('manage_options'))
63
- {
64
- add_action('admin_init',array($this, 'update_wpfooter'));
65
- }
66
-
67
- $this->pubid = $this->getProfileId();
68
-
69
- // on theme swich, check for footer again
70
- add_action('switch_theme', array($this, 'switch_theme'),15);
71
-
72
- // In order for our wp_footer magic to work, we need to sometimes add our stuff
73
- add_action('init', array($this, 'maybe_add_footer_comment'));
74
-
75
-
76
- // Footer
77
- if ( isset($this->_options['wpfooter']) && $this->_options['wpfooter'])
78
- add_action('wp_footer', array($this, 'output_script') );
79
- else
80
- add_filter('the_content', array($this, 'output_script_filter') );
81
-
82
- do_action('addthis_addjs_created');
83
- }
84
-
85
- function switch_theme(){
86
- $footer = $this->check_for_footer();
87
- $this->_options['wpfooter'] = $footer;
88
- update_option( 'addthis_settings', $this->_options);
89
- }
90
-
91
- function output_script(){
92
- if ($this->_js_added != true)
93
- {
94
- $this->wrapJs();
95
- $this->addWidgetToJs();
96
- $this->addAfterToJs();
97
- echo $this->jsToAdd;
98
- $this->_js_added = true;
99
- $this->jsToAdd = false;
100
- } else {
101
- $this->addAfterToJs();
102
- echo $this->jsToAdd;
103
- $this->jsToAdd = false;
104
- }
105
- }
106
-
107
- function output_script_filter($content){
108
- if ($this->_js_added != true && ! is_admin() && ! is_feed() )
109
- {
110
- $this->wrapJs();
111
- $this->addWidgetToJs();
112
- $this->addAfterToJs();
113
- $content = $content . $this->jsToAdd;
114
- $this->_js_added = true;
115
- }
116
- return $content;
117
- }
118
-
119
- function wrapJs(){
120
- $this->jsToAdd .= "var addthis_product = '".$this->productCode."';\n";
121
- $this->jsToAdd = '<script type="text/javascript">' . $this->jsToAdd . '</script>';
122
- }
123
-
124
- /* testing for wp_footer in a theme stuff */
125
- function update_wpfooter(){
126
- $footer = $this->check_for_footer();
127
- $options = $this->_options;
128
- $options['wpfooter'] = $footer;
129
- update_option( 'addthis_settings', $options);
130
- $this->_options = $options;
131
- }
132
-
133
- function check_for_footer(){
134
- $url = home_url();
135
- $response = wp_remote_get( $url, array( 'sslverify' => false ) );
136
- $code = (int) wp_remote_retrieve_response_code( $response );
137
- if ( $code == 200 ) {
138
- $html = preg_replace( '/[
139
- s]/', '', wp_remote_retrieve_body( $response ) );
140
- return (bool)( strstr( $html, '<!--wp_footer-->' ) );
141
- }
142
- }
143
-
144
- function maybe_add_footer_comment(){
145
- add_action( 'wp_footer', array($this, 'test_footer' ), 99999 ); // Some obscene priority, make sure we run last
146
- }
147
-
148
- function test_footer(){
149
- echo '<!--wp_footer-->';
150
- }
151
-
152
- /* END testing for wp_footer in a theme stuff */
153
- function addToScript($newData){
154
- $this->jsToAdd .= $newData;
155
- }
156
-
157
- function addAfterScript($newData){
158
- if ( $this->_js_added != true )
159
- {
160
- $this->jsAfterAdd .= $newData;
161
- } else {
162
- $this->jsAfterAdd = $newData;
163
- }
164
- }
165
-
166
- function addWidgetToJs(){
167
- $addthis_settings_options = get_option('addthis_settings');
168
- $addthis_asynchronous_loading = (isset($addthis_settings_options['addthis_asynchronous_loading']))?$addthis_settings_options['addthis_asynchronous_loading']:false;
169
- if(isset($addthis_asynchronous_loading) && $addthis_asynchronous_loading) {
170
- $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'&async=1"></script>';
171
- $this->jsToAdd .= '<script type="text/javascript">jQuery(document).ready(function($) { addthis.init(); }); </script>';
172
- } else {
173
- $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'"></script>';
174
- }
175
- }
176
-
177
- function addAfterToJs(){
178
- if (! empty($this->jsAfterAdd)) {
179
- $this->jsToAdd .= '<script type="text/javascript">' . $this->jsAfterAdd . '</script>';
180
- $this->jsAfterAdd = NULL;
181
- }
182
- }
183
-
184
-
185
- /* User name and other shared resources */
186
- function getUsername(){
187
- return (isset($this->_options['username']))? $this->_options['username'] : false;
188
-
189
- }
190
- function setUsername($username){
191
- $this->_options['username'] = sanitize_text_field($username);
192
- update_option( 'addthis_settings', $options);
193
- }
194
-
195
- function getProfileId(){
196
- return( isset( $this->_options['profile'] ) && ! empty($this->_options['profile']) )? $this->_options['profile'] : $this->_cuid;
197
- }
198
-
199
- function setProfileId($profile){
200
- $this->_options['profile'] = sanitize_text_field($profile);
201
- update_option( 'addthis_settings', $this->_options);
202
- }
203
-
204
- function getPassword(){
205
- return (isset($this->_options['password']))? $this->_options['password'] : $this->_cuid;
206
- }
207
-
208
- function setPassword($password){
209
- $this->_options['password'] = sanitize_text_field($password);
210
- update_option( 'addthis_settings', $options);
211
- }
212
-
213
- function getAtPluginPromoText(){
214
- if (! did_action('admin_init') && ! current_filter('admin_init'))
215
- {
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 CHANGED
@@ -1,6 +1,23 @@
1
  <?php
2
-
3
- define('ADD_DIVS_TO_CODED_EXCERPTS_PATH', 'js/add-divs-to-coded-excerpts.js');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  /**
6
  * Class for managing AddThis script includes across all its plugins.
@@ -14,9 +31,10 @@ Class AddThis_addjs{
14
  private $_options;
15
 
16
  private $_cuid;
 
17
 
18
  var $pubid;
19
-
20
  var $jsToAdd;
21
 
22
  var $jsAfterAdd;
@@ -30,9 +48,11 @@ Class AddThis_addjs{
30
  /**
31
  *
32
  */
33
- public function __construct ($options){
 
 
34
  if ( did_action('addthis_addjs_created') !== 0){
35
- _doing_it_wrong( 'addthis_addjs', 'Only one instance of this class should be initialized. Look for the $addthis_addjs global first',1 );
36
  }
37
 
38
  $this->productCode = ADDTHIS_PRODUCT_VERSION;
@@ -40,15 +60,15 @@ Class AddThis_addjs{
40
  // We haven't added our JS yet. Or at least better not have.
41
  $this->_js_added = false;
42
 
43
- $this->_options = $options;
44
-
45
  // Version of AddThis code to use
46
- if (is_array($options)) {
47
- $this->atversion = array_key_exists('atversion_update_status', $options) && $options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $options['atversion'] : ADDTHIS_ATVERSION;
48
  }
49
  // set the cuid
50
  $base = get_option('home');
51
- $cuid = hash_hmac('md5', $base, 'addthis');
52
  $this->_cuid = $cuid;
53
 
54
  // If the footer option isn't set, check for it
@@ -62,7 +82,7 @@ Class AddThis_addjs{
62
  // on theme swich, check for footer again
63
  add_action('switch_theme', array($this, 'switch_theme'),15);
64
 
65
- // In order for our wp_footer magic to work, we need to sometimes add our stuff
66
  add_action('init', array($this, 'maybe_add_footer_comment'));
67
 
68
  // for adding option for show/hide addthis sharing button in admin post add/edit page.
@@ -83,7 +103,7 @@ Class AddThis_addjs{
83
  function switch_theme(){
84
  $footer = $this->check_for_footer();
85
  $this->_options['wpfooter'] = $footer;
86
- update_option( 'addthis_settings', $this->_options);
87
  }
88
 
89
  function output_script(){
@@ -95,7 +115,7 @@ Class AddThis_addjs{
95
  echo $this->jsToAdd;
96
  $this->_js_added = true;
97
  $this->jsToAdd = false;
98
- } else {
99
  $this->addAfterToJs();
100
  echo $this->jsToAdd;
101
  $this->jsToAdd = false;
@@ -124,8 +144,7 @@ Class AddThis_addjs{
124
  $footer = $this->check_for_footer();
125
  $options = $this->_options;
126
  $options['wpfooter'] = $footer;
127
- update_option( 'addthis_settings', $options);
128
- $this->_options = $options;
129
  }
130
 
131
  function check_for_footer(){
@@ -133,21 +152,21 @@ Class AddThis_addjs{
133
  $response = wp_remote_get( $url, array( 'sslverify' => false ) );
134
  $code = (int) wp_remote_retrieve_response_code( $response );
135
  if ( $code == 200 ) {
136
- $html = preg_replace( '/[
137
  s]/', '', wp_remote_retrieve_body( $response ) );
138
  return (bool)( strstr( $html, '<!--wp_footer-->' ) );
139
  }
140
  }
141
-
142
  function maybe_add_footer_comment(){
143
  add_action( 'wp_footer', array($this, 'test_footer' ), 99999 ); // Some obscene priority, make sure we run last
144
  }
145
-
146
  /* END testing for wp_footer in a theme stuff */
147
  function addToScript($newData){
148
  $this->jsToAdd .= $newData;
149
  }
150
-
151
  function addAfterScript($newData){
152
  if ( $this->_js_added != true )
153
  {
@@ -157,38 +176,49 @@ Class AddThis_addjs{
157
  }
158
  }
159
 
160
- /**
161
- * Queries window.document for a 3-letter non-printing code
162
- * The order of the code identifies a type of excerpt (archive, category, etc).
163
- * Inserts sharetoolbox and recommendedbox divs on either side of the excerpt.
164
- *
165
- * @alters window.document
166
- */
167
- function addDivsToCodedExcerpts() {
168
- wp_enqueue_script(
169
- 'addThisDivScript',
170
- plugins_url(ADD_DIVS_TO_CODED_EXCERPTS_PATH, __FILE__)
171
- );
172
-
173
- //Add a new Javascript variable to addThisDivScript that contains $postTitlesAndUrls
174
- wp_localize_script(
175
- 'addThisDivScript',
176
- 'postTitlesAndUrls',
177
- Addthis_ToolBox::getPostTitlesAndUrls()
178
- );
179
- }
180
-
181
  function addWidgetToJs(){
182
  if (!is_404()) {
183
- $this->addDivsToCodedExcerpts();
184
-
185
  //Load addthis script only if the page is not 404
186
  $addthis_settings_options = get_option('addthis_settings');
187
- $addthis_asynchronous_loading = (isset($addthis_settings_options['addthis_asynchronous_loading']))?$addthis_settings_options['addthis_asynchronous_loading']:false;
188
- $this->jsToAdd .= '<script type="text/javascript" src="//s7.addthis.com/js/'.$this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'" async="async"></script>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  }
190
  }
191
-
192
  function addAfterToJs(){
193
  if (! empty($this->jsAfterAdd)) {
194
  $this->jsToAdd .= '<script type="text/javascript">' . $this->jsAfterAdd . '</script>';
@@ -197,12 +227,14 @@ Class AddThis_addjs{
197
  }
198
 
199
  function getProfileId(){
200
- return( isset( $this->_options['profile'] ) && ! empty($this->_options['profile']) )? $this->_options['profile'] : null;
 
 
201
  }
202
 
203
  function setProfileId($profile){
204
- $this->_options['profile'] = sanitize_text_field($profile);
205
- update_option( 'addthis_settings', $this->_options);
206
  }
207
 
208
  function test_footer(){
@@ -231,7 +263,7 @@ Class AddThis_addjs{
231
  */
232
  public function add_at_flag_meta_box($post){
233
  $at_flag = get_post_meta($post->ID, '_at_widget', true);
234
- echo "<label for='_at_widget'>".__('Show AddThis Sharing buttons: ', 'foobar')."</label>";
235
  if($at_flag == '' || $at_flag == '1'){
236
  echo "<input type='checkbox' name='_at_widget' id='at_widget' value='1' checked='checked'/>";
237
  } else if($at_flag == '0'){
1
  <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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
 
22
  /**
23
  * Class for managing AddThis script includes across all its plugins.
31
  private $_options;
32
 
33
  private $_cuid;
34
+ private $addThisConfigs;
35
 
36
  var $pubid;
37
+
38
  var $jsToAdd;
39
 
40
  var $jsAfterAdd;
48
  /**
49
  *
50
  */
51
+ public function __construct ($addThisConfigs){
52
+ $this->addThisConfigs = $addThisConfigs;
53
+
54
  if ( did_action('addthis_addjs_created') !== 0){
55
+ _doing_it_wrong( 'addthis_addjs', 'Only one instance of this class should be initialized. Look for the $addthis_addjs global first',1 );
56
  }
57
 
58
  $this->productCode = ADDTHIS_PRODUCT_VERSION;
60
  // We haven't added our JS yet. Or at least better not have.
61
  $this->_js_added = false;
62
 
63
+ $this->_options = $addThisConfigs->getConfigs();
64
+
65
  // Version of AddThis code to use
66
+ if (is_array($this->_options)) {
67
+ $this->atversion = array_key_exists('atversion_update_status', $this->_options) && $this->_options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $this->_options['atversion'] : ADDTHIS_ATVERSION;
68
  }
69
  // set the cuid
70
  $base = get_option('home');
71
+ $cuid = hash_hmac('md5', $base, 'addthis');
72
  $this->_cuid = $cuid;
73
 
74
  // If the footer option isn't set, check for it
82
  // on theme swich, check for footer again
83
  add_action('switch_theme', array($this, 'switch_theme'),15);
84
 
85
+ // In order for our wp_footer magic to work, we need to sometimes add our stuff
86
  add_action('init', array($this, 'maybe_add_footer_comment'));
87
 
88
  // for adding option for show/hide addthis sharing button in admin post add/edit page.
103
  function switch_theme(){
104
  $footer = $this->check_for_footer();
105
  $this->_options['wpfooter'] = $footer;
106
+ $this->_options = $this->addThisConfigs->saveConfigs($this->_options);
107
  }
108
 
109
  function output_script(){
115
  echo $this->jsToAdd;
116
  $this->_js_added = true;
117
  $this->jsToAdd = false;
118
+ } else {
119
  $this->addAfterToJs();
120
  echo $this->jsToAdd;
121
  $this->jsToAdd = false;
144
  $footer = $this->check_for_footer();
145
  $options = $this->_options;
146
  $options['wpfooter'] = $footer;
147
+ $this->_options = $this->addThisConfigs->saveConfigs($options);
 
148
  }
149
 
150
  function check_for_footer(){
152
  $response = wp_remote_get( $url, array( 'sslverify' => false ) );
153
  $code = (int) wp_remote_retrieve_response_code( $response );
154
  if ( $code == 200 ) {
155
+ $html = preg_replace( '/[
156
  s]/', '', wp_remote_retrieve_body( $response ) );
157
  return (bool)( strstr( $html, '<!--wp_footer-->' ) );
158
  }
159
  }
160
+
161
  function maybe_add_footer_comment(){
162
  add_action( 'wp_footer', array($this, 'test_footer' ), 99999 ); // Some obscene priority, make sure we run last
163
  }
164
+
165
  /* END testing for wp_footer in a theme stuff */
166
  function addToScript($newData){
167
  $this->jsToAdd .= $newData;
168
  }
169
+
170
  function addAfterScript($newData){
171
  if ( $this->_js_added != true )
172
  {
176
  }
177
  }
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  function addWidgetToJs(){
180
  if (!is_404()) {
 
 
181
  //Load addthis script only if the page is not 404
182
  $addthis_settings_options = get_option('addthis_settings');
183
+
184
+ $async = '';
185
+ if( isset($addthis_settings_options['addthis_asynchronous_loading'])
186
+ && $addthis_settings_options['addthis_asynchronous_loading']
187
+ ) {
188
+ $async = 'async="async"';
189
+ }
190
+
191
+ /**
192
+ * Load client script based on the enviornment variable
193
+ * Admin can enable debug mode in adv settings by adding url param debug=true
194
+ */
195
+ $at_env = (isset($addthis_settings_options['addthis_environment']))?$addthis_settings_options['addthis_environment']:false;
196
+ $firstScriptHalf = '<script type="text/javascript" src="//s7.addthis.com/js/';
197
+
198
+ if(isset($at_env) && $at_env != ""){
199
+ $firstScriptHalf = '<script type="text/javascript" src="//cache-'.$at_env.'.addthis.com/cachefly/js/';
200
+ }
201
+
202
+ $addthis_share_js = '';
203
+ if ( isset($addthis_settings_options['addthis_plugin_controls'])
204
+ && $addthis_settings_options['addthis_plugin_controls'] == "AddThis"
205
+ ) {
206
+ $addthis_share['url_transforms']['shorten']['twitter'] = 'bitly';
207
+ $addthis_share['shorteners']['bitly'] = new stdClass();
208
+ $addthis_share_js = 'var addthis_share = ' . json_encode($addthis_share) . ';';
209
+ }
210
+
211
+ $this->jsToAdd .= '
212
+ <script>
213
+ var wp_product_version = "' . ADDTHIS_PRODUCT_VERSION . '";
214
+ var wp_blog_version = "' . get_bloginfo('version') . '";
215
+ ' . $addthis_share_js . '
216
+ </script>';
217
+
218
+ $this->jsToAdd .= $firstScriptHalf . $this->atversion.'/addthis_widget.js#pubid='. urlencode( $this->pubid ).'" ' . $async. '></script>';
219
  }
220
  }
221
+
222
  function addAfterToJs(){
223
  if (! empty($this->jsAfterAdd)) {
224
  $this->jsToAdd .= '<script type="text/javascript">' . $this->jsAfterAdd . '</script>';
227
  }
228
 
229
  function getProfileId(){
230
+ if (!empty($this->_options['addthis_profile'])) {
231
+ return $this->_options['addthis_profile'];
232
+ }
233
  }
234
 
235
  function setProfileId($profile){
236
+ $this->_options['addthis_profile'] = sanitize_text_field($profile);
237
+ $this->_options = $this->addThisConfigs->saveConfigs($this->_options);
238
  }
239
 
240
  function test_footer(){
263
  */
264
  public function add_at_flag_meta_box($post){
265
  $at_flag = get_post_meta($post->ID, '_at_widget', true);
266
+ echo "<label for='_at_widget'>".__('Show AddThis sharing buttons: ', 'foobar')."</label>";
267
  if($at_flag == '' || $at_flag == '1'){
268
  echo "<input type='checkbox' name='_at_widget' id='at_widget' value='1' checked='checked'/>";
269
  } else if($at_flag == '0'){
includes/js/add-divs-to-coded-excerpts.js DELETED
@@ -1,283 +0,0 @@
1
- /**
2
- * Populates finalPostObjList
3
- * Adds excerpt node element to postList
4
- *
5
- * 1. Search for all coded excerpt nodes
6
- * 2. For each node, find the corresponding postObj:
7
- * a. Iterate for a postObj whose 'content' attribute contains the coded_excerpt
8
- * if there are none, or there are two:
9
- * b. Search upward through parents of coded_excerpt until you find a single element with 'post-(id)' or '(nonnumeric)(id)'
10
- * c. If there are two, check if one of them fits both categories (implement this later)
11
- */
12
- function associatePostObjWithExcerptNode(postList) {
13
- var excerptNodes = getChildNodesWithCondition(document, function(childNode) {
14
- var data = childNode.data;
15
- return data && data.match && data.match(/[\+\-\*]{3}/g);
16
- });
17
-
18
- for(var i=0; i<excerptNodes.length; i++) {
19
- var excerptNode = excerptNodes[i];
20
-
21
- var foundPostObj = findCorrespondingPostObjById(excerptNode, postList);
22
- if(!foundPostObj) {
23
- foundPostObj = findCorrespondingPostObjByContent(excerptNode, postList);
24
- }
25
- if(foundPostObj) {
26
- foundPostObj.excerptNode = excerptNode;
27
- finalPostObjList.push(foundPostObj);
28
- } else {
29
- finalPostObjList.push({excerptNode: excerptNode});
30
- }
31
- }
32
- }
33
-
34
- /**
35
- * Iterates to find a postObj whose 'content' attribute overlaps excerptNode.data
36
- * Then associates the postObj with excerptNode
37
- */
38
- function findCorrespondingPostObjByContent(excerptNode, postList) {
39
- var matchingPostObjs = [];
40
-
41
- for(var i=0; i<postList.length; i++) {
42
- var postObj = postList[i];
43
- var trimmedContent = postObj.content.trim();
44
- var trimmedData = excerptNode.data.trim();
45
- var longestCommonSubLen = longestCommonSubstring(
46
- trimmedContent,
47
- trimmedData
48
- );
49
- if(longestCommonSubLen / trimmedContent.length >= .90 ||
50
- longestCommonSubLen / trimmedData.length >= .90) {
51
- matchingPostObjs.push(postObj);
52
- }
53
- }
54
- //If we have a single matching postObj, associate it with the current excerptNode
55
- if(matchingPostObjs.length === 1) {
56
- return matchingPostObjs[0];
57
- }
58
- return null;
59
- }
60
-
61
- /**
62
- * Searches upward through parents of excerptNode to discover a
63
- * single postNode with 'post-(id)' or '(nonnumeric)(id)'
64
- * Then associates the corresponding postObj with excerptNode
65
- */
66
- function findCorrespondingPostObjById(excerptNode, postList) {
67
- var matchingPostObjs = [];
68
- var success = false;
69
-
70
- for(var k=0; k<postList.length; k++) {
71
- var postObj = postList[k];
72
- var conditionFunc = function(childNode) {
73
- var id = childNode.id;
74
- var idHasPostConvention = id === 'post-' + postObj.id;
75
- var idMatchesSomewhat = id && id.match && id.match(new RegExp('^[0-9]+' + postObj.id, 'g'));
76
- return idHasPostConvention || idMatchesSomewhat;
77
- };
78
-
79
- //If we found a matching postNode, associate the current postObj
80
- // with the current excerptNode
81
- var firstElder = getFirstElderWithCondition(excerptNode, conditionFunc);
82
- if(firstElder) {
83
- matchingPostObjs.push({postObj: postObj, pos: firstElder.pos});
84
- }
85
- }
86
- var candidatePos;
87
- var closestObj;
88
- for(var i=0; i<matchingPostObjs.length; i++) {
89
- var matchingPostObj = matchingPostObjs[i];
90
- if(!candidatePos || candidatePos > matchingPostObj.pos) {
91
- candidatePos = matchingPostObj.pos;
92
- closestObj = matchingPostObj.postObj;
93
- }
94
- }
95
- return closestObj;
96
- }
97
-
98
- /**
99
- * Halts on first success
100
- */
101
- var nodeMarker = 0;
102
- function getFirstElderWithCondition(node, conditionFunc) {
103
- nodeMarker++;
104
- //breadth first search
105
- var queue = [];
106
- queue.push(node);
107
- //while Q is not empty
108
- var pos = 0;
109
- while(queue.length > 0 && pos < 500) {
110
- var node = queue.shift();
111
-
112
- //check the condition (which is the point of the search)
113
- if(conditionFunc(node)) {
114
- return {node: node, pos: pos};
115
- }
116
-
117
- var adjacentNodes = [];
118
- var parentNode = node.parentNode;
119
- if(parentNode) {
120
- adjacentNodes.push(parentNode);
121
- var siblings = getSiblings(parentNode);
122
- for(var k=0; k<siblings.length; k++) {
123
- var sib = siblings[k];
124
- if(!sib['visited' + nodeMarker]) {
125
- sib['visited' + nodeMarker] = true;
126
- adjacentNodes.push(sib);
127
- }
128
- }
129
- }
130
- //for all edges from v to w in G.adjacentEdges(v) do
131
- for(var i=0; i<adjacentNodes.length; i++) {
132
- var adjacentNode = adjacentNodes[i];
133
- queue.push(adjacentNode);
134
- }
135
- pos++;
136
- }
137
- }
138
-
139
- /**
140
- * Adds 'data-title' and 'data-url' attributes to 'div' parameter of postObj
141
- */
142
- function createToolboxDiv(postObj) {
143
- var postDiv = document.createElement("div");
144
- if(postObj.title) {
145
- postDiv.setAttribute('data-title', postObj.title);
146
- }
147
- if(postObj.url) {
148
- postDiv.setAttribute('data-url', postObj.url);
149
- }
150
- return postDiv;
151
- }
152
-
153
- /**
154
- * Retrieves all of the nodes in window.document whose 'data'
155
- * attributes contain 3 consecutive ASCII 0x43,0x45,or 0x42
156
- *
157
- * @return An array of DOM nodes
158
- */
159
- function getChildNodesWithCondition(node, conditionFunc) {
160
- var descs = [];
161
- node = node || document;
162
- if(node) {
163
- var childNodes = node.childNodes;
164
- for(var i=0; i<childNodes.length; i++) {
165
- var childNode = childNodes[i];
166
- if(conditionFunc(childNode)) {
167
- descs.push(childNode);
168
- }
169
- descs = descs.concat(getChildNodesWithCondition(childNode, conditionFunc));
170
- }
171
- }
172
- return descs;
173
- };
174
-
175
- /**
176
- * Queries window.document for a 3-letter non-printing code
177
- * The order of the code identifies a type of excerpt (archive, category, etc).
178
- * Inserts sharetoolbox and recommendedbox divs on either side of the excerpt.
179
- *
180
- * @alters window.document
181
- */
182
- function addDivsToCodedExcerpts() {
183
- for(var i=0; i<finalPostObjList.length; i++) {
184
- var postObj = finalPostObjList[i];
185
- var excerptNode = postObj.excerptNode;
186
- var excerptCode = excerptNode.data.substring(0,3);
187
- var suffix = "";
188
-
189
- if(excerptCode === String.fromCharCode(43,45,42)) {
190
- suffix = "-homepage";
191
- } else if(excerptCode === String.fromCharCode(43,42,45)) {
192
- suffix = "-page";
193
- } else if(excerptCode === String.fromCharCode(45,42,43)) {
194
- suffix = "";
195
- } else if(excerptCode === String.fromCharCode(45,43,42)) {
196
- suffix = "-cat-page";
197
- } else if(excerptCode === String.fromCharCode(42,43,45)) {
198
- suffix = "-arch-page";
199
- }
200
-
201
- var parentElement = excerptNode.parentElement;
202
-
203
- var above = createToolboxDiv(postObj);
204
- above.className = "at-above-post" + suffix;
205
-
206
- var below = createToolboxDiv(postObj);
207
- below.className = "at-below-post" + suffix;
208
-
209
- var aboveRecommended = createToolboxDiv(postObj);
210
- aboveRecommended.className = "at-above-post" + suffix + "-recommended";
211
-
212
- var belowRecommended = createToolboxDiv(postObj);
213
- belowRecommended.className = "at-below-post" + suffix + "-recommended";
214
-
215
- parentElement.appendChild(below);
216
- parentElement.appendChild(belowRecommended);
217
-
218
- parentElement.insertBefore(
219
- above, parentElement.childNodes[0]);
220
- parentElement.insertBefore(
221
- aboveRecommended, parentElement.childNodes[0]);
222
-
223
- excerptNode.data = excerptNode.data.replace(/[\+\-\*]{3}/g, "")
224
- }
225
- }
226
-
227
- function getChildren(n, skipMe){
228
- var r = [];
229
- for ( ; n; n = n.nextSibling )
230
- if ( n.nodeType == 1 && n != skipMe)
231
- r.push( n );
232
- return r;
233
- };
234
-
235
- function getSiblings(n) {
236
- var siblings = [];
237
- if(n.parentNode) {
238
- siblings = getChildren(n.parentNode.firstChild, n);
239
- }
240
- return siblings;
241
- }
242
-
243
- /**
244
- * Returns the longest common substring
245
- */
246
- function longestCommonSubstring(string1, string2){
247
- // init max value
248
- var longestCommonSubstring = 0;
249
- // init 2D array with 0
250
- var table = [],
251
- len1 = string1.length,
252
- len2 = string2.length,
253
- row, col;
254
- for(row = 0; row <= len1; row++){
255
- table[row] = [];
256
- for(col = 0; col <= len2; col++){
257
- table[row][col] = 0;
258
- }
259
- }
260
- // fill table
261
- var i, j;
262
- for(i = 0; i < len1; i++){
263
- for(j = 0; j < len2; j++){
264
- if(string1[i]==string2[j]){
265
- if(table[i][j] == 0){
266
- table[i+1][j+1] = 1;
267
- } else {
268
- table[i+1][j+1] = table[i][j] + 1;
269
- }
270
- if(table[i+1][j+1] > longestCommonSubstring){
271
- longestCommonSubstring = table[i+1][j+1];
272
- }
273
- } else {
274
- table[i+1][j+1] = 0;
275
- }
276
- }
277
- }
278
- return longestCommonSubstring;
279
- }
280
-
281
- var finalPostObjList = [];
282
- associatePostObjWithExcerptNode(postTitlesAndUrls);
283
- addDivsToCodedExcerpts(postTitlesAndUrls);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/addthis-for-wordpress.js CHANGED
@@ -1,31 +1,30 @@
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
-
27
  jQuery('#async_load').change(function(){
28
-
29
  var syncLoad = jQuery(this).is(':checked')?1:0;
30
  var data = {
31
  action: "at_async_loading",
@@ -34,6 +33,6 @@ jQuery(document).ready(function($) {
34
  jQuery('.at-loader').css('visibility', 'visible');
35
  jQuery.post(ajaxurl, data, function(response){
36
  jQuery('.at-loader').css('visibility', 'hidden');
37
- });
38
  });
39
  });
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
+ /*
22
  * Javascript for Addthis for Wordpress plugin
23
  */
24
 
25
+ jQuery(document).ready(function($) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  jQuery('#async_load').change(function(){
27
+
28
  var syncLoad = jQuery(this).is(':checked')?1:0;
29
  var data = {
30
  action: "at_async_loading",
33
  jQuery('.at-loader').css('visibility', 'visible');
34
  jQuery.post(ajaxurl, data, function(response){
35
  jQuery('.at-loader').css('visibility', 'hidden');
36
+ });
37
  });
38
  });
js/addthis.js CHANGED
@@ -1,5 +1,25 @@
1
- jQuery(document).ready(function($) {
2
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  var data = {action: "at_show_dashboard_widget"};
4
 
5
  $.post(ajaxurl, data, function(response){
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
+ jQuery(document).ready(function($) {
22
+
23
  var data = {action: "at_show_dashboard_widget"};
24
 
25
  $.post(ajaxurl, data, function(response){
js/gtc-sharing-personalize.js CHANGED
@@ -1,4 +1,24 @@
1
- (function($, window, document, undefined) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  var aboveshareNamespace = window.addthisnamespaces && window.addthisnamespaces['aboveshare'] ? addthisnamespaces['aboveshare']: 'addthis-share-above';
4
  var belowshareNamespace = window.addthisnamespaces && window.addthisnamespaces['belowshare'] ? addthisnamespaces['belowshare']: 'addthis-share-below';
@@ -10,7 +30,7 @@
10
 
11
  // jQuery ready event
12
  $(function() {
13
-
14
  $('.above-smart-sharing-container .restore-default-options').hide();
15
  $('.below-smart-sharing-container .restore-default-options').hide();
16
  $('#below').tooltip({ position: { my: "left+15 center", at: "right center" } });
@@ -239,7 +259,7 @@
239
  else {
240
 
241
  self.getaboveSavedOrder(function(obj) {
242
-
243
  defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
244
 
245
  abovecurrentType = $('input[name="addthis_settings[above]"]:checked');
@@ -249,7 +269,7 @@
249
  }
250
 
251
  if(abovecurrentType.length) {
252
-
253
  if(abovecurrentType.attr('id') == 'large_toolbox_above') {
254
  style = "horizontal";
255
  abovecurrentType = "addthisButtons";
@@ -266,8 +286,8 @@
266
  style = "";
267
  abovecurrentType = "image";
268
  }
269
-
270
-
271
 
272
  addthisMappedDefaults = _.map(defaults, function(value) {
273
  var service = _.where(self.thirdPartyButtons.services(), { 'service': value });
@@ -298,16 +318,16 @@
298
  self.populateList({ elem: abovesharingSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'sharing-buttons', buttonType: 'addthisButtons' });
299
 
300
  self.populateList({ elem: aboveselectedSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'selected-services', buttonType: 'addthisButtons' });
301
-
302
  }
303
-
304
  if(abovecurrentType === 'thirdPartyButtons' && style === 'horizontal') {
305
  self.populateList({ elem: abovesharingSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'sharing-buttons', style: 'horizontal', buttonType: 'thirdPartyButtons' });
306
 
307
  self.populateList({ elem: aboveselectedSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'selected-services', style: 'horizontal', buttonType: 'thirdPartyButtons' });
308
-
309
  }
310
-
311
  $('body').trigger('populatedList');
312
  def.resolve();
313
 
@@ -326,7 +346,7 @@
326
  return def;
327
 
328
  },
329
-
330
  'belowpopulateSharingServices': function(restoreDefaults, pageload) {
331
 
332
  var self = this,
@@ -350,12 +370,12 @@
350
  }
351
 
352
  else {
353
-
354
  self.getbelowSavedOrder(function(obj) {
355
-
356
  defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
357
-
358
-
359
  belowcurrentType = $('input[name="addthis_settings[below]"]:checked');
360
 
361
  if(!belowcurrentType.length) {
@@ -363,7 +383,7 @@
363
  }
364
 
365
  if(belowcurrentType.length) {
366
-
367
  if(belowcurrentType.attr('id') == 'large_toolbox_below') {
368
  style = "horizontal";
369
  belowcurrentType = "addthisButtons";
@@ -380,7 +400,7 @@
380
  style = "";
381
  belowcurrentType = "image";
382
  }
383
-
384
  addthisMappedDefaults = _.map(defaults, function(value) {
385
  var service = _.where(self.thirdPartyButtons.services(), { 'service': value });
386
  if(service.length) {
@@ -405,7 +425,7 @@
405
  addthisServices = self.sort({ defaults: addthisMappedDefaults, services: self.totalServices });
406
 
407
  thirdPartyServices = self.sort({ defaults: thirdPartyMappedDefaults, services: self.totalServices });
408
-
409
  if(belowcurrentType === 'addthisButtons') {
410
  self.populateList({ elem: belowsharingSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'sharing-buttons', buttonType: 'addthisButtons' });
411
 
@@ -418,7 +438,7 @@
418
  self.populateList({ elem: belowselectedSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'selected-services', style: 'horizontal', buttonType: 'thirdPartyButtons' });
419
 
420
  }
421
-
422
  }
423
  else {
424
  $('body').trigger('populatedList');
@@ -580,7 +600,7 @@
580
  'getaboveSavedOrder': function(callback) {
581
 
582
  var self = this;
583
-
584
  if(window.commonMethods && window.commonMethods.localStorageSettings) {
585
 
586
  commonMethods.localStorageSettings({ namespace: aboveshareNamespace, method: 'get' }, function(obj) {
@@ -600,11 +620,11 @@
600
  return self;
601
 
602
  },
603
-
604
  'getbelowSavedOrder': function(callback) {
605
 
606
  var self = this;
607
-
608
  if(window.commonMethods && window.commonMethods.localStorageSettings) {
609
 
610
  commonMethods.localStorageSettings({ namespace: belowshareNamespace, method: 'get' }, function(obj) {
@@ -634,7 +654,7 @@
634
  type = obj['type'],
635
  style = obj['style'],
636
  updatedItem = obj['item'],
637
-
638
  currentService,
639
  elem = obj.elem,
640
  serviceItems = elem.find('li'),
@@ -671,13 +691,13 @@
671
  self.aboveupdatePreview({ size: size, services: enabledDefaults, type: type, style: style, location: location });
672
 
673
  }, 1000);
674
-
675
  }
676
 
677
  return self;
678
 
679
  },
680
-
681
  'belowsaveOrder': function(obj) {
682
 
683
  var self = this,
@@ -687,7 +707,7 @@
687
  type = obj['type'],
688
  style = obj['style'],
689
  updatedItem = obj['item'],
690
-
691
  currentService,
692
  elem = obj.elem,
693
  serviceItems = elem.find('li'),
@@ -732,7 +752,7 @@
732
  },
733
 
734
  'aboveupdatePreview': function(obj) {
735
-
736
  var self = this,
737
  size = obj['size'],
738
  style = obj['style'],
@@ -782,7 +802,7 @@
782
 
783
  $('#above_previewContainer').html(buttons);
784
  },
785
-
786
 
787
  'belowupdatePreview': function(obj) {
788
 
@@ -842,7 +862,7 @@
842
  aboveDisableSmartSharing = $('#above-disable-smart-sharing'),
843
  belowEnableSmartSharing = $('#below-enable-smart-sharing'),
844
  belowDisableSmartSharing = $('#below-disable-smart-sharing'),
845
-
846
  sortableContainer,
847
  aboveradioInputs = $('input[name="addthis_settings[above]"]'),
848
  belowradioInputs = $('input[name="addthis_settings[below]"]'),
@@ -901,7 +921,7 @@
901
  $('.above-smart-sharing-container #personalizedMessage').hide();
902
  // $('.above-smart-sharing-container .customize-your-buttons').html('Your buttons are currently customized. <a href="#" class="above-customize-sharing-link customize-your-buttons">Show customization</a>.');
903
  }
904
-
905
  if($('#below-chosen-list').val() != "") {
906
  $('.below-smart-sharing-container #customizedMessage').show();
907
  $('.below-smart-sharing-container #personalizedMessage').hide();
@@ -914,7 +934,7 @@
914
  if(!abovecurrentRadioInput.length) {
915
  abovecurrentRadioInput = $('input[name="addthis_settings[above]"]').first();
916
  }
917
-
918
  if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
919
  abovecurrentStyle = "horizontal";
920
  abovecurrentType = "addthisButtons";
@@ -941,7 +961,7 @@
941
  aboveButtons.hide();
942
  }
943
 
944
-
945
  aboveradioInputs.addClass('disabled-smart-sharing');
946
 
947
  setTimeout(function() {
@@ -958,7 +978,7 @@
958
  $('.sharing-buttons-search').val('');
959
 
960
  }
961
-
962
  if(abovecurrentStyle === 'horizontal' && $('#above_previewContainer').width() < 380) {
963
  $('#above_previewContainer').css({ 'width': '380px' });
964
  }
@@ -967,14 +987,14 @@
967
  $('.above-customize-sharing-link, .customize-sharing-checkbox').show();
968
 
969
  });
970
-
971
  belowDisableSmartSharing.add(belowradioInputs).not('#button_below').bind('click', function() {
972
-
973
  belowcurrentRadioInput = $('input[name="addthis_settings[below]"]:checked');
974
  if(!belowcurrentRadioInput.length) {
975
  belowcurrentRadioInput = $('input[name="addthis_settings[below]"]').first();
976
  }
977
-
978
  if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
979
  belowcurrentStyle = "horizontal";
980
  belowcurrentType = "addthisButtons";
@@ -1001,7 +1021,7 @@
1001
  belowButtons.hide();
1002
  }
1003
 
1004
-
1005
  belowradioInputs.addClass('disabled-smart-sharing');
1006
 
1007
  setTimeout(function() {
@@ -1018,7 +1038,7 @@
1018
  $('.sharing-buttons-search').val('');
1019
 
1020
  }
1021
-
1022
  if(belowcurrentStyle === 'horizontal' && $('#below_previewContainer').width() < 380) {
1023
  $('#below_previewContainer').css({ 'width': '380px' });
1024
  }
@@ -1035,7 +1055,7 @@
1035
  $('.above-customize-sharing-link, .customize-sharing-checkbox').hide();
1036
  $('#above_previewContainer').css({ 'width': '100%', 'margin-right': 'auto' });
1037
  });
1038
-
1039
  $('#button_below').click(function() {
1040
  var self = $(this);
1041
  $('.previewbox').removeClass('previewboxbg');
@@ -1066,17 +1086,17 @@
1066
  currentRadioInput.click();
1067
 
1068
  });
1069
-
1070
  belowEnableSmartSharing.bind('click', function() {
1071
 
1072
  if($('#below-chosen-list').val() != "") {
1073
  $('.below-smart-sharing-container #customizedMessage').hide();
1074
  $('#below-chosen-list').val('');
1075
- }
1076
  else {
1077
  $('.below-smart-sharing-container #customizedMessage').hide();
1078
  }
1079
-
1080
  currentRadioInput = $('input[name="addthis_settings[below]"]:checked');
1081
 
1082
  disableCustomization();
@@ -1094,15 +1114,15 @@
1094
  aboveDisableSmartSharing.bind('click', function() {
1095
 
1096
  aboveEnableCustomization();
1097
-
1098
  aboveCustomizeButtons.show();
1099
 
1100
  });
1101
-
1102
  belowDisableSmartSharing.bind('click', function() {
1103
 
1104
  belowEnableCustomization();
1105
-
1106
  belowCustomizeButtons.show();
1107
 
1108
  });
@@ -1148,7 +1168,7 @@
1148
  }, 0);
1149
 
1150
  });
1151
-
1152
  belowDisableSmartSharing.one('click', function() {
1153
 
1154
  setTimeout(function() {
@@ -1208,7 +1228,7 @@
1208
  }
1209
 
1210
  var abovesortableList = $('.above-smart-sharing-container .selected-services .sortable:visible');
1211
-
1212
  if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
1213
  buttonstyle = "horizontal";
1214
  buttontype = "addthisButtons";
@@ -1233,7 +1253,7 @@
1233
  self.abovesaveOrder({ tool: 'above', type: buttontype, elem: abovesortableList, size: buttonsize, style: buttonstyle, item: item || "" });
1234
 
1235
  });
1236
-
1237
  $('.below_button_set .selected-services .sortable').bind('sortupdate', function(ev, item) {
1238
 
1239
  if($.isPlainObject(item)) {
@@ -1251,7 +1271,7 @@
1251
  }
1252
 
1253
  var belowsortableList = $('.below-smart-sharing-container .selected-services .sortable:visible');
1254
-
1255
  if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
1256
  buttonstyle = "horizontal";
1257
  buttontype = "addthisButtons";
@@ -1290,7 +1310,7 @@
1290
  }, 0);
1291
 
1292
  });
1293
-
1294
  belowRestoreDefaultOptions.bind('click', function(ev) {
1295
 
1296
  ev.preventDefault();
@@ -1345,7 +1365,7 @@
1345
  $('.add-buttons-msg').hide();
1346
 
1347
  $('.below-smart-sharing-container .horizontal-drag').hide();
1348
-
1349
  $('.above-smart-sharing-container .horizontal-drag').hide();
1350
 
1351
  }
@@ -1381,7 +1401,7 @@
1381
  });
1382
 
1383
  });
1384
-
1385
  $('.below-smart-sharing-container .sharing-buttons-search').bind('keyup', function(e) {
1386
 
1387
  var currentVal = $(this).val();
@@ -1425,7 +1445,7 @@
1425
  }
1426
 
1427
  });
1428
-
1429
  $('.below-smart-sharing-container .selected-services .sortable').bind({
1430
 
1431
  'mouseover': function() {
@@ -1453,7 +1473,7 @@
1453
  }
1454
 
1455
  });
1456
-
1457
  $('.below-smart-sharing-container .sharing-buttons .sortable').bind({
1458
 
1459
  'mouseover': function() {
@@ -1468,7 +1488,7 @@
1468
 
1469
  });
1470
 
1471
- $('.above-customize-sharing-link').bind('click', function(ev) {
1472
 
1473
  var aboveSmartSharingLink = $('.above-smart-sharing-container .smart-sharing-link'),
1474
  customizeButtonLink = $('.above-smart-sharing-container .customize-your-buttons');
@@ -1492,8 +1512,8 @@
1492
  }
1493
 
1494
  });
1495
-
1496
- $('.below-customize-sharing-link').bind('click', function(ev) {
1497
 
1498
  var belowSmartSharingLink = $('.below-smart-sharing-container .smart-sharing-link'),
1499
  customizeButtonLink = $('.below-smart-sharing-container .customize-your-buttons');
@@ -1619,5 +1639,31 @@
1619
 
1620
  };
1621
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1622
  }(window.jQuery, window, document));
1623
 
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
+ (function($, window, document, undefined) {
22
 
23
  var aboveshareNamespace = window.addthisnamespaces && window.addthisnamespaces['aboveshare'] ? addthisnamespaces['aboveshare']: 'addthis-share-above';
24
  var belowshareNamespace = window.addthisnamespaces && window.addthisnamespaces['belowshare'] ? addthisnamespaces['belowshare']: 'addthis-share-below';
30
 
31
  // jQuery ready event
32
  $(function() {
33
+
34
  $('.above-smart-sharing-container .restore-default-options').hide();
35
  $('.below-smart-sharing-container .restore-default-options').hide();
36
  $('#below').tooltip({ position: { my: "left+15 center", at: "right center" } });
259
  else {
260
 
261
  self.getaboveSavedOrder(function(obj) {
262
+
263
  defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
264
 
265
  abovecurrentType = $('input[name="addthis_settings[above]"]:checked');
269
  }
270
 
271
  if(abovecurrentType.length) {
272
+
273
  if(abovecurrentType.attr('id') == 'large_toolbox_above') {
274
  style = "horizontal";
275
  abovecurrentType = "addthisButtons";
286
  style = "";
287
  abovecurrentType = "image";
288
  }
289
+
290
+
291
 
292
  addthisMappedDefaults = _.map(defaults, function(value) {
293
  var service = _.where(self.thirdPartyButtons.services(), { 'service': value });
318
  self.populateList({ elem: abovesharingSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'sharing-buttons', buttonType: 'addthisButtons' });
319
 
320
  self.populateList({ elem: aboveselectedSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'selected-services', buttonType: 'addthisButtons' });
321
+
322
  }
323
+
324
  if(abovecurrentType === 'thirdPartyButtons' && style === 'horizontal') {
325
  self.populateList({ elem: abovesharingSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'sharing-buttons', style: 'horizontal', buttonType: 'thirdPartyButtons' });
326
 
327
  self.populateList({ elem: aboveselectedSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'selected-services', style: 'horizontal', buttonType: 'thirdPartyButtons' });
328
+
329
  }
330
+
331
  $('body').trigger('populatedList');
332
  def.resolve();
333
 
346
  return def;
347
 
348
  },
349
+
350
  'belowpopulateSharingServices': function(restoreDefaults, pageload) {
351
 
352
  var self = this,
370
  }
371
 
372
  else {
373
+
374
  self.getbelowSavedOrder(function(obj) {
375
+
376
  defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
377
+
378
+
379
  belowcurrentType = $('input[name="addthis_settings[below]"]:checked');
380
 
381
  if(!belowcurrentType.length) {
383
  }
384
 
385
  if(belowcurrentType.length) {
386
+
387
  if(belowcurrentType.attr('id') == 'large_toolbox_below') {
388
  style = "horizontal";
389
  belowcurrentType = "addthisButtons";
400
  style = "";
401
  belowcurrentType = "image";
402
  }
403
+
404
  addthisMappedDefaults = _.map(defaults, function(value) {
405
  var service = _.where(self.thirdPartyButtons.services(), { 'service': value });
406
  if(service.length) {
425
  addthisServices = self.sort({ defaults: addthisMappedDefaults, services: self.totalServices });
426
 
427
  thirdPartyServices = self.sort({ defaults: thirdPartyMappedDefaults, services: self.totalServices });
428
+
429
  if(belowcurrentType === 'addthisButtons') {
430
  self.populateList({ elem: belowsharingSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'sharing-buttons', buttonType: 'addthisButtons' });
431
 
438
  self.populateList({ elem: belowselectedSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'selected-services', style: 'horizontal', buttonType: 'thirdPartyButtons' });
439
 
440
  }
441
+
442
  }
443
  else {
444
  $('body').trigger('populatedList');
600
  'getaboveSavedOrder': function(callback) {
601
 
602
  var self = this;
603
+
604
  if(window.commonMethods && window.commonMethods.localStorageSettings) {
605
 
606
  commonMethods.localStorageSettings({ namespace: aboveshareNamespace, method: 'get' }, function(obj) {
620
  return self;
621
 
622
  },
623
+
624
  'getbelowSavedOrder': function(callback) {
625
 
626
  var self = this;
627
+
628
  if(window.commonMethods && window.commonMethods.localStorageSettings) {
629
 
630
  commonMethods.localStorageSettings({ namespace: belowshareNamespace, method: 'get' }, function(obj) {
654
  type = obj['type'],
655
  style = obj['style'],
656
  updatedItem = obj['item'],
657
+
658
  currentService,
659
  elem = obj.elem,
660
  serviceItems = elem.find('li'),
691
  self.aboveupdatePreview({ size: size, services: enabledDefaults, type: type, style: style, location: location });
692
 
693
  }, 1000);
694
+
695
  }
696
 
697
  return self;
698
 
699
  },
700
+
701
  'belowsaveOrder': function(obj) {
702
 
703
  var self = this,
707
  type = obj['type'],
708
  style = obj['style'],
709
  updatedItem = obj['item'],
710
+
711
  currentService,
712
  elem = obj.elem,
713
  serviceItems = elem.find('li'),
752
  },
753
 
754
  'aboveupdatePreview': function(obj) {
755
+
756
  var self = this,
757
  size = obj['size'],
758
  style = obj['style'],
802
 
803
  $('#above_previewContainer').html(buttons);
804
  },
805
+
806
 
807
  'belowupdatePreview': function(obj) {
808
 
862
  aboveDisableSmartSharing = $('#above-disable-smart-sharing'),
863
  belowEnableSmartSharing = $('#below-enable-smart-sharing'),
864
  belowDisableSmartSharing = $('#below-disable-smart-sharing'),
865
+
866
  sortableContainer,
867
  aboveradioInputs = $('input[name="addthis_settings[above]"]'),
868
  belowradioInputs = $('input[name="addthis_settings[below]"]'),
921
  $('.above-smart-sharing-container #personalizedMessage').hide();
922
  // $('.above-smart-sharing-container .customize-your-buttons').html('Your buttons are currently customized. <a href="#" class="above-customize-sharing-link customize-your-buttons">Show customization</a>.');
923
  }
924
+
925
  if($('#below-chosen-list').val() != "") {
926
  $('.below-smart-sharing-container #customizedMessage').show();
927
  $('.below-smart-sharing-container #personalizedMessage').hide();
934
  if(!abovecurrentRadioInput.length) {
935
  abovecurrentRadioInput = $('input[name="addthis_settings[above]"]').first();
936
  }
937
+
938
  if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
939
  abovecurrentStyle = "horizontal";
940
  abovecurrentType = "addthisButtons";
961
  aboveButtons.hide();
962
  }
963
 
964
+
965
  aboveradioInputs.addClass('disabled-smart-sharing');
966
 
967
  setTimeout(function() {
978
  $('.sharing-buttons-search').val('');
979
 
980
  }
981
+
982
  if(abovecurrentStyle === 'horizontal' && $('#above_previewContainer').width() < 380) {
983
  $('#above_previewContainer').css({ 'width': '380px' });
984
  }
987
  $('.above-customize-sharing-link, .customize-sharing-checkbox').show();
988
 
989
  });
990
+
991
  belowDisableSmartSharing.add(belowradioInputs).not('#button_below').bind('click', function() {
992
+
993
  belowcurrentRadioInput = $('input[name="addthis_settings[below]"]:checked');
994
  if(!belowcurrentRadioInput.length) {
995
  belowcurrentRadioInput = $('input[name="addthis_settings[below]"]').first();
996
  }
997
+
998
  if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
999
  belowcurrentStyle = "horizontal";
1000
  belowcurrentType = "addthisButtons";
1021
  belowButtons.hide();
1022
  }
1023
 
1024
+
1025
  belowradioInputs.addClass('disabled-smart-sharing');
1026
 
1027
  setTimeout(function() {
1038
  $('.sharing-buttons-search').val('');
1039
 
1040
  }
1041
+
1042
  if(belowcurrentStyle === 'horizontal' && $('#below_previewContainer').width() < 380) {
1043
  $('#below_previewContainer').css({ 'width': '380px' });
1044
  }
1055
  $('.above-customize-sharing-link, .customize-sharing-checkbox').hide();
1056
  $('#above_previewContainer').css({ 'width': '100%', 'margin-right': 'auto' });
1057
  });
1058
+
1059
  $('#button_below').click(function() {
1060
  var self = $(this);
1061
  $('.previewbox').removeClass('previewboxbg');
1086
  currentRadioInput.click();
1087
 
1088
  });
1089
+
1090
  belowEnableSmartSharing.bind('click', function() {
1091
 
1092
  if($('#below-chosen-list').val() != "") {
1093
  $('.below-smart-sharing-container #customizedMessage').hide();
1094
  $('#below-chosen-list').val('');
1095
+ }
1096
  else {
1097
  $('.below-smart-sharing-container #customizedMessage').hide();
1098
  }
1099
+
1100
  currentRadioInput = $('input[name="addthis_settings[below]"]:checked');
1101
 
1102
  disableCustomization();
1114
  aboveDisableSmartSharing.bind('click', function() {
1115
 
1116
  aboveEnableCustomization();
1117
+
1118
  aboveCustomizeButtons.show();
1119
 
1120
  });
1121
+
1122
  belowDisableSmartSharing.bind('click', function() {
1123
 
1124
  belowEnableCustomization();
1125
+
1126
  belowCustomizeButtons.show();
1127
 
1128
  });
1168
  }, 0);
1169
 
1170
  });
1171
+
1172
  belowDisableSmartSharing.one('click', function() {
1173
 
1174
  setTimeout(function() {
1228
  }
1229
 
1230
  var abovesortableList = $('.above-smart-sharing-container .selected-services .sortable:visible');
1231
+ abovecurrentRadioInput = $('input[name="addthis_settings[above]"]:checked');
1232
  if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
1233
  buttonstyle = "horizontal";
1234
  buttontype = "addthisButtons";
1253
  self.abovesaveOrder({ tool: 'above', type: buttontype, elem: abovesortableList, size: buttonsize, style: buttonstyle, item: item || "" });
1254
 
1255
  });
1256
+
1257
  $('.below_button_set .selected-services .sortable').bind('sortupdate', function(ev, item) {
1258
 
1259
  if($.isPlainObject(item)) {
1271
  }
1272
 
1273
  var belowsortableList = $('.below-smart-sharing-container .selected-services .sortable:visible');
1274
+ belowcurrentRadioInput = $('input[name="addthis_settings[below]"]:checked');
1275
  if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
1276
  buttonstyle = "horizontal";
1277
  buttontype = "addthisButtons";
1310
  }, 0);
1311
 
1312
  });
1313
+
1314
  belowRestoreDefaultOptions.bind('click', function(ev) {
1315
 
1316
  ev.preventDefault();
1365
  $('.add-buttons-msg').hide();
1366
 
1367
  $('.below-smart-sharing-container .horizontal-drag').hide();
1368
+
1369
  $('.above-smart-sharing-container .horizontal-drag').hide();
1370
 
1371
  }
1401
  });
1402
 
1403
  });
1404
+
1405
  $('.below-smart-sharing-container .sharing-buttons-search').bind('keyup', function(e) {
1406
 
1407
  var currentVal = $(this).val();
1445
  }
1446
 
1447
  });
1448
+
1449
  $('.below-smart-sharing-container .selected-services .sortable').bind({
1450
 
1451
  'mouseover': function() {
1473
  }
1474
 
1475
  });
1476
+
1477
  $('.below-smart-sharing-container .sharing-buttons .sortable').bind({
1478
 
1479
  'mouseover': function() {
1488
 
1489
  });
1490
 
1491
+ $('.above-customize-sharing-link').bind('click', function(ev) {
1492
 
1493
  var aboveSmartSharingLink = $('.above-smart-sharing-container .smart-sharing-link'),
1494
  customizeButtonLink = $('.above-smart-sharing-container .customize-your-buttons');
1512
  }
1513
 
1514
  });
1515
+
1516
+ $('.below-customize-sharing-link').bind('click', function(ev) {
1517
 
1518
  var belowSmartSharingLink = $('.below-smart-sharing-container .smart-sharing-link'),
1519
  customizeButtonLink = $('.below-smart-sharing-container .customize-your-buttons');
1639
 
1640
  };
1641
 
1642
+ jQuery(document).ready(function($) {
1643
+ if($('#above-disable-smart-sharing').attr('checked')){
1644
+ setTimeout(function() {
1645
+ window.customServicesAPI.abovepopulateSharingServices();
1646
+ }, 0);
1647
+ $('.above-smart-sharing-container .restore-default-options').show();
1648
+ $('.above-smart-sharing-container .customize-buttons').show();
1649
+ setTimeout(function() {
1650
+ // Makes the new list sortable
1651
+ $('.above-smart-sharing-container .sortable').sortable().disableSelection().sortable('option', 'connectWith', '.sortable');
1652
+ }, 0);
1653
+ }
1654
+
1655
+ if($('#below-disable-smart-sharing').attr('checked')){
1656
+ setTimeout(function() {
1657
+ window.customServicesAPI.belowpopulateSharingServices();
1658
+ }, 0);
1659
+ $('.below-smart-sharing-container .restore-default-options').show();
1660
+ $('.below-smart-sharing-container .customize-buttons').show();
1661
+ setTimeout(function() {
1662
+ // Makes the new list sortable
1663
+ $('.below-smart-sharing-container .sortable').sortable().disableSelection().sortable('option', 'connectWith', '.sortable');
1664
+ }, 0);
1665
+ }
1666
+ });
1667
+
1668
  }(window.jQuery, window, document));
1669
 
js/gtc.cover.js CHANGED
@@ -1,3 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  window.commonMethods = {
2
 
3
  localStorageSettings: function(obj, callback) {
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
  window.commonMethods = {
22
 
23
  localStorageSettings: function(obj, callback) {
js/options-page.32.js CHANGED
@@ -1,14 +1,36 @@
1
- jQuery(document).ready(function($) {
2
-
3
- $( "#config-error" ).hide();
4
- $( "#share-error" ).hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  $( "#tabs" ).tabs();
6
-
7
- var thickDims, tbWidth, tbHeight, img = abvimg = belimg = '';
8
-
 
 
 
9
  thickDims = function() {
10
  var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
11
-
12
  w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
13
  h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
14
  if ( tbWindow.size() ) {
@@ -20,23 +42,23 @@ jQuery(document).ready(function($) {
20
  }
21
  };
22
 
23
-
24
  $('a.thickbox-preview').click( function() {
25
-
26
  var previewLink = this;
27
-
28
  var $inputs = $('#addthis_settings :input');
29
 
30
  var values = {};
31
  $.each($('#addthis_settings').serializeArray(), function(i, field) {
32
-
33
  var thisName = field.name
34
  if (thisName.indexOf("addthis_settings[") != -1 )
35
  {
36
  thisName = thisName.replace("addthis_settings[", '');
37
  thisName = thisName.replace("]", '');
38
  }
39
-
40
  values[thisName] = field.value;
41
  });
42
 
@@ -46,42 +68,40 @@ jQuery(document).ready(function($) {
46
  action: 'at_save_transient',
47
  value : stuff
48
  };
49
-
50
 
51
  jQuery.post(ajaxurl, data, function(response) {
52
 
53
- // Fix for WP 2.9's version of lightbox
54
  if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
55
  {
56
- tb_click.call(previewLink);
57
  }
58
  var href = $(previewLink).attr('href');
59
  var link = '';
60
 
61
 
62
- if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
63
- tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
64
- else
65
- tbWidth = $(window).width() - 90;
66
 
67
- if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
68
  tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
69
  else
70
  tbHeight = $(window).height() - 60;
71
-
72
- $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
73
- $('#TB_closeAjaxWindow').css({'float':'left'});
74
- $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
75
 
76
- $('#TB_iframeContent').width('100%');
77
-
78
- thickDims();
 
 
79
 
80
  });
81
  return false;
82
  });
83
 
84
- var aboveCustom = $('#above_custom_button');
85
  var aboveCustomShow = function(){
86
  if ( aboveCustom.is(':checked'))
87
  {
@@ -95,7 +115,7 @@ jQuery(document).ready(function($) {
95
  }
96
  };
97
 
98
- var belowCustom = $('#below_custom_button');
99
  var belowCustomShow = function(){
100
  if ( belowCustom.is(':checked'))
101
  {
@@ -115,12 +135,12 @@ jQuery(document).ready(function($) {
115
  {
116
  $('.above_option').toggleClass('hide');
117
  }
118
-
119
  if ( $('#input[name="addthis_settings[show_below]"]').is(':checked'))
120
  {
121
  $('.below_option').toggleClass('hide');
122
  }
123
-
124
  $('input[name="addthis_settings[show_above]"]').change( function() {
125
  $('.above_option').toggleClass('hide');
126
  });
@@ -129,7 +149,7 @@ jQuery(document).ready(function($) {
129
  $('.below_option').toggleClass('hide');
130
  });
131
 
132
- var aboveCustomString = $('#above_custom_string');
133
  var aboveCustomStringShow = function(){
134
  if ( aboveCustomString.is(':checked'))
135
  {
@@ -143,7 +163,7 @@ jQuery(document).ready(function($) {
143
  }
144
  };
145
 
146
- var belowCustomString = $('#below_custom_string');
147
  var belowCustomStringShow = function(){
148
  if ( belowCustomString.is(':checked'))
149
  {
@@ -167,7 +187,7 @@ jQuery(document).ready(function($) {
167
 
168
  /**
169
  * Hide Theming and branding options when user selects version 3.0 or above
170
- */
171
  var ATVERSION_250 = 250;
172
  var AT_VERSION_300 = 300;
173
  var MANUAL_UPDATE = -1;
@@ -179,7 +199,7 @@ jQuery(document).ready(function($) {
179
  } else {
180
  $(".classicFeature").hide();
181
  }
182
-
183
  /**
184
  * Revert to older version after the user upgrades
185
  */
@@ -191,7 +211,7 @@ jQuery(document).ready(function($) {
191
  });
192
  /**
193
  * Update to a newer version
194
- */
195
  $(".addthis-update-atversion").click(function(){
196
  $("#addthis_atversion_update_status").val(MANUAL_UPDATE);
197
  $("#addthis_atversion_hidden").val(AT_VERSION_300);
@@ -209,9 +229,7 @@ jQuery(document).ready(function($) {
209
  {"url" : addthis_option_params.wp_ajax_url,
210
  "type" : "post",
211
  "data" : {"action" : addthis_option_params.addthis_validate_action,
212
- "addthis_profile" : $("#addthis_profile").val(),
213
- "addthis_username" : $("#addthis_username").val(),
214
- "addthis_password" : $("#addthis_password").val()
215
  },
216
  "dataType" : "json",
217
  "beforeSend" : function() {
@@ -247,602 +265,646 @@ jQuery(document).ready(function($) {
247
  }
248
  });
249
  }
250
- //Prevent default form submission
251
- $("#addthis_settings").submit(function(){
252
- if(window.skipValidationInternalError) {
253
- return true;
254
- }
255
- var isProfileEmpty = $.trim($("#addthis_profile").val()) == "";
256
- var isUsernameEmpty = $.trim($("#addthis_username").val()) == "";
257
- var isPasswordEmpty = $.trim($("#addthis_password").val()) == "";
258
- var isAnyFieldEmpty = isProfileEmpty || isUsernameEmpty || isPasswordEmpty;
259
- var validationRequired = addthis_credential_validation_status.val() == 0;
260
-
261
- if(isUsernameEmpty != isPasswordEmpty) {
262
- var emptyLabel = isUsernameEmpty ? "username" : "password";
263
- addthis_validation_message.html("&#x2716; AddThis " + emptyLabel + " is required to view analytics").next().hide();
264
- return false;
265
- } else if (isProfileEmpty && !isUsernameEmpty && !isPasswordEmpty) {
266
- addthis_profile_validation_message.html("&#x2716; AddThis profile ID is required to view analytics").next().hide();
267
- $('html, body').animate({"scrollTop":0}, 'slow');
268
- return false;
269
- } else if (!validationRequired || isAnyFieldEmpty) {
270
- return true;
271
- } else if(!isAnyFieldEmpty && validationRequired) {
272
- validate_addthis_credentials();
273
- return false;
274
- }
275
- });
276
-
277
- $("#addthis_username, #addthis_password, #addthis_profile").change(function(){
278
  addthis_credential_validation_status.val(0);
279
  if($.trim($("#addthis_profile").val()) == "") {
280
  addthis_profile_validation_message.next().hide();
281
  }
282
- if(($.trim($("#addthis_username").val()) == "") || ($.trim($("#addthis_password").val()) == "")) {
283
- addthis_validation_message.next().hide();
284
- }
285
  });
286
 
287
- $('#addthis-config-json').focusout(function() {
288
- var error = 0;
289
- if ($('#addthis-config-json').val() != " ") {
290
- try {
291
- var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
292
- }
293
- catch (e) {
294
- $('#config-error').show();
295
- error = 1;
296
- }
297
- }
298
- if (error == 0) {
299
- $('#config-error').hide();
300
- return true;
301
- } else {
302
- $('#config-error').show();
303
- return false;
304
- }
305
  });
306
-
307
- $('#addthis-share-json').focusout(function() {
308
- var error = 0;
309
- if ($('#addthis-share-json').val() != " ") {
310
- try {
311
- var addthis_share_json = jQuery.parseJSON($('#addthis-share-json').val());
312
- }
313
- catch (e) {
314
- $('#share-error').show();
315
- error = 1;
316
- }
317
- }
318
- if (error == 0) {
319
- $('#share-error').hide();
320
- return true;
321
- } else {
322
- $('#share-error').show();
323
- return false;
324
- }
325
  });
326
-
327
- $('#submit-button').click(function() {
328
- $('#config-error').hide();
329
- $('#share-error').hide();
330
- var error = 0;
331
- if ($('#addthis-config-json').val() != " ") {
332
- try {
333
- var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
334
- }
335
- catch (e) {
336
- $('#config-error').show();
337
- error = 1;
338
- }
339
- }
340
- if ($('#addthis-share-json').val() != " ") {
341
- try {
342
- var addthis_share_json = jQuery.parseJSON($('#addthis-share-json').val());
343
- }
344
- catch (e) {
345
- $('#share-error').show();
346
- error = 1;
347
- }
348
- }
349
- if (error == 0) {
350
- return true;
351
- } else {
352
- return false;
353
- }
354
  });
355
-
356
-
357
  //preview box
358
  function rewriteServices(posn) {
359
- var services = $('#'+posn+'-chosen-list').val();
360
- var service = services.split(', ');
361
- var i;
362
- var newservice = '';
363
- for (i = 0; i < (service.length); ++i) {
364
- if(service[i] == 'linkedin') {
365
- newservice += 'linkedin_counter, ';
366
- }
367
- else if(service[i] == 'facebook') {
368
- newservice += 'facebook_like, ';
369
- }
370
- else if(service[i] == 'twitter') {
371
- newservice += 'tweet, ';
372
- }
373
- else if(service[i] == 'pinterest_share') {
374
- newservice += 'pinterest_pinit, ';
375
- }
376
- else if(service[i] == 'hyves') {
377
- newservice += 'hyves_respect, ';
378
- }
379
- else if(service[i] == 'google_plusone_share') {
380
- newservice += 'google_plusone, ';
381
- }
382
- else if(service[i] == 'counter' || service[i] == 'compact') {
383
- newservice += service[i]+', ';
384
- }
385
- }
386
- var newservices = newservice.slice(0,-2);
387
- return newservices;
388
  }
389
-
390
  function revertServices(posn) {
391
- var services = $('#'+posn+'-chosen-list').val();
392
- var service = services.split(', ');
393
- var i;
394
- var newservice = '';
395
- for (i = 0; i < (service.length); ++i) {
396
- if(service[i] == 'facebook_like') {
397
- newservice += 'facebook, ';
398
- }
399
- else if(service[i] == 'linkedin_counter') {
400
- newservice += 'linkedin, ';
401
- }
402
- else if(service[i] == 'hyves_respect') {
403
- newservice += 'hyves, ';
404
- }
405
- else if(service[i] == 'google_plusone') {
406
- newservice += 'google_plusone_share, ';
407
- }
408
- else if(service[i] == 'tweet') {
409
- newservice += 'twitter, ';
410
- }
411
- else if(service[i] == 'pinterest_pinit') {
412
- newservice += 'pinterest_share, ';
413
- }
414
- else {
415
- newservice += service[i]+', ';
416
- }
417
- }
418
- var newservices = newservice.slice(0,-2);
419
- return newservices;
420
  }
421
-
422
  function updatePreview(posn, style, option) {
423
- var preview = '';
424
- var service = option.split(', ');
425
- var i;
426
-
427
- if(style == 'large_toolbox') {
428
- preview += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
429
- for (i = 0; i < (service.length); ++i) {
430
- if(service[i] == 'counter') {
431
- preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
432
- } else {
433
- preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
434
- }
435
- }
436
- preview += '</div>';
437
- }
438
- else if(style == 'fb_tw_p1_sc') {
439
- for (i = 0; i < (service.length); ++i) {
440
- if(service[i] == 'compact') {
441
- preview += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
442
- }
443
- else if(service[i] != 'counter') {
444
- preview += '<img src="'+addthis_option_params.img_base+service[i]+'.png">';
445
- }
446
- }
447
- }
448
- else if(style == 'small_toolbox') {
449
- for (i = 0; i < (service.length); ++i) {
450
- if(service[i] == 'counter') {
451
- preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
452
- } else {
453
- preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
454
- }
455
- }
456
- }
457
- $('#'+posn+'_previewContainer').html(preview);
458
  }
459
  if($('#large_toolbox_above').is(':checked')) {
460
- if($('#above-chosen-list').val() == "") {
461
- abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
462
- } else {
463
- abvimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
464
- var aboveserv = $('#above-chosen-list').val();
465
- var aservice = aboveserv.split(', ');
466
- var i;
467
- for (i = 0; i < (aservice.length); ++i) {
468
- if(aservice[i] == 'counter') {
469
- abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
470
- } else {
471
- abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
472
- }
473
- }
474
- abvimg += '</div>';
475
- }
476
- $('.above_button_set').css('opacity', 1);
477
- $('.above-customize-sharing-link').css('opacity', 1);
478
- $('.above-smart-sharing-container').show();
479
- $('#above_previewContainer').html(abvimg);
480
  } else if($('#fb_tw_p1_sc_above').is(':checked')) {
481
- if($('#above-chosen-list').val() == "") {
482
- abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
483
- } else {
484
- var aboveserv = $('#above-chosen-list').val();
485
- var aservice = aboveserv.split(', ');
486
- var i;
487
- for (i = 0; i < (aservice.length); ++i) {
488
- if(aservice[i] == 'compact') {
489
- abvimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
490
- }
491
- else if(aservice[i] != 'counter') {
492
- abvimg += '<img src="'+addthis_option_params.img_base+aservice[i]+'.png">';
493
- }
494
- }
495
- }
496
- $('.above_button_set').css('opacity', 1);
497
- $('.above-customize-sharing-link').css('opacity', 1);
498
- $('.above-smart-sharing-container').show();
499
- $('#above_previewContainer').html(abvimg);
500
- } else if($('#small_toolbox_above').is(':checked')) {
501
- if($('#above-chosen-list').val() == "") {
502
- abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
503
- } else {
504
- var aboveserv = $('#above-chosen-list').val();
505
- var aservice = aboveserv.split(', ');
506
- var i;
507
- for (i = 0; i < (aservice.length); ++i) {
508
- if(aservice[i] == 'counter') {
509
- abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
510
- } else {
511
- abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
512
- }
513
- }
514
- }
515
- $('.above_button_set').css('opacity', 1);
516
- $('.above-customize-sharing-link').css('opacity', 1);
517
- $('.above-smart-sharing-container').show();
518
- $('#above_previewContainer').html(abvimg);
519
- } else if($('#button_above').is(':checked')) {
520
- abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
521
- $('.above_button_set').css('opacity', 1);
522
- $('.above-customize-sharing-link').css('opacity', 0);
523
- $('.above-smart-sharing-container').hide();
524
- $('#above_previewContainer').html(abvimg);
525
- } else if($('#disable_above').is(':checked')) {
526
- abvimg = '';
527
- $('.above_button_set').css('opacity', 0.4);
528
- $('.above-customize-sharing-link').css('opacity', 0);
529
- $('.above-smart-sharing-container').hide();
530
- $('#above_previewContainer').html(abvimg);
531
- }
532
-
533
- if($('#large_toolbox_below').is(':checked')) {
534
- if($('#below-chosen-list').val() == "") {
535
- belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
536
- } else {
537
- belimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
538
- var belowserv = $('#below-chosen-list').val();
539
- var bservice = belowserv.split(', ');
540
- var i;
541
- for (i = 0; i < (bservice.length); ++i) {
542
- if(bservice[i] == 'counter') {
543
- belimg +='<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
544
- } else {
545
- belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
546
- }
547
- }
548
- belimg += '</div>';
549
-
550
- }
551
- $('.below_button_set').css('opacity', 1);
552
- $('.below-customize-sharing-link').css('opacity', 1);
553
- $('.below-smart-sharing-container').show();
554
- $('#below_previewContainer').html(belimg);
555
- } else if($('#fb_tw_p1_sc_below').is(':checked')) {
556
- if($('#below-chosen-list').val() == "") {
557
- belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
558
- } else {
559
- var belowserv = $('#below-chosen-list').val();
560
- var bservice = belowserv.split(', ');
561
- var i;
562
- for (i = 0; i < (bservice.length-1); ++i) {
563
- if(bservice[i] == 'compact') {
564
- belimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
565
- } else if(bservice[i] != 'counter') {
566
- belimg += '<img src="'+addthis_option_params.img_base+bservice[i]+'.png">';
567
- }
568
- }
569
- }
570
- $('.below_button_set').css('opacity', 1);
571
- $('.below-customize-sharing-link').css('opacity', 1);
572
- $('.below-smart-sharing-container').show();
573
- $('#below_previewContainer').html(belimg);
574
- } else if($('#small_toolbox_below').is(':checked')) {
575
- if($('#below-chosen-list').val() == "") {
576
- belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
577
- } else {
578
- var belowserv = $('#below-chosen-list').val();
579
- var bservice = belowserv.split(', ');
580
- var i;
581
- for (i = 0; i < (bservice.length); ++i) {
582
- if(bservice[i] == 'counter') {
583
- belimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
584
- } else {
585
- belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
586
- }
587
- }
588
- }
589
- $('.below_button_set').css('opacity', 1);
590
- $('.below-customize-sharing-link').css('opacity', 1);
591
- $('.below-smart-sharing-container').show();
592
- $('#below_previewContainer').html(belimg);
593
- } else if($('#button_below').is(':checked')) {
594
- belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
595
- $('.below_button_set').css('opacity', 1);
596
- $('.below-customize-sharing-link').css('opacity', 0);
597
- $('.below-smart-sharing-container').hide();
598
- $('#below_previewContainer').html(belimg);
599
- } else if($('#disable_below').is(':checked')) {
600
- belimg = '';
601
- $('.below_button_set').css('opacity', 0.4);
602
- $('.below-customize-sharing-link').css('opacity', 0);
603
- $('.below-smart-sharing-container').hide();
604
- $('#below_previewContainer').html(belimg);
605
- }
 
 
 
 
 
 
606
 
607
  $("#large_toolbox_above").click( function() {
608
- if($('#above-chosen-list').val() != '') {
609
- var newserv = revertServices('above');
610
- updatePreview('above', 'large_toolbox', newserv);
611
- $('#above-chosen-list').val(newserv);
612
- }
613
- else {
614
- $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
615
- }
616
- $('.above_button_set').css('opacity', 1);
617
- $('.above-customize-sharing-link').css('opacity', 1);
618
- $('.above-smart-sharing-container').show();
619
  });
620
-
621
  $("#large_toolbox_below").click( function() {
622
- if($('#below-chosen-list').val() != '') {
623
- var newserv = revertServices('below');
624
- updatePreview('below', 'large_toolbox', newserv);
625
- $('#below-chosen-list').val(newserv);
626
- }
627
- else {
628
- $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
629
- }
630
- $('.below_button_set').css('opacity', 1);
631
- $('.below-customize-sharing-link').css('opacity', 1);
632
- $('.below-smart-sharing-container').show();
633
  });
634
 
635
  $("#fb_tw_p1_sc_above").click( function() {
636
- if($('#above-chosen-list').val() != '') {
637
- var newserv = rewriteServices('above');
638
- updatePreview('above', 'fb_tw_p1_sc', newserv);
639
- $('#above-chosen-list').val(newserv);
640
- }
641
- else {
642
- $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
643
- }
644
- $('.above_button_set').css('opacity', 1);
645
- $('.above-customize-sharing-link').css('opacity', 1);
646
- $('.above-smart-sharing-container').show();
647
  });
648
-
649
  $("#fb_tw_p1_sc_below").click( function() {
650
- if($('#below-chosen-list').val() != '') {
651
- var newserv = rewriteServices('below');
652
- updatePreview('below', 'fb_tw_p1_sc', newserv);
653
- $('#below-chosen-list').val(newserv);
654
- }
655
- else {
656
- $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
657
- }
658
- $('.below_button_set').css('opacity', 1);
659
- $('.below-customize-sharing-link').css('opacity', 1);
660
- $('.below-smart-sharing-container').show();
661
  });
662
-
663
  $("#small_toolbox_above").click( function() {
664
- if($('#above-chosen-list').val() != '') {
665
- var newserv = revertServices('above');
666
- updatePreview('above', 'small_toolbox', newserv);
667
- $('#above-chosen-list').val(newserv);
668
- }
669
- else {
670
- $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
671
- }
672
- $('.above_button_set').css('opacity', 1);
673
- $('.above-customize-sharing-link').css('opacity', 1);
674
- $('.above-smart-sharing-container').show();
675
  });
676
-
677
  $("#small_toolbox_below").click( function() {
678
- if($('#below-chosen-list').val() != '') {
679
- var newserv = revertServices('below');
680
- updatePreview('below', 'small_toolbox', newserv);
681
- $('#below-chosen-list').val(newserv);
682
- }
683
- else {
684
- $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
685
- }
686
- $('.below_button_set').css('opacity', 1);
687
- $('.below-customize-sharing-link').css('opacity', 1);
688
- $('.below-smart-sharing-container').show();
689
  });
690
-
691
  $("#button_above").click( function() {
692
- if($(this).is(':checked')){
693
- $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
694
- }
695
- $('.above_button_set').css('opacity', 1);
696
- $('.above-customize-sharing-link').css('opacity', 1);
697
- $('.above-smart-sharing-container').show();
 
 
 
 
 
 
 
 
 
 
 
698
  });
699
-
700
  $("#button_below").click( function() {
701
- if($(this).is(':checked')){
702
- $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
703
- }
704
- $('.below_button_set').css('opacity', 1);
705
- $('.below-customize-sharing-link').css('opacity', 1);
706
- $('.below-smart-sharing-container').show();
707
  });
708
-
 
 
 
 
 
 
 
 
 
 
 
709
  $("#disable_above").click( function() {
710
- if($(this).is(':checked')){
711
- $('#above_previewContainer').html('');
712
- $('.above_button_set').css('opacity', 0.4);
713
- $('.above-customize-sharing-link').css('opacity', 0);
714
- $('.above-smart-sharing-container').hide();
715
- }
716
  });
717
-
718
  $("#disable_below").click( function() {
719
- if($(this).is(':checked')){
720
- $('#below_previewContainer').html('');
721
- $('.below_button_set').css('opacity', 0.4);
722
- $('.below-customize-sharing-link').css('opacity', 0);
723
- $('.below-smart-sharing-container').hide();
724
- }
725
  });
726
-
727
- $('#submit-button').click(function() {
728
- if($('#above-disable-smart-sharing').is(':checked')) {
729
- if($('#button_above').is(':checked')) {
730
- $('#above-chosen-list').val('');
731
- } else if($('#disable_above').is(':checked')) {
732
- $('#above-chosen-list').val('');
733
- } else {
734
- var list = [];
735
- $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
736
- var service = '';
737
- $(this).find('li').each(function(){
738
- if($(this).hasClass('enabled')) {
739
- list.push($(this).attr('data-service'));
740
- if($(this).attr('data-service') == 'compact') {
741
- list.push('counter');
742
- }
743
- }
744
- });
745
- });
746
- var aboveservices = list.join(', ');
747
- $('#above-chosen-list').val(aboveservices);
748
- }
749
- }
750
- if($('#button_above').is(':checked')) {
751
- $('#above-chosen-list').val('');
752
- }
753
- if($('#disable_above').is(':checked')) {
754
- $('#above-chosen-list').val('');
755
- }
756
-
757
- if($('#below-disable-smart-sharing').is(':checked')) {
758
- if($('#button_below').is(':checked')) {
759
- $('#below-chosen-list').val('');
760
- } else if($('#disable_below').is(':checked')) {
761
- $('#below-chosen-list').val('');
762
- } else {
763
- var list = [];
764
- $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
765
- var service = '';
766
- $(this).find('li').each(function(){
767
- if($(this).hasClass('enabled')) {
768
- list.push($(this).attr('data-service'));
769
- if($(this).attr('data-service') == 'compact') {
770
- list.push('counter');
771
- }
772
- }
773
- });
774
- });
775
- var belowservices = list.join(', ');
776
- $('#below-chosen-list').val(belowservices);
777
- }
778
- }
779
- if($('#button_below').is(':checked')) {
780
- $('#below-chosen-list').val('');
781
- }
782
- if($('#disable_below').is(':checked')) {
783
- $('#below-chosen-list').val('');
784
- }
785
-
786
- });
787
-
788
- var s = $("#preview_floater");
789
- var pos = s.position();
790
- $(window).scroll(function() {
791
- var windowpos = $(window).scrollTop();
792
-
793
- if (windowpos >= pos.top) {
794
- s.addClass("stick");
795
- } else {
796
- s.removeClass("stick");
797
  }
 
798
  });
799
-
800
  $('.folded #collapse-menu').click(function(){
801
- $('#preview_floater').removeClass();
802
- var s = $("#preview_floater");
803
- var pos = s.position();
804
  $(window).scroll(function() {
805
- var windowpos = $(window).scrollTop();
806
-
807
- if (windowpos >= pos.top) {
808
- setTimeout(function(){$('#preview_floater').addClass('stick');},1);
809
- }
810
  });
811
- });
812
-
813
  var dataContent = '';
814
- var dataTitle = '';
815
- var innerContent = '';
816
- var left = 0;
817
- var top = 0;
818
- var popoverHeight = 0;
819
- var parent;
820
- var me;
821
- $('.row-right a').mouseover(function(){
822
- me = $(this);
823
- parent = $(me).parent();
824
-
825
- dataContent = $(parent).attr('data-content');
826
- dataTitle = $(parent).attr('data-original-title');
827
- innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
828
- innerContent = innerContent + dataTitle;
829
- innerContent = innerContent + "</h3><div class='popover-content'>";
830
- innerContent = innerContent + dataContent;
831
- innerContent = innerContent + "</div></div>";
832
- $(parent).append(innerContent);
833
-
834
- popoverHeight = $(parent).find('.popover').height();
835
- left = $(me).position().left + 15;
836
- top = $(me).position().top - (popoverHeight/2) + 8;
837
-
838
- $(parent).find('.popover').css({
839
- 'left': left+'px',
840
- 'top': top+'px'
841
- });
842
- });
843
- $('.row-right a').mouseout(function(){
844
- $('.popover').remove();
845
- });
846
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
847
  });
848
 
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
+ jQuery(document).ready(function($) {
22
+ $( "#config-error" ).hide();
23
+ $( "#share-error" ).hide();
24
  $( "#tabs" ).tabs();
25
+ $( "#Card-above-post" ).tabs();
26
+ $( "#Card-below-post" ).tabs();
27
+ $( "#Card-side-sharing" ).tabs();
28
+
29
+ var thickDims, tbWidth, tbHeight, img = abvimg = belimg = '';
30
+
31
  thickDims = function() {
32
  var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
33
+
34
  w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
35
  h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
36
  if ( tbWindow.size() ) {
42
  }
43
  };
44
 
45
+
46
  $('a.thickbox-preview').click( function() {
47
+
48
  var previewLink = this;
49
+
50
  var $inputs = $('#addthis_settings :input');
51
 
52
  var values = {};
53
  $.each($('#addthis_settings').serializeArray(), function(i, field) {
54
+
55
  var thisName = field.name
56
  if (thisName.indexOf("addthis_settings[") != -1 )
57
  {
58
  thisName = thisName.replace("addthis_settings[", '');
59
  thisName = thisName.replace("]", '');
60
  }
61
+
62
  values[thisName] = field.value;
63
  });
64
 
68
  action: 'at_save_transient',
69
  value : stuff
70
  };
71
+
72
 
73
  jQuery.post(ajaxurl, data, function(response) {
74
 
75
+ // Fix for WP 2.9's version of lightbox
76
  if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
77
  {
78
+ tb_click.call(previewLink);
79
  }
80
  var href = $(previewLink).attr('href');
81
  var link = '';
82
 
83
 
84
+ if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
85
+ tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
86
+ else
87
+ tbWidth = $(window).width() - 90;
88
 
89
+ if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
90
  tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
91
  else
92
  tbHeight = $(window).height() - 60;
 
 
 
 
93
 
94
+ $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
95
+ $('#TB_closeAjaxWindow').css({'float':'left'});
96
+ $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
97
+ $('#TB_iframeContent').width('100%');
98
+ thickDims();
99
 
100
  });
101
  return false;
102
  });
103
 
104
+ var aboveCustom = $('#above_custom_button');
105
  var aboveCustomShow = function(){
106
  if ( aboveCustom.is(':checked'))
107
  {
115
  }
116
  };
117
 
118
+ var belowCustom = $('#below_custom_button');
119
  var belowCustomShow = function(){
120
  if ( belowCustom.is(':checked'))
121
  {
135
  {
136
  $('.above_option').toggleClass('hide');
137
  }
138
+
139
  if ( $('#input[name="addthis_settings[show_below]"]').is(':checked'))
140
  {
141
  $('.below_option').toggleClass('hide');
142
  }
143
+
144
  $('input[name="addthis_settings[show_above]"]').change( function() {
145
  $('.above_option').toggleClass('hide');
146
  });
149
  $('.below_option').toggleClass('hide');
150
  });
151
 
152
+ var aboveCustomString = $('#above_custom_string');
153
  var aboveCustomStringShow = function(){
154
  if ( aboveCustomString.is(':checked'))
155
  {
163
  }
164
  };
165
 
166
+ var belowCustomString = $('#below_custom_string');
167
  var belowCustomStringShow = function(){
168
  if ( belowCustomString.is(':checked'))
169
  {
187
 
188
  /**
189
  * Hide Theming and branding options when user selects version 3.0 or above
190
+ */
191
  var ATVERSION_250 = 250;
192
  var AT_VERSION_300 = 300;
193
  var MANUAL_UPDATE = -1;
199
  } else {
200
  $(".classicFeature").hide();
201
  }
202
+
203
  /**
204
  * Revert to older version after the user upgrades
205
  */
211
  });
212
  /**
213
  * Update to a newer version
214
+ */
215
  $(".addthis-update-atversion").click(function(){
216
  $("#addthis_atversion_update_status").val(MANUAL_UPDATE);
217
  $("#addthis_atversion_hidden").val(AT_VERSION_300);
229
  {"url" : addthis_option_params.wp_ajax_url,
230
  "type" : "post",
231
  "data" : {"action" : addthis_option_params.addthis_validate_action,
232
+ "addthis_profile" : $("#addthis_profile").val()
 
 
233
  },
234
  "dataType" : "json",
235
  "beforeSend" : function() {
265
  }
266
  });
267
  }
268
+
269
+ $("#addthis_profile").change(function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  addthis_credential_validation_status.val(0);
271
  if($.trim($("#addthis_profile").val()) == "") {
272
  addthis_profile_validation_message.next().hide();
273
  }
 
 
 
274
  });
275
 
276
+ $('#addthis_config_json').focusout(function() {
277
+ var error = 0;
278
+ if ($('#addthis_config_json').val() != " ") {
279
+ try {
280
+ var addthis_config_json = jQuery.parseJSON($('#addthis_config_json').val());
281
+ }
282
+ catch (e) {
283
+ $('#config-error').show();
284
+ error = 1;
285
+ }
286
+ }
287
+ if (error == 0) {
288
+ $('#config-error').hide();
289
+ return true;
290
+ } else {
291
+ $('#config-error').show();
292
+ return false;
293
+ }
294
  });
295
+
296
+ $('#addthis_share_json').focusout(function() {
297
+ var error = 0;
298
+ if ($('#addthis_share_json').val() != " ") {
299
+ try {
300
+ var addthis_share_json = jQuery.parseJSON($('#addthis_share_json').val());
301
+ }
302
+ catch (e) {
303
+ $('#share-error').show();
304
+ error = 1;
305
+ }
306
+ }
307
+ if (error == 0) {
308
+ $('#share-error').hide();
309
+ return true;
310
+ } else {
311
+ $('#share-error').show();
312
+ return false;
313
+ }
314
  });
315
+
316
+ $('.addthis-submit-button').click(function() {
317
+ $('#config-error').hide();
318
+ $('#share-error').hide();
319
+ var error = 0;
320
+ if ($('#addthis-config-json').val() != " ") {
321
+ try {
322
+ var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
323
+ }
324
+ catch (e) {
325
+ $('#config-error').show();
326
+ error = 1;
327
+ }
328
+ }
329
+ if ($('#addthis_share_json').val() != " ") {
330
+ try {
331
+ var addthis_share_json = jQuery.parseJSON($('#addthis_share_json').val());
332
+ }
333
+ catch (e) {
334
+ $('#share-error').show();
335
+ error = 1;
336
+ }
337
+ }
338
+ if (error == 0) {
339
+ return true;
340
+ } else {
341
+ return false;
342
+ }
343
  });
344
+
345
+
346
  //preview box
347
  function rewriteServices(posn) {
348
+ var services = $('#'+posn+'-chosen-list').val();
349
+ var service = services.split(', ');
350
+ var i;
351
+ var newservice = '';
352
+ for (i = 0; i < (service.length); ++i) {
353
+ if(service[i] == 'linkedin') {
354
+ newservice += 'linkedin_counter, ';
355
+ }
356
+ else if(service[i] == 'facebook') {
357
+ newservice += 'facebook_like, ';
358
+ }
359
+ else if(service[i] == 'twitter') {
360
+ newservice += 'tweet, ';
361
+ }
362
+ else if(service[i] == 'pinterest_share') {
363
+ newservice += 'pinterest_pinit, ';
364
+ }
365
+ else if(service[i] == 'hyves') {
366
+ newservice += 'hyves_respect, ';
367
+ }
368
+ else if(service[i] == 'google_plusone_share') {
369
+ newservice += 'google_plusone, ';
370
+ }
371
+ else if(service[i] == 'counter' || service[i] == 'compact') {
372
+ newservice += service[i]+', ';
373
+ }
374
+ }
375
+ var newservices = newservice.slice(0,-2);
376
+ return newservices;
377
  }
378
+
379
  function revertServices(posn) {
380
+ var services = $('#'+posn+'-chosen-list').val();
381
+ var service = services.split(', ');
382
+ var i;
383
+ var newservice = '';
384
+ for (i = 0; i < (service.length); ++i) {
385
+ if(service[i] == 'facebook_like') {
386
+ newservice += 'facebook, ';
387
+ }
388
+ else if(service[i] == 'linkedin_counter') {
389
+ newservice += 'linkedin, ';
390
+ }
391
+ else if(service[i] == 'hyves_respect') {
392
+ newservice += 'hyves, ';
393
+ }
394
+ else if(service[i] == 'google_plusone') {
395
+ newservice += 'google_plusone_share, ';
396
+ }
397
+ else if(service[i] == 'tweet') {
398
+ newservice += 'twitter, ';
399
+ }
400
+ else if(service[i] == 'pinterest_pinit') {
401
+ newservice += 'pinterest_share, ';
402
+ }
403
+ else {
404
+ newservice += service[i]+', ';
405
+ }
406
+ }
407
+ var newservices = newservice.slice(0,-2);
408
+ return newservices;
409
  }
410
+
411
  function updatePreview(posn, style, option) {
412
+ var preview = '';
413
+ var service = option.split(', ');
414
+ var i;
415
+
416
+ if(style == 'large_toolbox') {
417
+ preview += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
418
+ for (i = 0; i < (service.length); ++i) {
419
+ if(service[i] == 'counter') {
420
+ preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
421
+ } else {
422
+ preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
423
+ }
424
+ }
425
+ preview += '</div>';
426
+ }
427
+ else if(style == 'fb_tw_p1_sc') {
428
+ for (i = 0; i < (service.length); ++i) {
429
+ if(service[i] == 'compact') {
430
+ preview += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
431
+ }
432
+ else if(service[i] != 'counter') {
433
+ preview += '<img src="'+addthis_option_params.img_base+service[i]+'.png">';
434
+ }
435
+ }
436
+ }
437
+ else if(style == 'small_toolbox') {
438
+ for (i = 0; i < (service.length); ++i) {
439
+ if(service[i] == 'counter') {
440
+ preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
441
+ } else {
442
+ preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
443
+ }
444
+ }
445
+ }
446
+ $('#'+posn+'_previewContainer').html(preview);
447
  }
448
  if($('#large_toolbox_above').is(':checked')) {
449
+ if($('#above-chosen-list').val() == "") {
450
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
451
+ } else {
452
+ abvimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
453
+ var aboveserv = $('#above-chosen-list').val();
454
+ var aservice = aboveserv.split(', ');
455
+ var i;
456
+ for (i = 0; i < (aservice.length); ++i) {
457
+ if(aservice[i] == 'counter') {
458
+ abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
459
+ } else {
460
+ abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
461
+ }
462
+ }
463
+ abvimg += '</div>';
464
+ }
465
+ $('.above_button_set').css('opacity', 1);
466
+ $('.above-customize-sharing-link').css('opacity', 1);
467
+ $('.above-smart-sharing-container').show();
468
+ $('#above_previewContainer').html(abvimg);
469
  } else if($('#fb_tw_p1_sc_above').is(':checked')) {
470
+ if($('#above-chosen-list').val() == "") {
471
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
472
+ } else {
473
+ var aboveserv = $('#above-chosen-list').val();
474
+ var aservice = aboveserv.split(', ');
475
+ var i;
476
+ for (i = 0; i < (aservice.length); ++i) {
477
+ if(aservice[i] == 'compact') {
478
+ abvimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
479
+ }
480
+ else if(aservice[i] != 'counter') {
481
+ abvimg += '<img src="'+addthis_option_params.img_base+aservice[i]+'.png">';
482
+ }
483
+ }
484
+ }
485
+ $('.above_button_set').css('opacity', 1);
486
+ $('.above-customize-sharing-link').css('opacity', 1);
487
+ $('.above-smart-sharing-container').show();
488
+ $('#above_previewContainer').html(abvimg);
489
+ } else if($('#small_toolbox_above').is(':checked')) {
490
+ if($('#above-chosen-list').val() == "") {
491
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
492
+ } else {
493
+ var aboveserv = $('#above-chosen-list').val();
494
+ var aservice = aboveserv.split(', ');
495
+ var i;
496
+ for (i = 0; i < (aservice.length); ++i) {
497
+ if(aservice[i] == 'counter') {
498
+ abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
499
+ } else {
500
+ abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
501
+ }
502
+ }
503
+ }
504
+ $('.above_button_set').css('opacity', 1);
505
+ $('.above-customize-sharing-link').css('opacity', 1);
506
+ $('.above-smart-sharing-container').show();
507
+ $('#above_previewContainer').html(abvimg);
508
+ } else if($('#button_above').is(':checked')) {
509
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
510
+ $('.above_button_set').css('opacity', 1);
511
+ $('.above-customize-sharing-link').css('opacity', 0);
512
+ $('.above-smart-sharing-container').hide();
513
+ $('#above_previewContainer').html(abvimg);
514
+ } else if($('#above_custom_string').is(':checked')) {
515
+ $('.above_button_set').css('opacity', 0);
516
+ $('.above-smart-sharing-container').hide();
517
+ } else if($('#disable_above').is(':checked')) {
518
+ abvimg = '';
519
+ $('.above_button_set').css('opacity', 0.4);
520
+ $('.above-customize-sharing-link').css('opacity', 0);
521
+ $('.above-smart-sharing-container').hide();
522
+ $('#above_previewContainer').html(abvimg);
523
+ }
524
+
525
+ if($('#large_toolbox_below').is(':checked')) {
526
+ if($('#below-chosen-list').val() == "") {
527
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
528
+ } else {
529
+ belimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
530
+ var belowserv = $('#below-chosen-list').val();
531
+ var bservice = belowserv.split(', ');
532
+ var i;
533
+ for (i = 0; i < (bservice.length); ++i) {
534
+ if(bservice[i] == 'counter') {
535
+ belimg +='<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
536
+ } else {
537
+ belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
538
+ }
539
+ }
540
+ belimg += '</div>';
541
+
542
+ }
543
+ $('.below_button_set').css('opacity', 1);
544
+ $('.below-customize-sharing-link').css('opacity', 1);
545
+ $('.below-smart-sharing-container').show();
546
+ $('#below_previewContainer').html(belimg);
547
+ } else if($('#fb_tw_p1_sc_below').is(':checked')) {
548
+ if($('#below-chosen-list').val() == "") {
549
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
550
+ } else {
551
+ var belowserv = $('#below-chosen-list').val();
552
+ var bservice = belowserv.split(', ');
553
+ var i;
554
+ for (i = 0; i < (bservice.length-1); ++i) {
555
+ if(bservice[i] == 'compact') {
556
+ belimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
557
+ } else if(bservice[i] != 'counter') {
558
+ belimg += '<img src="'+addthis_option_params.img_base+bservice[i]+'.png">';
559
+ }
560
+ }
561
+ }
562
+ $('.below_button_set').css('opacity', 1);
563
+ $('.below-customize-sharing-link').css('opacity', 1);
564
+ $('.below-smart-sharing-container').show();
565
+ $('#below_previewContainer').html(belimg);
566
+ } else if($('#small_toolbox_below').is(':checked')) {
567
+ if($('#below-chosen-list').val() == "") {
568
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
569
+ } else {
570
+ var belowserv = $('#below-chosen-list').val();
571
+ var bservice = belowserv.split(', ');
572
+ var i;
573
+ for (i = 0; i < (bservice.length); ++i) {
574
+ if(bservice[i] == 'counter') {
575
+ belimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
576
+ } else {
577
+ belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
578
+ }
579
+ }
580
+ }
581
+ $('.below_button_set').css('opacity', 1);
582
+ $('.below-customize-sharing-link').css('opacity', 1);
583
+ $('.below-smart-sharing-container').show();
584
+ $('#below_previewContainer').html(belimg);
585
+ } else if($('#button_below').is(':checked')) {
586
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
587
+ $('.below_button_set').css('opacity', 1);
588
+ $('.below-customize-sharing-link').css('opacity', 0);
589
+ $('.below-smart-sharing-container').hide();
590
+ $('#below_previewContainer').html(belimg);
591
+ } else if($('#below_custom_string').is(':checked')) {
592
+ $('.below_button_set').css('opacity', 0);
593
+ $('.below-smart-sharing-container').hide();
594
+ } else if($('#disable_below').is(':checked')) {
595
+ belimg = '';
596
+ $('.below_button_set').css('opacity', 0.4);
597
+ $('.below-customize-sharing-link').css('opacity', 0);
598
+ $('.below-smart-sharing-container').hide();
599
+ $('#below_previewContainer').html(belimg);
600
+ }
601
 
602
  $("#large_toolbox_above").click( function() {
603
+ if($('#above-chosen-list').val() != '') {
604
+ var newserv = revertServices('above');
605
+ updatePreview('above', 'large_toolbox', newserv);
606
+ $('#above-chosen-list').val(newserv);
607
+ }
608
+ else {
609
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
610
+ }
611
+ $('.above_button_set').css('opacity', 1);
612
+ $('.above-customize-sharing-link').css('opacity', 1);
613
+ $('.above-smart-sharing-container').show();
614
  });
615
+
616
  $("#large_toolbox_below").click( function() {
617
+ if($('#below-chosen-list').val() != '') {
618
+ var newserv = revertServices('below');
619
+ updatePreview('below', 'large_toolbox', newserv);
620
+ $('#below-chosen-list').val(newserv);
621
+ }
622
+ else {
623
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
624
+ }
625
+ $('.below_button_set').css('opacity', 1);
626
+ $('.below-customize-sharing-link').css('opacity', 1);
627
+ $('.below-smart-sharing-container').show();
628
  });
629
 
630
  $("#fb_tw_p1_sc_above").click( function() {
631
+ if($('#above-chosen-list').val() != '') {
632
+ var newserv = rewriteServices('above');
633
+ updatePreview('above', 'fb_tw_p1_sc', newserv);
634
+ $('#above-chosen-list').val(newserv);
635
+ }
636
+ else {
637
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
638
+ }
639
+ $('.above_button_set').css('opacity', 1);
640
+ $('.above-customize-sharing-link').css('opacity', 1);
641
+ $('.above-smart-sharing-container').show();
642
  });
643
+
644
  $("#fb_tw_p1_sc_below").click( function() {
645
+ if($('#below-chosen-list').val() != '') {
646
+ var newserv = rewriteServices('below');
647
+ updatePreview('below', 'fb_tw_p1_sc', newserv);
648
+ $('#below-chosen-list').val(newserv);
649
+ }
650
+ else {
651
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
652
+ }
653
+ $('.below_button_set').css('opacity', 1);
654
+ $('.below-customize-sharing-link').css('opacity', 1);
655
+ $('.below-smart-sharing-container').show();
656
  });
657
+
658
  $("#small_toolbox_above").click( function() {
659
+ if($('#above-chosen-list').val() != '') {
660
+ var newserv = revertServices('above');
661
+ updatePreview('above', 'small_toolbox', newserv);
662
+ $('#above-chosen-list').val(newserv);
663
+ }
664
+ else {
665
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
666
+ }
667
+ $('.above_button_set').css('opacity', 1);
668
+ $('.above-customize-sharing-link').css('opacity', 1);
669
+ $('.above-smart-sharing-container').show();
670
  });
671
+
672
  $("#small_toolbox_below").click( function() {
673
+ if($('#below-chosen-list').val() != '') {
674
+ var newserv = revertServices('below');
675
+ updatePreview('below', 'small_toolbox', newserv);
676
+ $('#below-chosen-list').val(newserv);
677
+ }
678
+ else {
679
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
680
+ }
681
+ $('.below_button_set').css('opacity', 1);
682
+ $('.below-customize-sharing-link').css('opacity', 1);
683
+ $('.below-smart-sharing-container').show();
684
  });
685
+
686
  $("#button_above").click( function() {
687
+ if($(this).is(':checked')){
688
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
689
+ }
690
+ $('.above_button_set').css('opacity', 1);
691
+ $('.above-customize-sharing-link').css('opacity', 1);
692
+ $('.above-smart-sharing-container').show();
693
+ });
694
+
695
+ $("#above_custom_string").click( function() {
696
+ if($(this).is(':checked')){
697
+ $('.above_button_set').css('opacity', 0);
698
+ $('.above-smart-sharing-container').hide();
699
+ } else {
700
+ $('.above_button_set').css('opacity', 1);
701
+ $('.above-customize-sharing-link').css('opacity', 1);
702
+ $('.above-smart-sharing-container').show();
703
+ }
704
  });
705
+
706
  $("#button_below").click( function() {
707
+ if($(this).is(':checked')){
708
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
709
+ }
710
+ $('.below_button_set').css('opacity', 1);
711
+ $('.below-customize-sharing-link').css('opacity', 1);
712
+ $('.below-smart-sharing-container').show();
713
  });
714
+
715
+ $("#below_custom_string").click( function() {
716
+ if($(this).is(':checked')){
717
+ $('.below_button_set').css('opacity', 0);
718
+ $('.below-smart-sharing-container').hide();
719
+ } else {
720
+ $('.below_button_set').css('opacity', 1);
721
+ $('.below-customize-sharing-link').css('opacity', 1);
722
+ $('.below-smart-sharing-container').show();
723
+ }
724
+ });
725
+
726
  $("#disable_above").click( function() {
727
+ if($(this).is(':checked')){
728
+ $('#above_previewContainer').html('');
729
+ $('.above_button_set').css('opacity', 0.4);
730
+ $('.above-customize-sharing-link').css('opacity', 0);
731
+ $('.above-smart-sharing-container').hide();
732
+ }
733
  });
734
+
735
  $("#disable_below").click( function() {
736
+ if($(this).is(':checked')){
737
+ $('#below_previewContainer').html('');
738
+ $('.below_button_set').css('opacity', 0.4);
739
+ $('.below-customize-sharing-link').css('opacity', 0);
740
+ $('.below-smart-sharing-container').hide();
741
+ }
742
  });
743
+
744
+ $('.addthis-submit-button').click(function() {
745
+ if($('#above-disable-smart-sharing').is(':checked')) {
746
+ if($('#button_above').is(':checked')) {
747
+ $('#above-chosen-list').val('');
748
+ } else if($('#disable_above').is(':checked')) {
749
+ $('#above-chosen-list').val('');
750
+ } else {
751
+ var list = [];
752
+ $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
753
+ var service = '';
754
+ $(this).find('li').each(function(){
755
+ if($(this).hasClass('enabled')) {
756
+ list.push($(this).attr('data-service'));
757
+ if($(this).attr('data-service') == 'compact') {
758
+ list.push('counter');
759
+ }
760
+ }
761
+ });
762
+ });
763
+ var aboveservices = list.join(', ');
764
+ $('#above-chosen-list').val(aboveservices);
765
+ }
766
+ }
767
+ if($('#button_above').is(':checked')) {
768
+ $('#above-chosen-list').val('');
769
+ }
770
+ if($('#disable_above').is(':checked')) {
771
+ $('#above-chosen-list').val('');
772
+ }
773
+
774
+ if($('#below-disable-smart-sharing').is(':checked')) {
775
+ if($('#button_below').is(':checked')) {
776
+ $('#below-chosen-list').val('');
777
+ } else if($('#disable_below').is(':checked')) {
778
+ $('#below-chosen-list').val('');
779
+ } else {
780
+ var list = [];
781
+ $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
782
+ var service = '';
783
+ $(this).find('li').each(function(){
784
+ if($(this).hasClass('enabled')) {
785
+ list.push($(this).attr('data-service'));
786
+ if($(this).attr('data-service') == 'compact') {
787
+ list.push('counter');
788
+ }
789
+ }
790
+ });
791
+ });
792
+ var belowservices = list.join(', ');
793
+ $('#below-chosen-list').val(belowservices);
794
+ }
795
+ }
796
+ if($('#button_below').is(':checked')) {
797
+ $('#below-chosen-list').val('');
798
+ }
799
+ if($('#disable_below').is(':checked')) {
800
+ $('#below-chosen-list').val('');
801
+ }
802
+
803
+ if($("#tabs .ui-state-active > a").html() == "Mode") {
804
+ $( "#tabs" ).tabs("option", "active", 0);
 
 
 
 
 
 
 
 
 
805
  }
806
+
807
  });
808
+
809
  $('.folded #collapse-menu').click(function(){
810
+ $('#preview_floater').removeClass();
811
+ var s = $("#preview_floater");
812
+ var pos = s.position();
813
  $(window).scroll(function() {
814
+ var windowpos = $(window).scrollTop();
815
+
816
+ if (windowpos >= pos.top) {
817
+ setTimeout(function(){$('#preview_floater').addClass('stick');},1);
818
+ }
819
  });
820
+ });
821
+
822
  var dataContent = '';
823
+ var dataTitle = '';
824
+ var innerContent = '';
825
+ var left = 0;
826
+ var top = 0;
827
+ var popoverHeight = 0;
828
+ var parent;
829
+ var me;
830
+ $('.row-right a').mouseover(function(){
831
+ me = $(this);
832
+ parent = $(me).parent();
833
+
834
+ dataContent = $(parent).attr('data-content');
835
+ dataTitle = $(parent).attr('data-original-title');
836
+ innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
837
+ innerContent = innerContent + dataTitle;
838
+ innerContent = innerContent + "</h3><div class='popover-content'>";
839
+ innerContent = innerContent + dataContent;
840
+ innerContent = innerContent + "</div></div>";
841
+ $(parent).append(innerContent);
842
+
843
+ popoverHeight = $(parent).find('.popover').height();
844
+ left = $(me).position().left + 15;
845
+ top = $(me).position().top - (popoverHeight/2) + 8;
846
+
847
+ $(parent).find('.popover').css({
848
+ 'left': left+'px',
849
+ 'top': top+'px'
850
+ });
851
+ });
852
+ $('.row-right a').mouseout(function(){
853
+ $('.popover').remove();
854
+ });
855
+
856
+ //Keep the user in current tab
857
+ $(function() {
858
+ var index = 'key';
859
+ var dataStore = window.sessionStorage;
860
+ try {
861
+ var oldIndex = dataStore.getItem(index);
862
+ } catch(e) {
863
+ var oldIndex = 0;
864
+ }
865
+ $('#tabs').tabs({
866
+ active : oldIndex,
867
+ activate : function( event, ui ){
868
+ var newIndex = ui.newTab.parent().children().index(ui.newTab);
869
+ dataStore.setItem( index, newIndex ) // Set future value
870
+ }
871
+ });
872
+ });
873
+
874
+ //Setting checkbox checked
875
+ $('.switch').click(function()
876
+ {
877
+ $(this).toggleClass("switchOn");
878
+ var id = $(this).attr('id').replace('_switch','');
879
+ if($('#'+id).attr('checked')){
880
+ $('#'+id).prop('checked', false);
881
+ $("."+id+'_overlay').css('pointer-events', 'none');
882
+ $("."+id+'_overlay').css('opacity', '0.5');
883
+ } else {
884
+ $('#'+id).prop('checked', true);
885
+ $("."+id+'_overlay').css('opacity', '1');
886
+ $("."+id+'_overlay').css('pointer-events', 'auto');
887
+ }
888
+ });
889
+
890
+ //Default overlay - disabled tools
891
+ $('.addthis-toggle-cb').each(function() {
892
+ var id = $(this).attr('id');
893
+ if(!$('#'+id).attr('checked')){
894
+ $("."+id+'_overlay').css('pointer-events', 'none');
895
+ $("."+id+'_overlay').css('opacity', '0.5');
896
+ }
897
+ });
898
+
899
+ //Show sidebar preview based on the user selected
900
+ $('[id^=sbpreview_]').hide();
901
+ var current_sbpreview_id = "sbpreview_"+$('#addthis_sidebar_theme').val();
902
+ $('#'+current_sbpreview_id).show();
903
+ $('#addthis_sidebar_theme').on('change', function() {
904
+ var preview_id = "sbpreview_"+$('#addthis_sidebar_theme option:selected').val();
905
+ $('[id^=sbpreview_]').hide();
906
+ $('#'+preview_id).show();
907
+ });
908
+
909
  });
910
 
js/options-page.js CHANGED
@@ -1,14 +1,33 @@
1
- jQuery(document).ready(function($) {
2
-
3
- $( "#config-error" ).hide();
4
- $( "#share-error" ).hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  $( "#tabs" ).tabs();
6
-
7
- var thickDims, tbWidth, tbHeight, img = abvimg = belimg = '';
8
-
9
  thickDims = function() {
10
  var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
11
-
12
  w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
13
  h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
14
  if ( tbWindow.size() ) {
@@ -20,23 +39,23 @@ jQuery(document).ready(function($) {
20
  }
21
  };
22
 
23
-
24
  $('a.thickbox-preview').click( function() {
25
-
26
  var previewLink = this;
27
-
28
  var $inputs = $('#addthis_settings :input');
29
 
30
  var values = {};
31
  $.each($('#addthis_settings').serializeArray(), function(i, field) {
32
-
33
  var thisName = field.name
34
  if (thisName.indexOf("addthis_settings[") != -1 )
35
  {
36
  thisName = thisName.replace("addthis_settings[", '');
37
  thisName = thisName.replace("]", '');
38
  }
39
-
40
  values[thisName] = field.value;
41
  });
42
 
@@ -46,42 +65,42 @@ jQuery(document).ready(function($) {
46
  action: 'at_save_transient',
47
  value : stuff
48
  };
49
-
50
 
51
  jQuery.post(ajaxurl, data, function(response) {
52
 
53
- // Fix for WP 2.9's version of lightbox
54
  if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
55
  {
56
- tb_click.call(previewLink);
57
  }
58
  var href = $(previewLink).attr('href');
59
  var link = '';
60
 
61
 
62
- if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
63
- tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
64
- else
65
- tbWidth = $(window).width() - 90;
66
 
67
- if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
68
  tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
69
  else
70
  tbHeight = $(window).height() - 60;
71
-
72
- $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
73
- $('#TB_closeAjaxWindow').css({'float':'left'});
74
- $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
75
 
76
- $('#TB_iframeContent').width('100%');
 
 
77
 
78
- thickDims();
 
 
79
 
80
  });
81
  return false;
82
  });
83
 
84
- var aboveCustom = $('#above_custom_button');
85
  var aboveCustomShow = function(){
86
  if ( aboveCustom.is(':checked'))
87
  {
@@ -95,7 +114,7 @@ jQuery(document).ready(function($) {
95
  }
96
  };
97
 
98
- var belowCustom = $('#below_custom_button');
99
  var belowCustomShow = function(){
100
  if ( belowCustom.is(':checked'))
101
  {
@@ -115,12 +134,12 @@ jQuery(document).ready(function($) {
115
  {
116
  $('.above_option').toggleClass('hide');
117
  }
118
-
119
  if ( $('#input[name="addthis_settings[show_below]"]').is(':checked'))
120
  {
121
  $('.below_option').toggleClass('hide');
122
  }
123
-
124
  $('input[name="addthis_settings[show_above]"]').change( function() {
125
  $('.above_option').toggleClass('hide');
126
  });
@@ -129,7 +148,7 @@ jQuery(document).ready(function($) {
129
  $('.below_option').toggleClass('hide');
130
  });
131
 
132
- var aboveCustomString = $('#above_custom_string');
133
  var aboveCustomStringShow = function(){
134
  if ( aboveCustomString.is(':checked'))
135
  {
@@ -143,7 +162,7 @@ jQuery(document).ready(function($) {
143
  }
144
  };
145
 
146
- var belowCustomString = $('#below_custom_string');
147
  var belowCustomStringShow = function(){
148
  if ( belowCustomString.is(':checked'))
149
  {
@@ -167,7 +186,7 @@ jQuery(document).ready(function($) {
167
 
168
  /**
169
  * Hide Theming and branding options when user selects version 3.0 or above
170
- */
171
  var ATVERSION_250 = 250;
172
  var AT_VERSION_300 = 300;
173
  var MANUAL_UPDATE = -1;
@@ -179,7 +198,7 @@ jQuery(document).ready(function($) {
179
  } else {
180
  $(".classicFeature").hide();
181
  }
182
-
183
  /**
184
  * Revert to older version after the user upgrades
185
  */
@@ -191,7 +210,7 @@ jQuery(document).ready(function($) {
191
  });
192
  /**
193
  * Update to a newer version
194
- */
195
  $(".addthis-update-atversion").click(function(){
196
  $("#addthis_atversion_update_status").val(MANUAL_UPDATE);
197
  $("#addthis_atversion_hidden").val(AT_VERSION_300);
@@ -209,9 +228,7 @@ jQuery(document).ready(function($) {
209
  {"url" : addthis_option_params.wp_ajax_url,
210
  "type" : "post",
211
  "data" : {"action" : addthis_option_params.addthis_validate_action,
212
- "addthis_profile" : $("#addthis_profile").val(),
213
- "addthis_username" : $("#addthis_username").val(),
214
- "addthis_password" : $("#addthis_password").val()
215
  },
216
  "dataType" : "json",
217
  "beforeSend" : function() {
@@ -247,601 +264,600 @@ jQuery(document).ready(function($) {
247
  }
248
  });
249
  }
250
- //Prevent default form submission
251
- $("#addthis_settings").submit(function(){
252
- if(window.skipValidationInternalError) {
253
- return true;
254
- }
255
- var isProfileEmpty = $.trim($("#addthis_profile").val()) == "";
256
- var isUsernameEmpty = $.trim($("#addthis_username").val()) == "";
257
- var isPasswordEmpty = $.trim($("#addthis_password").val()) == "";
258
- var isAnyFieldEmpty = isProfileEmpty || isUsernameEmpty || isPasswordEmpty;
259
- var validationRequired = addthis_credential_validation_status.val() == 0;
260
-
261
- if(isUsernameEmpty != isPasswordEmpty) {
262
- var emptyLabel = isUsernameEmpty ? "username" : "password";
263
- addthis_validation_message.html("&#x2716; AddThis " + emptyLabel + " is required to view analytics").next().hide();
264
- return false;
265
- } else if (isProfileEmpty && !isUsernameEmpty && !isPasswordEmpty) {
266
- addthis_profile_validation_message.html("&#x2716; AddThis profile ID is required to view analytics").next().hide();
267
- $('html, body').animate({"scrollTop":0}, 'slow');
268
- return false;
269
- } else if (!validationRequired || isAnyFieldEmpty) {
270
- return true;
271
- } else if(!isAnyFieldEmpty && validationRequired) {
272
- validate_addthis_credentials();
273
- return false;
274
- }
275
- });
276
-
277
- $("#addthis_username, #addthis_password, #addthis_profile").change(function(){
278
  addthis_credential_validation_status.val(0);
279
  if($.trim($("#addthis_profile").val()) == "") {
280
  addthis_profile_validation_message.next().hide();
281
  }
282
- if(($.trim($("#addthis_username").val()) == "") || ($.trim($("#addthis_password").val()) == "")) {
283
- addthis_validation_message.next().hide();
284
- }
285
  });
286
 
287
- $('#addthis-config-json').focusout(function() {
288
- var error = 0;
289
- if ($('#addthis-config-json').val() != " ") {
290
- try {
291
- var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
292
- }
293
- catch (e) {
294
- $('#config-error').show();
295
- error = 1;
296
- }
297
- }
298
- if (error == 0) {
299
- $('#config-error').hide();
300
- return true;
301
- } else {
302
- $('#config-error').show();
303
- return false;
304
- }
305
  });
306
-
307
- $('#addthis-share-json').focusout(function() {
308
- var error = 0;
309
- if ($('#addthis-share-json').val() != " ") {
310
- try {
311
- var addthis_share_json = jQuery.parseJSON($('#addthis-share-json').val());
312
- }
313
- catch (e) {
314
- $('#share-error').show();
315
- error = 1;
316
- }
317
- }
318
- if (error == 0) {
319
- $('#share-error').hide();
320
- return true;
321
- } else {
322
- $('#share-error').show();
323
- return false;
324
- }
325
  });
326
-
327
- $('#submit-button').click(function() {
328
- $('#config-error').hide();
329
- $('#share-error').hide();
330
- var error = 0;
331
- if ($('#addthis-config-json').val() != " ") {
332
- try {
333
- var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
334
- }
335
- catch (e) {
336
- $('#config-error').show();
337
- error = 1;
338
- }
339
- }
340
- if ($('#addthis-share-json').val() != " ") {
341
- try {
342
- var addthis_share_json = jQuery.parseJSON($('#addthis-share-json').val());
343
- }
344
- catch (e) {
345
- $('#share-error').show();
346
- error = 1;
347
- }
348
- }
349
- if (error == 0) {
350
- return true;
351
- } else {
352
- return false;
353
- }
354
  });
355
-
356
-
357
  //preview box
358
  function rewriteServices(posn) {
359
- var services = $('#'+posn+'-chosen-list').val();
360
- var service = services.split(', ');
361
- var i;
362
- var newservice = '';
363
- for (i = 0; i < (service.length); ++i) {
364
- if(service[i] == 'linkedin') {
365
- newservice += 'linkedin_counter, ';
366
- }
367
- else if(service[i] == 'facebook') {
368
- newservice += 'facebook_like, ';
369
- }
370
- else if(service[i] == 'twitter') {
371
- newservice += 'tweet, ';
372
- }
373
- else if(service[i] == 'pinterest_share') {
374
- newservice += 'pinterest_pinit, ';
375
- }
376
- else if(service[i] == 'hyves') {
377
- newservice += 'hyves_respect, ';
378
- }
379
- else if(service[i] == 'google_plusone_share') {
380
- newservice += 'google_plusone, ';
381
- }
382
- else if(service[i] == 'counter' || service[i] == 'compact') {
383
- newservice += service[i]+', ';
384
- }
385
- }
386
- var newservices = newservice.slice(0,-2);
387
- return newservices;
388
  }
389
-
390
  function revertServices(posn) {
391
- var services = $('#'+posn+'-chosen-list').val();
392
- var service = services.split(', ');
393
- var i;
394
- var newservice = '';
395
- for (i = 0; i < (service.length); ++i) {
396
- if(service[i] == 'facebook_like') {
397
- newservice += 'facebook, ';
398
- }
399
- else if(service[i] == 'linkedin_counter') {
400
- newservice += 'linkedin, ';
401
- }
402
- else if(service[i] == 'hyves_respect') {
403
- newservice += 'hyves, ';
404
- }
405
- else if(service[i] == 'google_plusone') {
406
- newservice += 'google_plusone_share, ';
407
- }
408
- else if(service[i] == 'tweet') {
409
- newservice += 'twitter, ';
410
- }
411
- else if(service[i] == 'pinterest_pinit') {
412
- newservice += 'pinterest_share, ';
413
- }
414
- else {
415
- newservice += service[i]+', ';
416
- }
417
- }
418
- var newservices = newservice.slice(0,-2);
419
- return newservices;
420
  }
421
-
422
  function updatePreview(posn, style, option) {
423
- var preview = '';
424
- var service = option.split(', ');
425
- var i;
426
- if(style == 'large_toolbox') {
427
- preview += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
428
- for (i = 0; i < (service.length); ++i) {
429
- if(service[i] == 'counter') {
430
- preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
431
- } else {
432
- preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
433
- }
434
- }
435
- preview += '</div>';
436
- }
437
- else if(style == 'fb_tw_p1_sc') {
438
- for (i = 0; i < (service.length); ++i) {
439
- if(service[i] == 'compact') {
440
- preview += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
441
- }
442
- else if(service[i] != 'counter') {
443
- preview += '<img src="'+addthis_option_params.img_base+service[i]+'.png">';
444
- }
445
- }
446
- }
447
- else if(style == 'small_toolbox') {
448
- for (i = 0; i < (service.length); ++i) {
449
- if(service[i] == 'counter') {
450
- preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
451
- } else {
452
- preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
453
- }
454
- }
455
- }
456
- $('#'+posn+'_previewContainer').html(preview);
457
  }
458
  if($('#large_toolbox_above').is(':checked')) {
459
- if($('#above-chosen-list').val() == "") {
460
- abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
461
- } else {
462
- abvimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
463
- var aboveserv = $('#above-chosen-list').val();
464
- var aservice = aboveserv.split(', ');
465
- var i;
466
- for (i = 0; i < (aservice.length); ++i) {
467
- if(aservice[i] == 'counter') {
468
- abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
469
- } else {
470
- abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
471
- }
472
- }
473
- abvimg += '</div>';
474
- }
475
- $('.above_button_set').css('opacity', 1);
476
- $('.above-customize-sharing-link').css('opacity', 1);
477
- $('.above-smart-sharing-container').show();
478
- $('#above_previewContainer').html(abvimg);
479
  } else if($('#fb_tw_p1_sc_above').is(':checked')) {
480
- if($('#above-chosen-list').val() == "") {
481
- abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
482
- } else {
483
- var aboveserv = $('#above-chosen-list').val();
484
- var aservice = aboveserv.split(', ');
485
- var i;
486
- for (i = 0; i < (aservice.length); ++i) {
487
- if(aservice[i] == 'compact') {
488
- abvimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
489
- }
490
- else if(aservice[i] != 'counter') {
491
- abvimg += '<img src="'+addthis_option_params.img_base+aservice[i]+'.png">';
492
- }
493
- }
494
- }
495
- $('.above_button_set').css('opacity', 1);
496
- $('.above-customize-sharing-link').css('opacity', 1);
497
- $('.above-smart-sharing-container').show();
498
- $('#above_previewContainer').html(abvimg);
499
- } else if($('#small_toolbox_above').is(':checked')) {
500
- if($('#above-chosen-list').val() == "") {
501
- abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
502
- } else {
503
- var aboveserv = $('#above-chosen-list').val();
504
- var aservice = aboveserv.split(', ');
505
- var i;
506
- for (i = 0; i < (aservice.length); ++i) {
507
- if(aservice[i] == 'counter') {
508
- abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
509
- } else {
510
- abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
511
- }
512
- }
513
- }
514
- $('.above_button_set').css('opacity', 1);
515
- $('.above-customize-sharing-link').css('opacity', 1);
516
- $('.above-smart-sharing-container').show();
517
- $('#above_previewContainer').html(abvimg);
518
- } else if($('#button_above').is(':checked')) {
519
- abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
520
- $('.above_button_set').css('opacity', 1);
521
- $('.above-customize-sharing-link').css('opacity', 0);
522
- $('.above-smart-sharing-container').hide();
523
- $('#above_previewContainer').html(abvimg);
524
- } else if($('#disable_above').is(':checked')) {
525
- abvimg = '';
526
- $('.above_button_set').css('opacity', 0.4);
527
- $('.above-customize-sharing-link').css('opacity', 0);
528
- $('.above-smart-sharing-container').hide();
529
- $('#above_previewContainer').html(abvimg);
530
- }
531
-
532
- if($('#large_toolbox_below').is(':checked')) {
533
- if($('#below-chosen-list').val() == "") {
534
- belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
535
- } else {
536
- belimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
537
- var belowserv = $('#below-chosen-list').val();
538
- var bservice = belowserv.split(', ');
539
- var i;
540
- for (i = 0; i < (bservice.length); ++i) {
541
- if(bservice[i] == 'counter') {
542
- belimg +='<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
543
- } else {
544
- belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
545
- }
546
- }
547
- belimg += '</div>';
548
-
549
- }
550
- $('.below_button_set').css('opacity', 1);
551
- $('.below-customize-sharing-link').css('opacity', 1);
552
- $('.below-smart-sharing-container').show();
553
- $('#below_previewContainer').html(belimg);
554
- } else if($('#fb_tw_p1_sc_below').is(':checked')) {
555
- if($('#below-chosen-list').val() == "") {
556
- belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
557
- } else {
558
- var belowserv = $('#below-chosen-list').val();
559
- var bservice = belowserv.split(', ');
560
- var i;
561
- for (i = 0; i < (bservice.length-1); ++i) {
562
- if(bservice[i] == 'compact') {
563
- belimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
564
- } else if(bservice[i] != 'counter') {
565
- belimg += '<img src="'+addthis_option_params.img_base+bservice[i]+'.png">';
566
- }
567
- }
568
- }
569
- $('.below_button_set').css('opacity', 1);
570
- $('.below-customize-sharing-link').css('opacity', 1);
571
- $('.below-smart-sharing-container').show();
572
- $('#below_previewContainer').html(belimg);
573
- } else if($('#small_toolbox_below').is(':checked')) {
574
- if($('#below-chosen-list').val() == "") {
575
- belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
576
- } else {
577
- var belowserv = $('#below-chosen-list').val();
578
- var bservice = belowserv.split(', ');
579
- var i;
580
- for (i = 0; i < (bservice.length); ++i) {
581
- if(bservice[i] == 'counter') {
582
- belimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
583
- } else {
584
- belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
585
- }
586
- }
587
- }
588
- $('.below_button_set').css('opacity', 1);
589
- $('.below-customize-sharing-link').css('opacity', 1);
590
- $('.below-smart-sharing-container').show();
591
- $('#below_previewContainer').html(belimg);
592
- } else if($('#button_below').is(':checked')) {
593
- belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
594
- $('.below_button_set').css('opacity', 1);
595
- $('.below-customize-sharing-link').css('opacity', 0);
596
- $('.below-smart-sharing-container').hide();
597
- $('#below_previewContainer').html(belimg);
598
- } else if($('#disable_below').is(':checked')) {
599
- belimg = '';
600
- $('.below_button_set').css('opacity', 0.4);
601
- $('.below-customize-sharing-link').css('opacity', 0);
602
- $('.below-smart-sharing-container').hide();
603
- $('#below_previewContainer').html(belimg);
604
- }
 
 
 
 
 
 
605
 
606
  $("#large_toolbox_above").click( function() {
607
- if($('#above-chosen-list').val() != '') {
608
- var newserv = revertServices('above');
609
- updatePreview('above', 'large_toolbox', newserv);
610
- $('#above-chosen-list').val(newserv);
611
- }
612
- else {
613
- $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
614
- }
615
- $('.above_button_set').css('opacity', 1);
616
- $('.above-customize-sharing-link').css('opacity', 1);
617
- $('.above-smart-sharing-container').show();
618
  });
619
-
620
  $("#large_toolbox_below").click( function() {
621
- if($('#below-chosen-list').val() != '') {
622
- var newserv = revertServices('below');
623
- updatePreview('below', 'large_toolbox', newserv);
624
- $('#below-chosen-list').val(newserv);
625
- }
626
- else {
627
- $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
628
- }
629
- $('.below_button_set').css('opacity', 1);
630
- $('.below-customize-sharing-link').css('opacity', 1);
631
- $('.below-smart-sharing-container').show();
632
  });
633
 
634
  $("#fb_tw_p1_sc_above").click( function() {
635
- if($('#above-chosen-list').val() != '') {
636
- var newserv = rewriteServices('above');
637
- updatePreview('above', 'fb_tw_p1_sc', newserv);
638
- $('#above-chosen-list').val(newserv);
639
- }
640
- else {
641
- $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
642
- }
643
- $('.above_button_set').css('opacity', 1);
644
- $('.above-customize-sharing-link').css('opacity', 1);
645
- $('.above-smart-sharing-container').show();
646
  });
647
-
648
  $("#fb_tw_p1_sc_below").click( function() {
649
- if($('#below-chosen-list').val() != '') {
650
- var newserv = rewriteServices('below');
651
- updatePreview('below', 'fb_tw_p1_sc', newserv);
652
- $('#below-chosen-list').val(newserv);
653
- }
654
- else {
655
- $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
656
- }
657
- $('.below_button_set').css('opacity', 1);
658
- $('.below-customize-sharing-link').css('opacity', 1);
659
- $('.below-smart-sharing-container').show();
660
  });
661
-
662
  $("#small_toolbox_above").click( function() {
663
- if($('#above-chosen-list').val() != '') {
664
- var newserv = revertServices('above');
665
- updatePreview('above', 'small_toolbox', newserv);
666
- $('#above-chosen-list').val(newserv);
667
- }
668
- else {
669
- $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
670
- }
671
- $('.above_button_set').css('opacity', 1);
672
- $('.above-customize-sharing-link').css('opacity', 1);
673
- $('.above-smart-sharing-container').show();
674
  });
675
-
676
  $("#small_toolbox_below").click( function() {
677
- if($('#below-chosen-list').val() != '') {
678
- var newserv = revertServices('below');
679
- updatePreview('below', 'small_toolbox', newserv);
680
- $('#below-chosen-list').val(newserv);
681
- }
682
- else {
683
- $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
684
- }
685
- $('.below_button_set').css('opacity', 1);
686
- $('.below-customize-sharing-link').css('opacity', 1);
687
- $('.below-smart-sharing-container').show();
688
  });
689
-
690
  $("#button_above").click( function() {
691
- if($(this).is(':checked')){
692
- $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
693
- }
694
- $('.above_button_set').css('opacity', 1);
695
- $('.above-customize-sharing-link').css('opacity', 1);
696
- $('.above-smart-sharing-container').show();
697
  });
698
-
 
 
 
 
 
 
 
 
 
 
 
699
  $("#button_below").click( function() {
700
- if($(this).is(':checked')){
701
- $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
702
- }
703
- $('.below_button_set').css('opacity', 1);
704
- $('.below-customize-sharing-link').css('opacity', 1);
705
- $('.below-smart-sharing-container').show();
 
 
 
 
 
 
 
 
 
 
 
706
  });
707
-
708
  $("#disable_above").click( function() {
709
- if($(this).is(':checked')){
710
- $('#above_previewContainer').html('');
711
- $('.above_button_set').css('opacity', 0.4);
712
- $('.above-customize-sharing-link').css('opacity', 0);
713
- $('.above-smart-sharing-container').hide();
714
- }
715
  });
716
-
717
  $("#disable_below").click( function() {
718
- if($(this).is(':checked')){
719
- $('#below_previewContainer').html('');
720
- $('.below_button_set').css('opacity', 0.4);
721
- $('.below-customize-sharing-link').css('opacity', 0);
722
- $('.below-smart-sharing-container').hide();
723
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
724
  });
725
-
726
- $('#submit-button').click(function() {
727
- if($('#above-disable-smart-sharing').is(':checked')) {
728
- if($('#button_above').is(':checked')) {
729
- $('#above-chosen-list').val('');
730
- } else if($('#disable_above').is(':checked')) {
731
- $('#above-chosen-list').val('');
732
- } else {
733
- var list = [];
734
- $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
735
- var service = '';
736
- $(this).find('li').each(function(){
737
- if($(this).hasClass('enabled')) {
738
- list.push($(this).attr('data-service'));
739
- if($(this).attr('data-service') == 'compact') {
740
- list.push('counter');
741
- }
742
- }
743
- });
744
- });
745
- var aboveservices = list.join(', ');
746
- $('#above-chosen-list').val(aboveservices);
747
- }
748
- }
749
- if($('#button_above').is(':checked')) {
750
- $('#above-chosen-list').val('');
751
- }
752
- if($('#disable_above').is(':checked')) {
753
- $('#above-chosen-list').val('');
754
- }
755
-
756
- if($('#below-disable-smart-sharing').is(':checked')) {
757
- if($('#button_below').is(':checked')) {
758
- $('#below-chosen-list').val('');
759
- } else if($('#disable_below').is(':checked')) {
760
- $('#below-chosen-list').val('');
761
- } else {
762
- var list = [];
763
- $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
764
- var service = '';
765
- $(this).find('li').each(function(){
766
- if($(this).hasClass('enabled')) {
767
- list.push($(this).attr('data-service'));
768
- if($(this).attr('data-service') == 'compact') {
769
- list.push('counter');
770
- }
771
- }
772
- });
773
- });
774
- var belowservices = list.join(', ');
775
- $('#below-chosen-list').val(belowservices);
776
- }
777
- }
778
- if($('#button_below').is(':checked')) {
779
- $('#below-chosen-list').val('');
780
- }
781
- if($('#disable_below').is(':checked')) {
782
- $('#below-chosen-list').val('');
783
- }
784
-
785
- });
786
-
787
  var s = $("#preview_floater");
788
- var pos = s.position();
789
  $(window).scroll(function() {
790
  var windowpos = $(window).scrollTop();
791
-
792
  if (windowpos >= pos.top) {
793
  s.addClass("stick");
794
  } else {
795
- s.removeClass("stick");
796
  }
797
  });
798
-
799
  $('.folded #collapse-menu').click(function(){
800
- $('#preview_floater').removeClass();
801
- var s = $("#preview_floater");
802
- var pos = s.position();
803
  $(window).scroll(function() {
804
- var windowpos = $(window).scrollTop();
805
-
806
- if (windowpos >= pos.top) {
807
- setTimeout(function(){$('#preview_floater').addClass('stick');},1);
808
- }
809
  });
810
- });
811
-
812
  var dataContent = '';
813
- var dataTitle = '';
814
- var innerContent = '';
815
- var left = 0;
816
- var top = 0;
817
- var popoverHeight = 0;
818
- var parent;
819
- var me;
820
- $('.row-right a').mouseover(function(){
821
- me = $(this);
822
- parent = $(me).parent();
823
-
824
- dataContent = $(parent).attr('data-content');
825
- dataTitle = $(parent).attr('data-original-title');
826
- innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
827
- innerContent = innerContent + dataTitle;
828
- innerContent = innerContent + "</h3><div class='popover-content'>";
829
- innerContent = innerContent + dataContent;
830
- innerContent = innerContent + "</div></div>";
831
- $(parent).append(innerContent);
832
-
833
- popoverHeight = $(parent).find('.popover').height();
834
- left = $(me).position().left + 15;
835
- top = $(me).position().top - (popoverHeight/2) + 8;
836
-
837
- $(parent).find('.popover').css({
838
- 'left': left+'px',
839
- 'top': top+'px'
840
- });
841
- });
842
- $('.row-right a').mouseout(function(){
843
- $('.popover').remove();
844
- });
845
-
846
  });
847
 
1
+ /**
2
+ * +--------------------------------------------------------------------------+
3
+ * | Copyright (c) 2008-2015 AddThis, LLC |
4
+ * +--------------------------------------------------------------------------+
5
+ * | This program is free software; you can redistribute it and/or modify |
6
+ * | it under the terms of the GNU General Public License as published by |
7
+ * | the Free Software Foundation; either version 2 of the License, or |
8
+ * | (at your option) any later version. |
9
+ * | |
10
+ * | This program is distributed in the hope that it will be useful, |
11
+ * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
+ * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
+ * | GNU General Public License for more details. |
14
+ * | |
15
+ * | You should have received a copy of the GNU General Public License |
16
+ * | along with this program; if not, write to the Free Software |
17
+ * | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
+ * +--------------------------------------------------------------------------+
19
+ */
20
+
21
+ jQuery(document).ready(function($) {
22
+ $( "#config-error" ).hide();
23
+ $( "#share-error" ).hide();
24
  $( "#tabs" ).tabs();
25
+
26
+ var thickDims, tbWidth, tbHeight, img = abvimg = belimg = '';
27
+
28
  thickDims = function() {
29
  var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
30
+
31
  w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
32
  h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
33
  if ( tbWindow.size() ) {
39
  }
40
  };
41
 
42
+
43
  $('a.thickbox-preview').click( function() {
44
+
45
  var previewLink = this;
46
+
47
  var $inputs = $('#addthis_settings :input');
48
 
49
  var values = {};
50
  $.each($('#addthis_settings').serializeArray(), function(i, field) {
51
+
52
  var thisName = field.name
53
  if (thisName.indexOf("addthis_settings[") != -1 )
54
  {
55
  thisName = thisName.replace("addthis_settings[", '');
56
  thisName = thisName.replace("]", '');
57
  }
58
+
59
  values[thisName] = field.value;
60
  });
61
 
65
  action: 'at_save_transient',
66
  value : stuff
67
  };
68
+
69
 
70
  jQuery.post(ajaxurl, data, function(response) {
71
 
72
+ // Fix for WP 2.9's version of lightbox
73
  if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
74
  {
75
+ tb_click.call(previewLink);
76
  }
77
  var href = $(previewLink).attr('href');
78
  var link = '';
79
 
80
 
81
+ if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
82
+ tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
83
+ else
84
+ tbWidth = $(window).width() - 90;
85
 
86
+ if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
87
  tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
88
  else
89
  tbHeight = $(window).height() - 60;
 
 
 
 
90
 
91
+ $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
92
+ $('#TB_closeAjaxWindow').css({'float':'left'});
93
+ $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
94
 
95
+ $('#TB_iframeContent').width('100%');
96
+
97
+ thickDims();
98
 
99
  });
100
  return false;
101
  });
102
 
103
+ var aboveCustom = $('#above_custom_button');
104
  var aboveCustomShow = function(){
105
  if ( aboveCustom.is(':checked'))
106
  {
114
  }
115
  };
116
 
117
+ var belowCustom = $('#below_custom_button');
118
  var belowCustomShow = function(){
119
  if ( belowCustom.is(':checked'))
120
  {
134
  {
135
  $('.above_option').toggleClass('hide');
136
  }
137
+
138
  if ( $('#input[name="addthis_settings[show_below]"]').is(':checked'))
139
  {
140
  $('.below_option').toggleClass('hide');
141
  }
142
+
143
  $('input[name="addthis_settings[show_above]"]').change( function() {
144
  $('.above_option').toggleClass('hide');
145
  });
148
  $('.below_option').toggleClass('hide');
149
  });
150
 
151
+ var aboveCustomString = $('#above_custom_string');
152
  var aboveCustomStringShow = function(){
153
  if ( aboveCustomString.is(':checked'))
154
  {
162
  }
163
  };
164
 
165
+ var belowCustomString = $('#below_custom_string');
166
  var belowCustomStringShow = function(){
167
  if ( belowCustomString.is(':checked'))
168
  {
186
 
187
  /**
188
  * Hide Theming and branding options when user selects version 3.0 or above
189
+ */
190
  var ATVERSION_250 = 250;
191
  var AT_VERSION_300 = 300;
192
  var MANUAL_UPDATE = -1;
198
  } else {
199
  $(".classicFeature").hide();
200
  }
201
+
202
  /**
203
  * Revert to older version after the user upgrades
204
  */
210
  });
211
  /**
212
  * Update to a newer version
213
+ */
214
  $(".addthis-update-atversion").click(function(){
215
  $("#addthis_atversion_update_status").val(MANUAL_UPDATE);
216
  $("#addthis_atversion_hidden").val(AT_VERSION_300);
228
  {"url" : addthis_option_params.wp_ajax_url,
229
  "type" : "post",
230
  "data" : {"action" : addthis_option_params.addthis_validate_action,
231
+ "addthis_profile" : $("#addthis_profile").val()
 
 
232
  },
233
  "dataType" : "json",
234
  "beforeSend" : function() {
264
  }
265
  });
266
  }
267
+
268
+ $("#addthis_profile").change(function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  addthis_credential_validation_status.val(0);
270
  if($.trim($("#addthis_profile").val()) == "") {
271
  addthis_profile_validation_message.next().hide();
272
  }
 
 
 
273
  });
274
 
275
+ $('#addthis_config_json').focusout(function() {
276
+ var error = 0;
277
+ if ($('#addthis_config_json').val() != " ") {
278
+ try {
279
+ var addthis_config_json = jQuery.parseJSON($('#addthis_config_json').val());
280
+ }
281
+ catch (e) {
282
+ $('#config-error').show();
283
+ error = 1;
284
+ }
285
+ }
286
+ if (error == 0) {
287
+ $('#config-error').hide();
288
+ return true;
289
+ } else {
290
+ $('#config-error').show();
291
+ return false;
292
+ }
293
  });
294
+
295
+ $('#addthis_share_json').focusout(function() {
296
+ var error = 0;
297
+ if ($('#addthis_share_json').val() != " ") {
298
+ try {
299
+ var addthis_share_json = jQuery.parseJSON($('#addthis_share_json').val());
300
+ }
301
+ catch (e) {
302
+ $('#share-error').show();
303
+ error = 1;
304
+ }
305
+ }
306
+ if (error == 0) {
307
+ $('#share-error').hide();
308
+ return true;
309
+ } else {
310
+ $('#share-error').show();
311
+ return false;
312
+ }
313
  });
314
+
315
+ $('.addthis-submit-button').click(function() {
316
+ $('#config-error').hide();
317
+ $('#share-error').hide();
318
+ var error = 0;
319
+ if ($('#addthis-config-json').val() != " ") {
320
+ try {
321
+ var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
322
+ }
323
+ catch (e) {
324
+ $('#config-error').show();
325
+ error = 1;
326
+ }
327
+ }
328
+ if ($('#addthis_share_json').val() != " ") {
329
+ try {
330
+ var addthis_share_json = jQuery.parseJSON($('#addthis_share_json').val());
331
+ }
332
+ catch (e) {
333
+ $('#share-error').show();
334
+ error = 1;
335
+ }
336
+ }
337
+ if (error == 0) {
338
+ return true;
339
+ } else {
340
+ return false;
341
+ }
342
  });
343
+
344
+
345
  //preview box
346
  function rewriteServices(posn) {
347
+ var services = $('#'+posn+'-chosen-list').val();
348
+ var service = services.split(', ');
349
+ var i;
350
+ var newservice = '';
351
+ for (i = 0; i < (service.length); ++i) {
352
+ if(service[i] == 'linkedin') {
353
+ newservice += 'linkedin_counter, ';
354
+ }
355
+ else if(service[i] == 'facebook') {
356
+ newservice += 'facebook_like, ';
357
+ }
358
+ else if(service[i] == 'twitter') {
359
+ newservice += 'tweet, ';
360
+ }
361
+ else if(service[i] == 'pinterest_share') {
362
+ newservice += 'pinterest_pinit, ';
363
+ }
364
+ else if(service[i] == 'hyves') {
365
+ newservice += 'hyves_respect, ';
366
+ }
367
+ else if(service[i] == 'google_plusone_share') {
368
+ newservice += 'google_plusone, ';
369
+ }
370
+ else if(service[i] == 'counter' || service[i] == 'compact') {
371
+ newservice += service[i]+', ';
372
+ }
373
+ }
374
+ var newservices = newservice.slice(0,-2);
375
+ return newservices;
376
  }
377
+
378
  function revertServices(posn) {
379
+ var services = $('#'+posn+'-chosen-list').val();
380
+ var service = services.split(', ');
381
+ var i;
382
+ var newservice = '';
383
+ for (i = 0; i < (service.length); ++i) {
384
+ if(service[i] == 'facebook_like') {
385
+ newservice += 'facebook, ';
386
+ }
387
+ else if(service[i] == 'linkedin_counter') {
388
+ newservice += 'linkedin, ';
389
+ }
390
+ else if(service[i] == 'hyves_respect') {
391
+ newservice += 'hyves, ';
392
+ }
393
+ else if(service[i] == 'google_plusone') {
394
+ newservice += 'google_plusone_share, ';
395
+ }
396
+ else if(service[i] == 'tweet') {
397
+ newservice += 'twitter, ';
398
+ }
399
+ else if(service[i] == 'pinterest_pinit') {
400
+ newservice += 'pinterest_share, ';
401
+ }
402
+ else {
403
+ newservice += service[i]+', ';
404
+ }
405
+ }
406
+ var newservices = newservice.slice(0,-2);
407
+ return newservices;
408
  }
409
+
410
  function updatePreview(posn, style, option) {
411
+ var preview = '';
412
+ var service = option.split(', ');
413
+ var i;
414
+ if(style == 'large_toolbox') {
415
+ preview += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
416
+ for (i = 0; i < (service.length); ++i) {
417
+ if(service[i] == 'counter') {
418
+ preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
419
+ } else {
420
+ preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
421
+ }
422
+ }
423
+ preview += '</div>';
424
+ }
425
+ else if(style == 'fb_tw_p1_sc') {
426
+ for (i = 0; i < (service.length); ++i) {
427
+ if(service[i] == 'compact') {
428
+ preview += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
429
+ }
430
+ else if(service[i] != 'counter') {
431
+ preview += '<img src="'+addthis_option_params.img_base+service[i]+'.png">';
432
+ }
433
+ }
434
+ }
435
+ else if(style == 'small_toolbox') {
436
+ for (i = 0; i < (service.length); ++i) {
437
+ if(service[i] == 'counter') {
438
+ preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
439
+ } else {
440
+ preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
441
+ }
442
+ }
443
+ }
444
+ $('#'+posn+'_previewContainer').html(preview);
445
  }
446
  if($('#large_toolbox_above').is(':checked')) {
447
+ if($('#above-chosen-list').val() == "") {
448
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
449
+ } else {
450
+ abvimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
451
+ var aboveserv = $('#above-chosen-list').val();
452
+ var aservice = aboveserv.split(', ');
453
+ var i;
454
+ for (i = 0; i < (aservice.length); ++i) {
455
+ if(aservice[i] == 'counter') {
456
+ abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
457
+ } else {
458
+ abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
459
+ }
460
+ }
461
+ abvimg += '</div>';
462
+ }
463
+ $('.above_button_set').css('opacity', 1);
464
+ $('.above-customize-sharing-link').css('opacity', 1);
465
+ $('.above-smart-sharing-container').show();
466
+ $('#above_previewContainer').html(abvimg);
467
  } else if($('#fb_tw_p1_sc_above').is(':checked')) {
468
+ if($('#above-chosen-list').val() == "") {
469
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
470
+ } else {
471
+ var aboveserv = $('#above-chosen-list').val();
472
+ var aservice = aboveserv.split(', ');
473
+ var i;
474
+ for (i = 0; i < (aservice.length); ++i) {
475
+ if(aservice[i] == 'compact') {
476
+ abvimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
477
+ }
478
+ else if(aservice[i] != 'counter') {
479
+ abvimg += '<img src="'+addthis_option_params.img_base+aservice[i]+'.png">';
480
+ }
481
+ }
482
+ }
483
+ $('.above_button_set').css('opacity', 1);
484
+ $('.above-customize-sharing-link').css('opacity', 1);
485
+ $('.above-smart-sharing-container').show();
486
+ $('#above_previewContainer').html(abvimg);
487
+ } else if($('#small_toolbox_above').is(':checked')) {
488
+ if($('#above-chosen-list').val() == "") {
489
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
490
+ } else {
491
+ var aboveserv = $('#above-chosen-list').val();
492
+ var aservice = aboveserv.split(', ');
493
+ var i;
494
+ for (i = 0; i < (aservice.length); ++i) {
495
+ if(aservice[i] == 'counter') {
496
+ abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
497
+ } else {
498
+ abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
499
+ }
500
+ }
501
+ }
502
+ $('.above_button_set').css('opacity', 1);
503
+ $('.above-customize-sharing-link').css('opacity', 1);
504
+ $('.above-smart-sharing-container').show();
505
+ $('#above_previewContainer').html(abvimg);
506
+ } else if($('#button_above').is(':checked')) {
507
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
508
+ $('.above_button_set').css('opacity', 1);
509
+ $('.above-customize-sharing-link').css('opacity', 0);
510
+ $('.above-smart-sharing-container').hide();
511
+ $('#above_previewContainer').html(abvimg);
512
+ } else if($('#above_custom_string').is(':checked')) {
513
+ $('.above_button_set').css('opacity', 0);
514
+ $('.above-smart-sharing-container').hide();
515
+ } else if($('#disable_above').is(':checked')) {
516
+ abvimg = '';
517
+ $('.above_button_set').css('opacity', 0.4);
518
+ $('.above-customize-sharing-link').css('opacity', 0);
519
+ $('.above-smart-sharing-container').hide();
520
+ $('#above_previewContainer').html(abvimg);
521
+ }
522
+
523
+ if($('#large_toolbox_below').is(':checked')) {
524
+ if($('#below-chosen-list').val() == "") {
525
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
526
+ } else {
527
+ belimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
528
+ var belowserv = $('#below-chosen-list').val();
529
+ var bservice = belowserv.split(', ');
530
+ var i;
531
+ for (i = 0; i < (bservice.length); ++i) {
532
+ if(bservice[i] == 'counter') {
533
+ belimg +='<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
534
+ } else {
535
+ belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
536
+ }
537
+ }
538
+ belimg += '</div>';
539
+
540
+ }
541
+ $('.below_button_set').css('opacity', 1);
542
+ $('.below-customize-sharing-link').css('opacity', 1);
543
+ $('.below-smart-sharing-container').show();
544
+ $('#below_previewContainer').html(belimg);
545
+ } else if($('#fb_tw_p1_sc_below').is(':checked')) {
546
+ if($('#below-chosen-list').val() == "") {
547
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
548
+ } else {
549
+ var belowserv = $('#below-chosen-list').val();
550
+ var bservice = belowserv.split(', ');
551
+ var i;
552
+ for (i = 0; i < (bservice.length-1); ++i) {
553
+ if(bservice[i] == 'compact') {
554
+ belimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
555
+ } else if(bservice[i] != 'counter') {
556
+ belimg += '<img src="'+addthis_option_params.img_base+bservice[i]+'.png">';
557
+ }
558
+ }
559
+ }
560
+ $('.below_button_set').css('opacity', 1);
561
+ $('.below-customize-sharing-link').css('opacity', 1);
562
+ $('.below-smart-sharing-container').show();
563
+ $('#below_previewContainer').html(belimg);
564
+ } else if($('#small_toolbox_below').is(':checked')) {
565
+ if($('#below-chosen-list').val() == "") {
566
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
567
+ } else {
568
+ var belowserv = $('#below-chosen-list').val();
569
+ var bservice = belowserv.split(', ');
570
+ var i;
571
+ for (i = 0; i < (bservice.length); ++i) {
572
+ if(bservice[i] == 'counter') {
573
+ belimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
574
+ } else {
575
+ belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
576
+ }
577
+ }
578
+ }
579
+ $('.below_button_set').css('opacity', 1);
580
+ $('.below-customize-sharing-link').css('opacity', 1);
581
+ $('.below-smart-sharing-container').show();
582
+ $('#below_previewContainer').html(belimg);
583
+ } else if($('#button_below').is(':checked')) {
584
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
585
+ $('.below_button_set').css('opacity', 1);
586
+ $('.below-customize-sharing-link').css('opacity', 0);
587
+ $('.below-smart-sharing-container').hide();
588
+ $('#below_previewContainer').html(belimg);
589
+ } else if($('#below_custom_string').is(':checked')) {
590
+ $('.below_button_set').css('opacity', 0);
591
+ $('.below-smart-sharing-container').hide();
592
+ } else if($('#disable_below').is(':checked')) {
593
+ belimg = '';
594
+ $('.below_button_set').css('opacity', 0.4);
595
+ $('.below-customize-sharing-link').css('opacity', 0);
596
+ $('.below-smart-sharing-container').hide();
597
+ $('#below_previewContainer').html(belimg);
598
+ }
599
 
600
  $("#large_toolbox_above").click( function() {
601
+ if($('#above-chosen-list').val() != '') {
602
+ var newserv = revertServices('above');
603
+ updatePreview('above', 'large_toolbox', newserv);
604
+ $('#above-chosen-list').val(newserv);
605
+ }
606
+ else {
607
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
608
+ }
609
+ $('.above_button_set').css('opacity', 1);
610
+ $('.above-customize-sharing-link').css('opacity', 1);
611
+ $('.above-smart-sharing-container').show();
612
  });
613
+
614
  $("#large_toolbox_below").click( function() {
615
+ if($('#below-chosen-list').val() != '') {
616
+ var newserv = revertServices('below');
617
+ updatePreview('below', 'large_toolbox', newserv);
618
+ $('#below-chosen-list').val(newserv);
619
+ }
620
+ else {
621
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
622
+ }
623
+ $('.below_button_set').css('opacity', 1);
624
+ $('.below-customize-sharing-link').css('opacity', 1);
625
+ $('.below-smart-sharing-container').show();
626
  });
627
 
628
  $("#fb_tw_p1_sc_above").click( function() {
629
+ if($('#above-chosen-list').val() != '') {
630
+ var newserv = rewriteServices('above');
631
+ updatePreview('above', 'fb_tw_p1_sc', newserv);
632
+ $('#above-chosen-list').val(newserv);
633
+ }
634
+ else {
635
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
636
+ }
637
+ $('.above_button_set').css('opacity', 1);
638
+ $('.above-customize-sharing-link').css('opacity', 1);
639
+ $('.above-smart-sharing-container').show();
640
  });
641
+
642
  $("#fb_tw_p1_sc_below").click( function() {
643
+ if($('#below-chosen-list').val() != '') {
644
+ var newserv = rewriteServices('below');
645
+ updatePreview('below', 'fb_tw_p1_sc', newserv);
646
+ $('#below-chosen-list').val(newserv);
647
+ }
648
+ else {
649
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
650
+ }
651
+ $('.below_button_set').css('opacity', 1);
652
+ $('.below-customize-sharing-link').css('opacity', 1);
653
+ $('.below-smart-sharing-container').show();
654
  });
655
+
656
  $("#small_toolbox_above").click( function() {
657
+ if($('#above-chosen-list').val() != '') {
658
+ var newserv = revertServices('above');
659
+ updatePreview('above', 'small_toolbox', newserv);
660
+ $('#above-chosen-list').val(newserv);
661
+ }
662
+ else {
663
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
664
+ }
665
+ $('.above_button_set').css('opacity', 1);
666
+ $('.above-customize-sharing-link').css('opacity', 1);
667
+ $('.above-smart-sharing-container').show();
668
  });
669
+
670
  $("#small_toolbox_below").click( function() {
671
+ if($('#below-chosen-list').val() != '') {
672
+ var newserv = revertServices('below');
673
+ updatePreview('below', 'small_toolbox', newserv);
674
+ $('#below-chosen-list').val(newserv);
675
+ }
676
+ else {
677
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
678
+ }
679
+ $('.below_button_set').css('opacity', 1);
680
+ $('.below-customize-sharing-link').css('opacity', 1);
681
+ $('.below-smart-sharing-container').show();
682
  });
683
+
684
  $("#button_above").click( function() {
685
+ if($(this).is(':checked')){
686
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
687
+ }
688
+ $('.above_button_set').css('opacity', 1);
689
+ $('.above-customize-sharing-link').css('opacity', 1);
690
+ $('.above-smart-sharing-container').show();
691
  });
692
+
693
+ $("#above_custom_string").click( function() {
694
+ if($(this).is(':checked')){
695
+ $('.above_button_set').css('opacity', 0);
696
+ $('.above-smart-sharing-container').hide();
697
+ } else {
698
+ $('.above_button_set').css('opacity', 1);
699
+ $('.above-customize-sharing-link').css('opacity', 1);
700
+ $('.above-smart-sharing-container').show();
701
+ }
702
+ });
703
+
704
  $("#button_below").click( function() {
705
+ if($(this).is(':checked')){
706
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
707
+ }
708
+ $('.below_button_set').css('opacity', 1);
709
+ $('.below-customize-sharing-link').css('opacity', 1);
710
+ $('.below-smart-sharing-container').show();
711
+ });
712
+
713
+ $("#below_custom_string").click( function() {
714
+ if($(this).is(':checked')){
715
+ $('.below_button_set').css('opacity', 0);
716
+ $('.below-smart-sharing-container').hide();
717
+ } else {
718
+ $('.below_button_set').css('opacity', 1);
719
+ $('.below-customize-sharing-link').css('opacity', 1);
720
+ $('.below-smart-sharing-container').show();
721
+ }
722
  });
723
+
724
  $("#disable_above").click( function() {
725
+ if($(this).is(':checked')){
726
+ $('#above_previewContainer').html('');
727
+ $('.above_button_set').css('opacity', 0.4);
728
+ $('.above-customize-sharing-link').css('opacity', 0);
729
+ $('.above-smart-sharing-container').hide();
730
+ }
731
  });
732
+
733
  $("#disable_below").click( function() {
734
+ if($(this).is(':checked')){
735
+ $('#below_previewContainer').html('');
736
+ $('.below_button_set').css('opacity', 0.4);
737
+ $('.below-customize-sharing-link').css('opacity', 0);
738
+ $('.below-smart-sharing-container').hide();
739
+ }
740
+ });
741
+
742
+ $('.addthis-submit-button').click(function() {
743
+ if($('#above-disable-smart-sharing').is(':checked')) {
744
+ if($('#button_above').is(':checked')) {
745
+ $('#above-chosen-list').val('');
746
+ } else if($('#disable_above').is(':checked')) {
747
+ $('#above-chosen-list').val('');
748
+ } else {
749
+ var list = [];
750
+ $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
751
+ var service = '';
752
+ $(this).find('li').each(function(){
753
+ if($(this).hasClass('enabled')) {
754
+ list.push($(this).attr('data-service'));
755
+ if($(this).attr('data-service') == 'compact') {
756
+ list.push('counter');
757
+ }
758
+ }
759
+ });
760
+ });
761
+ var aboveservices = list.join(', ');
762
+ $('#above-chosen-list').val(aboveservices);
763
+ }
764
+ }
765
+ if($('#button_above').is(':checked')) {
766
+ $('#above-chosen-list').val('');
767
+ }
768
+ if($('#disable_above').is(':checked')) {
769
+ $('#above-chosen-list').val('');
770
+ }
771
+
772
+ if($('#below-disable-smart-sharing').is(':checked')) {
773
+ if($('#button_below').is(':checked')) {
774
+ $('#below-chosen-list').val('');
775
+ } else if($('#disable_below').is(':checked')) {
776
+ $('#below-chosen-list').val('');
777
+ } else {
778
+ var list = [];
779
+ $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
780
+ var service = '';
781
+ $(this).find('li').each(function(){
782
+ if($(this).hasClass('enabled')) {
783
+ list.push($(this).attr('data-service'));
784
+ if($(this).attr('data-service') == 'compact') {
785
+ list.push('counter');
786
+ }
787
+ }
788
+ });
789
+ });
790
+ var belowservices = list.join(', ');
791
+ $('#below-chosen-list').val(belowservices);
792
+ }
793
+ }
794
+ if($('#button_below').is(':checked')) {
795
+ $('#below-chosen-list').val('');
796
+ }
797
+ if($('#disable_below').is(':checked')) {
798
+ $('#below-chosen-list').val('');
799
+ }
800
+
801
  });
802
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
803
  var s = $("#preview_floater");
804
+ var pos = s.position();
805
  $(window).scroll(function() {
806
  var windowpos = $(window).scrollTop();
807
+
808
  if (windowpos >= pos.top) {
809
  s.addClass("stick");
810
  } else {
811
+ s.removeClass("stick");
812
  }
813
  });
814
+
815
  $('.folded #collapse-menu').click(function(){
816
+ $('#preview_floater').removeClass();
817
+ var s = $("#preview_floater");
818
+ var pos = s.position();
819
  $(window).scroll(function() {
820
+ var windowpos = $(window).scrollTop();
821
+
822
+ if (windowpos >= pos.top) {
823
+ setTimeout(function(){$('#preview_floater').addClass('stick');},1);
824
+ }
825
  });
826
+ });
827
+
828
  var dataContent = '';
829
+ var dataTitle = '';
830
+ var innerContent = '';
831
+ var left = 0;
832
+ var top = 0;
833
+ var popoverHeight = 0;
834
+ var parent;
835
+ var me;
836
+ $('.row-right a').mouseover(function(){
837
+ me = $(this);
838
+ parent = $(me).parent();
839
+
840
+ dataContent = $(parent).attr('data-content');
841
+ dataTitle = $(parent).attr('data-original-title');
842
+ innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
843
+ innerContent = innerContent + dataTitle;
844
+ innerContent = innerContent + "</h3><div class='popover-content'>";
845
+ innerContent = innerContent + dataContent;
846
+ innerContent = innerContent + "</div></div>";
847
+ $(parent).append(innerContent);
848
+
849
+ popoverHeight = $(parent).find('.popover').height();
850
+ left = $(me).position().left + 15;
851
+ top = $(me).position().top - (popoverHeight/2) + 8;
852
+
853
+ $(parent).find('.popover').css({
854
+ 'left': left+'px',
855
+ 'top': top+'px'
856
+ });
857
+ });
858
+ $('.row-right a').mouseout(function(){
859
+ $('.popover').remove();
860
+ });
861
+
862
  });
863
 
readme.txt CHANGED
@@ -1,26 +1,26 @@
1
  === Smart Website Tools by AddThis ===
2
- Contributors: srijith.v, solchea, _mjk_, addthis_paul, abramsm
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.1
6
- Stable tag: 4.0.7
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,38 +43,42 @@ To upload the plugin through WordPress, instead of FTP:
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
 
@@ -82,6 +86,15 @@ PHP 5+ is preferred; PHP 4 is supported.
82
 
83
  == Changelog ==
84
 
 
 
 
 
 
 
 
 
 
85
  = 4.0.7 =
86
  * Added node marker and loop cap to getFirstElderWithCondition to solve infinite loop
87
  * Fixed the issue where characters *,+,- were printed in feeds
@@ -105,7 +118,7 @@ PHP 5+ is preferred; PHP 4 is supported.
105
  = 4.0.2 =
106
  * Control inline share buttons for each page/post
107
  * Implemented asynchronous script loading
108
- * Added option to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page.
109
  * Prevented buttons showing on 404 error pages
110
  * CSS fixes
111
  * Added css classes to prevent inline div from taking extra spaces
@@ -137,19 +150,19 @@ PHP 5+ is preferred; PHP 4 is supported.
137
  * Fix for better analytics
138
 
139
  = 3.5.5 =
140
- * Minor bug fixes.
141
 
142
  = 3.5.4 =
143
- * Fixed JS errors in Options page.
144
 
145
  = 3.5.3 =
146
  * Fix for wrong url being shared while using Custom Button option
147
 
148
  = 3.5.2 =
149
- * Minor bug fixes.
150
 
151
  = 3.5.1 =
152
- * Reintroduced Custom Button Code box
153
 
154
  = 3.5 =
155
  * Drag and drop customization of buttons
@@ -162,26 +175,26 @@ PHP 5+ is preferred; PHP 4 is supported.
162
  * Better JSON validation
163
  * Bug fixes
164
 
165
- = 3.0.5 =
166
  * Bug fixes: Style conflicts resolved
167
 
168
- = 3.0.4 =
169
  * Bug fix: Style conflicts with some themes resolved
170
- * Made friends with WPSupercache
171
 
172
- = 3.0.3 =
173
  * Bug fix: Style tags are now allowed in Custom Code box.
174
 
175
- = 3.0.2 =
176
  * Bug fix: Conflict with WpSuperCache resolved
177
  * Wordpress 3.5 style conflicts resolved
178
 
179
- = 3.0.1 =
180
  * Bug fix: Issues with usernames/passwords with special characters
181
 
182
  = 3.0 =
183
  * UX changes in admin settings
184
- * Credential verification in Admin settings. If AddThis account details are wrong it will be notified to user.
185
  * Bug fixes
186
 
187
  = 2.5.1 =
@@ -198,12 +211,12 @@ PHP 5+ is preferred; PHP 4 is supported.
198
  = 2.4.1 =
199
  * Bug fixes
200
 
201
- = 2.4.0 =
202
  * Refactor how we add code to pages which should eliminate how many times it is added
203
  * Numerous Bug Fixes and a few new filters
204
 
205
  = 2.3.2 =
206
- * Add opt out for copy tracking
207
 
208
  = 2.3.1 =
209
  * Don't strip pintrest tags from custom buttons
@@ -239,7 +252,7 @@ PHP 5+ is preferred; PHP 4 is supported.
239
  * force service codes to be lowercase
240
  * If opting out of clickback tracking, set config to force opting out
241
 
242
- = 2.0.4 =
243
  * Fix conflict with other plugins
244
  * Prevent button js from appearing in feeds
245
 
@@ -248,16 +261,14 @@ PHP 5+ is preferred; PHP 4 is supported.
248
 
249
  = 2.0.2 =
250
  * Bug Fixes
251
- * set addthis_exclude custom field to 'true' to not display addthis on that post / page
252
- * Added additional paramater to
253
  * Ability to specify custom toolboxes for both above and below
254
  * Added additional paramater to do_action('addthis_widget'). Paramaters are now:
255
  * * url (use get_permalink() if you are calling it inside the loop)
256
  * * title (use the_title() if calling inside the loop)
257
  * * Style (specify the style to display) See $addthis_new_styles for the styles. may also pass an arra (see addthis_custom_toolbox for array values to pass)
258
 
259
-
260
-
261
  = 2.0.1 =
262
  * Fix theme compatablity issues
263
  * Fix excerpts bug
@@ -287,11 +298,11 @@ PHP 5+ is preferred; PHP 4 is supported.
287
  * Fixed parse bug with "static" menu option
288
  * Fixed regression of brand option
289
 
290
- = 1.6.3 =
291
  * Added template tags. &lt;?php do_action( 'addthis_widget' ); ?&gt; in your template will print an AddThis button or toolbox, per your configuration.
292
  * Added <a href="http://addthis.com/blog/2010/03/11/clickback-analytics-measure-traffic-back-to-your-site-from-addthis/">clickback</a> tracking.
293
  * Added "Automatic" language option. We'll auto-translate the AddThis button and menu into our supported languages depending on your users' settings.
294
- * Fixed script showing up in some trackback summaries.
295
 
296
  = 1.6.2 =
297
  Fixed name conflict with get_wp_version() (renamed to addthis_get_wp_version()), affecting users with the k2 theme.
@@ -309,6 +320,15 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
309
 
310
  == Upgrade Notice ==
311
 
 
 
 
 
 
 
 
 
 
312
  = 4.0.7 =
313
  * Added node marker and loop cap to getFirstElderWithCondition to solve infinite loop
314
  * Fixed the issue where characters *,+,- were printed in feeds
@@ -332,7 +352,7 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
332
  = 4.0.2 =
333
  * Control inline share buttons for each page/post
334
  * Implemented asynchronous script loading
335
- * Added option to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page.
336
  * Prevented buttons showing on 404 error pages
337
  * CSS fixes
338
  * Added css classes to prevent inline div from taking extra spaces
@@ -372,10 +392,10 @@ Bug fixes
372
  = 3.5.3 =
373
  Fix for wrong url being shared while using Custom Button option
374
 
375
- = 3.5.2 =
376
- Bug fixes.
377
 
378
- = 3.5.1 =
379
  Reintroduced Custom Button Code box
380
 
381
  = 3.5 =
@@ -384,19 +404,19 @@ Drag and drop customization of buttons, better preview of buttons
384
  = 3.1 =
385
  Bug fixes, better validations
386
 
387
- = 3.0.5 =
388
  Bug fixes
389
 
390
- = 3.0.4 =
391
  Bug fixes, made WPSupercache friendly
392
 
393
- = 3.0.3 =
394
  Bug fixes.
395
 
396
- = 3.0.2 =
397
  Bug fixes.
398
 
399
- = 3.0.1 =
400
  Bug fixes.
401
 
402
  = 3.0 =
@@ -411,7 +431,7 @@ Updated share menu, Instant Share, Pinterest updates and bug fixes.
411
  = 2.4.3 =
412
  Fixed admin console bug for non-administrators.
413
 
414
- = 2.4.1 =
415
  Bug fixes.
416
 
417
  = 2.4.0 =
@@ -420,10 +440,10 @@ Better performance and improved UI.
420
  = 2.3.2 =
421
  New option for opting out of copy text tracking.
422
 
423
- = 2.3.0 =
424
  Improve the Settings interface and add Google Analytics integration.
425
 
426
- = 2.2.1 =
427
  Add 3.2 compatability.
428
 
429
  = 2.2.0 =
@@ -438,7 +458,7 @@ Force service codes to be lowercase and, if opting out of clickback tracking, se
438
  = 2.0.4 =
439
  Fix conflict with other plugins and other bug fixes.
440
 
441
- = 2.0.3 =
442
  Still work in themes that don't have wp_head and wp_footer.
443
 
444
  = 2.0.2 =
@@ -448,5 +468,5 @@ Bug fixes, enhanced customization.
448
  Bug fixes, more filters, small tweak to options.
449
 
450
  = 2.0.0 =
451
- More and better options for sharing widgets. Redesigned analytics dashboard widget and interface.
452
 
1
  === Smart Website Tools by AddThis ===
2
+ Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, mkitzman, kirk-at-addthis, 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.2.2
6
+ Stable tag: 5.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 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
 
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
+ No, you do not need to create an account in order to control a limited number of AddThis sharing tools from within WordPress. In order to use more AddThis tools and see your site's analytics 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 200+ sharing services 60+ languages, to over 1.9 billion unique users in countries all over the world.
63
 
64
  = Who else uses AddThis? =
65
+ Over 15,000,000 sites have installed AddThis. With over 1.9 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 200 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. Mode tab in WordPress admin area
76
+ 2. Profile tab with Analytics link in WordPress admin area
77
+ 3. Analytics on the AddThis Dashboard
78
+ 4. Tool Gallery on the AddThis Dashboard
79
+ 5. Customization options on the AddThis Dashboard
80
+ 6. Sharing Tools tab in the WordPress admin area
81
+ 7. Sharing Tools tab in the WordPress admin area
82
 
83
  == PHP Version ==
84
 
86
 
87
  == Changelog ==
88
 
89
+ = 5.0 =
90
+ * 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.
91
+ * Sharing sidebar configuration available within WordPress (in addition to the previously available sharing buttons above and below content).
92
+ * Seperate preferences for what sharing buttons appear on what templates.
93
+ * Cleaned up plugin and removed deprecated AddThis config options.
94
+ * Added beauty.
95
+ * Removed the global configuration for custom service list.
96
+ * Removed support for themes that use the get_the_excerpt method because of inconsistent results across themes.
97
+
98
  = 4.0.7 =
99
  * Added node marker and loop cap to getFirstElderWithCondition to solve infinite loop
100
  * Fixed the issue where characters *,+,- were printed in feeds
118
  = 4.0.2 =
119
  * Control inline share buttons for each page/post
120
  * Implemented asynchronous script loading
121
+ * Added option to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page.
122
  * Prevented buttons showing on 404 error pages
123
  * CSS fixes
124
  * Added css classes to prevent inline div from taking extra spaces
150
  * Fix for better analytics
151
 
152
  = 3.5.5 =
153
+ * Minor bug fixes.
154
 
155
  = 3.5.4 =
156
+ * Fixed JS errors in Options page.
157
 
158
  = 3.5.3 =
159
  * Fix for wrong url being shared while using Custom Button option
160
 
161
  = 3.5.2 =
162
+ * Minor bug fixes.
163
 
164
  = 3.5.1 =
165
+ * Reintroduced Custom Button Code box
166
 
167
  = 3.5 =
168
  * Drag and drop customization of buttons
175
  * Better JSON validation
176
  * Bug fixes
177
 
178
+ = 3.0.5 =
179
  * Bug fixes: Style conflicts resolved
180
 
181
+ = 3.0.4 =
182
  * Bug fix: Style conflicts with some themes resolved
183
+ * Made friends with WPSupercache
184
 
185
+ = 3.0.3 =
186
  * Bug fix: Style tags are now allowed in Custom Code box.
187
 
188
+ = 3.0.2 =
189
  * Bug fix: Conflict with WpSuperCache resolved
190
  * Wordpress 3.5 style conflicts resolved
191
 
192
+ = 3.0.1 =
193
  * Bug fix: Issues with usernames/passwords with special characters
194
 
195
  = 3.0 =
196
  * UX changes in admin settings
197
+ * Credential verification in Admin settings. If AddThis account details are wrong it will be notified to user.
198
  * Bug fixes
199
 
200
  = 2.5.1 =
211
  = 2.4.1 =
212
  * Bug fixes
213
 
214
+ = 2.4.0 =
215
  * Refactor how we add code to pages which should eliminate how many times it is added
216
  * Numerous Bug Fixes and a few new filters
217
 
218
  = 2.3.2 =
219
+ * Add opt out for copy tracking
220
 
221
  = 2.3.1 =
222
  * Don't strip pintrest tags from custom buttons
252
  * force service codes to be lowercase
253
  * If opting out of clickback tracking, set config to force opting out
254
 
255
+ = 2.0.4 =
256
  * Fix conflict with other plugins
257
  * Prevent button js from appearing in feeds
258
 
261
 
262
  = 2.0.2 =
263
  * Bug Fixes
264
+ * set addthis_exclude custom field to 'true' to not display addthis on that post / page
265
+ * Added additional paramater to
266
  * Ability to specify custom toolboxes for both above and below
267
  * Added additional paramater to do_action('addthis_widget'). Paramaters are now:
268
  * * url (use get_permalink() if you are calling it inside the loop)
269
  * * title (use the_title() if calling inside the loop)
270
  * * Style (specify the style to display) See $addthis_new_styles for the styles. may also pass an arra (see addthis_custom_toolbox for array values to pass)
271
 
 
 
272
  = 2.0.1 =
273
  * Fix theme compatablity issues
274
  * Fix excerpts bug
298
  * Fixed parse bug with "static" menu option
299
  * Fixed regression of brand option
300
 
301
+ = 1.6.3 =
302
  * Added template tags. &lt;?php do_action( 'addthis_widget' ); ?&gt; in your template will print an AddThis button or toolbox, per your configuration.
303
  * Added <a href="http://addthis.com/blog/2010/03/11/clickback-analytics-measure-traffic-back-to-your-site-from-addthis/">clickback</a> tracking.
304
  * Added "Automatic" language option. We'll auto-translate the AddThis button and menu into our supported languages depending on your users' settings.
305
+ * Fixed script showing up in some trackback summaries.
306
 
307
  = 1.6.2 =
308
  Fixed name conflict with get_wp_version() (renamed to addthis_get_wp_version()), affecting users with the k2 theme.
320
 
321
  == Upgrade Notice ==
322
 
323
+ = 5.0 =
324
+ * 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.
325
+ * Sharing sidebar configuration available within WordPress (in addition to the previously available sharing buttons above and below content).
326
+ * Seperate preferences for what sharing buttons appear on what templates.
327
+ * Cleaned up plugin and removed deprecated AddThis config options.
328
+ * Added beauty.
329
+ * Removed the global configuration for custom service list.
330
+ * Removed support for themes that use the get_the_excerpt method because of inconsistent results across themes.
331
+
332
  = 4.0.7 =
333
  * Added node marker and loop cap to getFirstElderWithCondition to solve infinite loop
334
  * Fixed the issue where characters *,+,- were printed in feeds
352
  = 4.0.2 =
353
  * Control inline share buttons for each page/post
354
  * Implemented asynchronous script loading
355
+ * Added option to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page.
356
  * Prevented buttons showing on 404 error pages
357
  * CSS fixes
358
  * Added css classes to prevent inline div from taking extra spaces
392
  = 3.5.3 =
393
  Fix for wrong url being shared while using Custom Button option
394
 
395
+ = 3.5.2 =
396
+ Bug fixes.
397
 
398
+ = 3.5.1 =
399
  Reintroduced Custom Button Code box
400
 
401
  = 3.5 =
404
  = 3.1 =
405
  Bug fixes, better validations
406
 
407
+ = 3.0.5 =
408
  Bug fixes
409
 
410
+ = 3.0.4 =
411
  Bug fixes, made WPSupercache friendly
412
 
413
+ = 3.0.3 =
414
  Bug fixes.
415
 
416
+ = 3.0.2 =
417
  Bug fixes.
418
 
419
+ = 3.0.1 =
420
  Bug fixes.
421
 
422
  = 3.0 =
431
  = 2.4.3 =
432
  Fixed admin console bug for non-administrators.
433
 
434
+ = 2.4.1 =
435
  Bug fixes.
436
 
437
  = 2.4.0 =
440
  = 2.3.2 =
441
  New option for opting out of copy text tracking.
442
 
443
+ = 2.3.0 =
444
  Improve the Settings interface and add Google Analytics integration.
445
 
446
+ = 2.2.1 =
447
  Add 3.2 compatability.
448
 
449
  = 2.2.0 =
458
  = 2.0.4 =
459
  Fix conflict with other plugins and other bug fixes.
460
 
461
+ = 2.0.3 =
462
  Still work in themes that don't have wp_head and wp_footer.
463
 
464
  = 2.0.2 =
468
  Bug fixes, more filters, small tweak to options.
469
 
470
  = 2.0.0 =
471
+ More and better options for sharing widgets. Redesigned analytics dashboard widget and interface.
472
 
uninstall.php CHANGED
@@ -1,6 +1,26 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ /**
3
+ * +--------------------------------------------------------------------------+
4
+ * | Copyright (c) 2008-2015 AddThis, 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
+
22
+ $option = get_option('addthis_settings');
23
+ if ($option && isset($option['addthis_plugin_version'])) {
24
+ $option['addthis_plugin_version'] = 'uninstalled';
25
+ update_option('addthis_settings', $option);
26
+ }