Version Description
- Updated troubleshooting information available to AddThis support to be more in line with other plugins, including providing the anonymous profile IDs to help in moving over statistics to registered profile IDs upon request.
- Improving the way variables are being shared to support global AddThis variables between AddThis plugins (not supported yet by any other plugin) and plugin specific settings. Specifically, this is to make sure things such as the profile ID or addthis_config settings are the same across all AddThis plugins.
- Refactored the filter used on wp_trim_excerpt in WordPress mode to better interact with other modules' and themes' filters on wp_trim_excerpt, excerpt_length and excerpt_more (such as mh-magazine-lite)
- Resolving issues with PHP errors for URLs with %s in them when using "Select Your Own" services
- Resolving services bug, where once a user selected their own for above or below content, the custom services where always used, even if the user went back to Auto Personalization
- Fixing bug with a PHP warning for undefined index below_chosen_list
Download this release
Release Info
Developer | jgrodel |
Plugin | WordPress Share Buttons Plugin – AddThis |
Version | 5.0.9 |
Comparing to | |
See all releases |
Code changes from version 5.0.8 to 5.0.9
- .gitignore +3 -0
- AddThisCmsConnectorInterface.php +0 -2
- AddThisConfigs.php +8 -4
- AddThisWordPressConnector.php +197 -54
- AddThisWordPressSharingButtonsPlugin.php +112 -0
- addthis_post_metabox.php +14 -6
- addthis_settings_functions.php +72 -94
- addthis_sidebar_widget.php +12 -4
- addthis_social_widget.php +300 -256
- js/options-page.32.js +0 -20
- js/options-page.js +0 -20
- readme.txt +19 -3
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
/nbproject/private/
|
2 |
+
/nbproject/
|
3 |
+
.DS_Store
|
AddThisCmsConnectorInterface.php
CHANGED
@@ -24,8 +24,6 @@ if (!interface_exists('AddThisCmsConnectorInterface')) {
|
|
24 |
{
|
25 |
static function getCmsVersion();
|
26 |
static function getCmsMinorVersion();
|
27 |
-
static function getPluginVersion();
|
28 |
-
static function getProductVersion();
|
29 |
public function getSharingButtonLocations();
|
30 |
public function getConfigs();
|
31 |
public function getContentTypes();
|
24 |
{
|
25 |
static function getCmsVersion();
|
26 |
static function getCmsMinorVersion();
|
|
|
|
|
27 |
public function getSharingButtonLocations();
|
28 |
public function getConfigs();
|
29 |
public function getContentTypes();
|
AddThisConfigs.php
CHANGED
@@ -28,12 +28,13 @@ if (!class_exists('AddThisConfigs')) {
|
|
28 |
|
29 |
protected $defaultConfigs = array(
|
30 |
'above' => 'large_toolbox',
|
|
|
|
|
31 |
'above_custom_more' => '',
|
32 |
'above_custom_preferred' => '',
|
33 |
'above_custom_services' => '',
|
34 |
'above_custom_size' => '',
|
35 |
'above_custom_string' => '',
|
36 |
-
'above_sharing' => 'above-enable-smart-sharing',
|
37 |
'addthis_508' => '',
|
38 |
'addthis_above_enabled' => false,
|
39 |
'addthis_addressbar' => false,
|
@@ -58,12 +59,13 @@ if (!class_exists('AddThisConfigs')) {
|
|
58 |
'atversion' => 300,
|
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',
|
@@ -402,14 +404,16 @@ if (!class_exists('AddThisConfigs')) {
|
|
402 |
}
|
403 |
|
404 |
$pluginInfo = array();
|
|
|
405 |
$pluginInfo['cms_name'] = $this->cmsInterface->getCmsName();
|
406 |
$pluginInfo['cms_version'] = $this->cmsInterface->getCmsVersion();
|
407 |
-
$pluginInfo['plugin_name'] = $this->cmsInterface->
|
408 |
$pluginInfo['plugin_version'] = $this->cmsInterface->getPluginVersion();
|
409 |
$pluginInfo['plugin_mode'] = $this->configs['addthis_plugin_controls'];
|
|
|
410 |
|
411 |
$json = json_encode($pluginInfo);
|
412 |
return $json;
|
413 |
}
|
414 |
}
|
415 |
-
}
|
28 |
|
29 |
protected $defaultConfigs = array(
|
30 |
'above' => 'large_toolbox',
|
31 |
+
'above_chosen_list' => '',
|
32 |
+
'above_auto_services' => true,
|
33 |
'above_custom_more' => '',
|
34 |
'above_custom_preferred' => '',
|
35 |
'above_custom_services' => '',
|
36 |
'above_custom_size' => '',
|
37 |
'above_custom_string' => '',
|
|
|
38 |
'addthis_508' => '',
|
39 |
'addthis_above_enabled' => false,
|
40 |
'addthis_addressbar' => false,
|
59 |
'atversion' => 300,
|
60 |
'atversion_update_status' => 0,
|
61 |
'below' => 'large_toolbox',
|
62 |
+
'below_chosen_list' => '',
|
63 |
+
'below_auto_services' => true,
|
64 |
'below_custom_more' => '',
|
65 |
'below_custom_preferred' => '',
|
66 |
'below_custom_services' => '',
|
67 |
'below_custom_size' => '',
|
68 |
'below_custom_string' => '',
|
|
|
69 |
'credential_validation_status' => 0,
|
70 |
'data_ga_property' => '',
|
71 |
'location' => 'below',
|
404 |
}
|
405 |
|
406 |
$pluginInfo = array();
|
407 |
+
$pluginInfo['info_status'] = 'enabled';
|
408 |
$pluginInfo['cms_name'] = $this->cmsInterface->getCmsName();
|
409 |
$pluginInfo['cms_version'] = $this->cmsInterface->getCmsVersion();
|
410 |
+
$pluginInfo['plugin_name'] = $this->cmsInterface->plugin->getName();
|
411 |
$pluginInfo['plugin_version'] = $this->cmsInterface->getPluginVersion();
|
412 |
$pluginInfo['plugin_mode'] = $this->configs['addthis_plugin_controls'];
|
413 |
+
$pluginInfo['anonymous_profile_id'] = $this->getAnonymousProfileId();
|
414 |
|
415 |
$json = json_encode($pluginInfo);
|
416 |
return $json;
|
417 |
}
|
418 |
}
|
419 |
+
}
|
AddThisWordPressConnector.php
CHANGED
@@ -21,68 +21,98 @@
|
|
21 |
|
22 |
require_once('AddThisCmsConnectorInterface.php');
|
23 |
|
24 |
-
if (!class_exists('
|
25 |
-
Class
|
26 |
// implements AddThisCmsConnectorInterface {
|
27 |
|
28 |
static $settingsVariableName = 'addthis_settings';
|
29 |
-
|
30 |
-
static $settingsPageId = 'addthis_social_widget';
|
31 |
static $anonymousProfileIdPrefix = 'wp';
|
32 |
-
static $pluginName = "AddThis Sharing Buttons";
|
33 |
-
static $productPrefix = 'wpp';
|
34 |
static $cmsName = "WordPress";
|
35 |
protected $configs = null;
|
|
|
|
|
36 |
|
37 |
protected $defaultConfigs = array(
|
38 |
'addthis_plugin_controls' => 'WordPress',
|
39 |
);
|
40 |
|
41 |
-
|
42 |
-
array(
|
43 |
-
'current' => array('addthis_above_showon_home', 'addthis_below_showon_home'),
|
44 |
-
'deprecated' => array('addthis_showonhome'),
|
45 |
-
),
|
46 |
-
array(
|
47 |
-
'current' => array('addthis_above_showon_pages', 'addthis_below_showon_pages'),
|
48 |
-
'deprecated' => array('addthis_showonpages'),
|
49 |
-
),
|
50 |
-
array(
|
51 |
-
'current' => array('addthis_above_showon_categories', 'addthis_below_showon_categories'),
|
52 |
-
'deprecated' => array('addthis_showoncats'),
|
53 |
-
),
|
54 |
-
array(
|
55 |
-
'current' => array('addthis_above_showon_archives', 'addthis_below_showon_archives'),
|
56 |
-
'deprecated' => array('addthis_showonarchives'),
|
57 |
-
),
|
58 |
-
array(
|
59 |
-
'current' => array('addthis_above_showon_posts', 'addthis_below_showon_posts'),
|
60 |
-
'deprecated' => array('addthis_showonposts'),
|
61 |
-
),
|
62 |
-
array(
|
63 |
-
'current' => array('addthis_addressbar'),
|
64 |
-
'deprecated' => array('addthis_copytracking2', 'addthis_copytracking1'),
|
65 |
-
),
|
66 |
array(
|
67 |
'current' => array('addthis_profile'),
|
68 |
'deprecated' => array('profile', 'pubid'),
|
69 |
),
|
70 |
);
|
71 |
|
72 |
-
static
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
static function getCmsName() {
|
77 |
return self::$cmsName;
|
78 |
}
|
79 |
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
static function getCmsVersion() {
|
@@ -99,9 +129,8 @@ if (!class_exists('AddThisWordpressConnector')) {
|
|
99 |
return self::$anonymousProfileIdPrefix;
|
100 |
}
|
101 |
|
102 |
-
|
103 |
-
$
|
104 |
-
return $productVersion;
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -153,7 +182,7 @@ if (!class_exists('AddThisWordpressConnector')) {
|
|
153 |
}
|
154 |
|
155 |
public function getSettingsPageUrl() {
|
156 |
-
$url = admin_url("options-general.php?page=" . $this->getSettingsPageId());
|
157 |
return $url;
|
158 |
}
|
159 |
|
@@ -162,26 +191,63 @@ if (!class_exists('AddThisWordpressConnector')) {
|
|
162 |
}
|
163 |
|
164 |
public function getConfigs($cache = false) {
|
165 |
-
if ($this->
|
166 |
-
$this->configs
|
167 |
-
} elseif (!$cache || is_null($this->configs)) {
|
168 |
-
$this->configs = get_option(self::$settingsVariableName);
|
169 |
}
|
170 |
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
$this->configs = null;
|
173 |
}
|
174 |
|
175 |
return $this->configs;
|
176 |
}
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
public function saveConfigs($configs = null) {
|
179 |
if (!is_array($configs)) {
|
180 |
$configs = $this->configs;
|
181 |
}
|
182 |
|
183 |
if (is_array($configs)) {
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
$this->configs = $this->getConfigs();
|
186 |
}
|
187 |
|
@@ -253,7 +319,7 @@ if (!class_exists('AddThisWordpressConnector')) {
|
|
253 |
public function isUpgrade() {
|
254 |
$this->getConfigs(true);
|
255 |
if ( !isset($this->configs['addthis_plugin_version'])
|
256 |
-
|| $this->configs['addthis_plugin_version'] !=
|
257 |
) {
|
258 |
return true;
|
259 |
}
|
@@ -261,15 +327,63 @@ if (!class_exists('AddThisWordpressConnector')) {
|
|
261 |
return false;
|
262 |
}
|
263 |
|
264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
$this->getConfigs(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
if (is_null($this->configs)) {
|
267 |
return $this->configs;
|
268 |
}
|
269 |
|
270 |
-
$this->configs['addthis_plugin_version'] =
|
271 |
|
272 |
-
|
|
|
273 |
foreach ($configUpgradeMapping['current'] as $currentFieldName) {
|
274 |
foreach ($configUpgradeMapping['deprecated'] as $deprecatedFieldName) {
|
275 |
$this->getFromPreviousConfig($deprecatedFieldName, $currentFieldName);
|
@@ -306,6 +420,35 @@ if (!class_exists('AddThisWordpressConnector')) {
|
|
306 |
$this->configs['addthis_plugin_controls'] = "AddThis";
|
307 |
}
|
308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
$this->saveConfigs();
|
310 |
return $this->configs;
|
311 |
}
|
@@ -496,10 +639,10 @@ if (!class_exists('AddThisWordpressConnector')) {
|
|
496 |
|
497 |
public function addSettingsPage($htmlGeneratingFunction) {
|
498 |
$hook_suffix = add_options_page(
|
499 |
-
|
500 |
-
|
501 |
'manage_options',
|
502 |
-
|
503 |
$htmlGeneratingFunction
|
504 |
);
|
505 |
|
21 |
|
22 |
require_once('AddThisCmsConnectorInterface.php');
|
23 |
|
24 |
+
if (!class_exists('AddThisWordPressConnector')) {
|
25 |
+
Class AddThisWordPressConnector {
|
26 |
// implements AddThisCmsConnectorInterface {
|
27 |
|
28 |
static $settingsVariableName = 'addthis_settings';
|
29 |
+
public $plugin = null;
|
|
|
30 |
static $anonymousProfileIdPrefix = 'wp';
|
|
|
|
|
31 |
static $cmsName = "WordPress";
|
32 |
protected $configs = null;
|
33 |
+
protected $sharedConfigVariableName = 'addthis_shared_settings';
|
34 |
+
protected $migratedConfigSettingsName = null;
|
35 |
|
36 |
protected $defaultConfigs = array(
|
37 |
'addthis_plugin_controls' => 'WordPress',
|
38 |
);
|
39 |
|
40 |
+
static $simpleSharedConfigUpgradeMappings = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
array(
|
42 |
'current' => array('addthis_profile'),
|
43 |
'deprecated' => array('profile', 'pubid'),
|
44 |
),
|
45 |
);
|
46 |
|
47 |
+
static $sharedVariables = array(
|
48 |
+
// general
|
49 |
+
'addthis_plugin_controls',
|
50 |
+
'addthis_profile',
|
51 |
+
'addthis_anonymous_profile',
|
52 |
+
'credential_validation_status',
|
53 |
+
'addthis_asynchronous_loading',
|
54 |
+
'addthis_environment',
|
55 |
+
// addthis_share
|
56 |
+
'addthis_twitter_template',
|
57 |
+
'addthis_bitly',
|
58 |
+
'addthis_share_json',
|
59 |
+
// addthis_config
|
60 |
+
'data_ga_property',
|
61 |
+
'addthis_language',
|
62 |
+
'atversion',
|
63 |
+
'addthis_append_data',
|
64 |
+
'addthis_addressbar',
|
65 |
+
'addthis_508',
|
66 |
+
'addthis_config_json',
|
67 |
+
'addthis_plugin_controls',
|
68 |
+
);
|
69 |
+
|
70 |
+
static $deprecatedSharedVariables = array(
|
71 |
+
'addthis_bitly_key',
|
72 |
+
'addthis_bitly_login',
|
73 |
+
'addthis_brand',
|
74 |
+
'addthis_copytracking1',
|
75 |
+
'addthis_copytracking2',
|
76 |
+
'addthis_copytrackingremove',
|
77 |
+
'addthis_fallback_username',
|
78 |
+
'addthis_for_wordpress',
|
79 |
+
'addthis_header_background',
|
80 |
+
'addthis_header_color',
|
81 |
+
'addthis_nag_username_ignore',
|
82 |
+
'addthis_options',
|
83 |
+
'addthis_password',
|
84 |
+
'addthis_show_stats',
|
85 |
+
'addthis_username',
|
86 |
+
'options',
|
87 |
+
'password',
|
88 |
+
'profile',
|
89 |
+
'username',
|
90 |
+
);
|
91 |
+
|
92 |
+
public function __construct($plugin) {
|
93 |
+
$this->plugin = $plugin;
|
94 |
+
}
|
95 |
+
|
96 |
+
public function getPluginVersion() {
|
97 |
+
return $this->plugin->getVersion();
|
98 |
}
|
99 |
|
100 |
static function getCmsName() {
|
101 |
return self::$cmsName;
|
102 |
}
|
103 |
|
104 |
+
public function getDeprecatedVariables() {
|
105 |
+
$sharedVars = self::$deprecatedSharedVariables;
|
106 |
+
$pluginVars = $this->plugin->getDeprecatedVariables();
|
107 |
+
$variables = array_merge($sharedVars, $pluginVars);
|
108 |
+
return $variables;
|
109 |
}
|
110 |
|
111 |
+
public function getSimpleConfigUpgradeMapping() {
|
112 |
+
$sharedVars = self::$simpleSharedConfigUpgradeMappings;
|
113 |
+
$pluginVars = $this->plugin->getSimpleConfigUpgradeMapping();
|
114 |
+
$mapping = array_merge($sharedVars, $pluginVars);
|
115 |
+
return $mapping;
|
116 |
}
|
117 |
|
118 |
static function getCmsVersion() {
|
129 |
return self::$anonymousProfileIdPrefix;
|
130 |
}
|
131 |
|
132 |
+
public function getProductVersion() {
|
133 |
+
return $this->plugin->getProductVersion();
|
|
|
134 |
}
|
135 |
|
136 |
/**
|
182 |
}
|
183 |
|
184 |
public function getSettingsPageUrl() {
|
185 |
+
$url = admin_url("options-general.php?page=" . $this->plugin->getSettingsPageId());
|
186 |
return $url;
|
187 |
}
|
188 |
|
191 |
}
|
192 |
|
193 |
public function getConfigs($cache = false) {
|
194 |
+
if ($cache && is_array($this->configs)) {
|
195 |
+
return $this->configs;
|
|
|
|
|
196 |
}
|
197 |
|
198 |
+
$plugin = $this->getPluginConfigVariables();
|
199 |
+
$shared = $this->getSharedConfigVariables();
|
200 |
+
|
201 |
+
if (is_array($plugin) && is_array($shared)) {
|
202 |
+
$this->configs = array_merge($plugin, $shared);
|
203 |
+
} else if (is_array($plugin)) {
|
204 |
+
$this->configs = $plugin;
|
205 |
+
} else if (is_array($shared)) {
|
206 |
+
$this->configs = $shared;
|
207 |
+
} else {
|
208 |
$this->configs = null;
|
209 |
}
|
210 |
|
211 |
return $this->configs;
|
212 |
}
|
213 |
|
214 |
+
public function getPluginConfigVariables() {
|
215 |
+
if ($this->isPreviewMode()) {
|
216 |
+
$plugin = get_transient($this->plugin->getConfigVariableName());
|
217 |
+
} else {
|
218 |
+
$plugin = get_option($this->plugin->getConfigVariableName());
|
219 |
+
}
|
220 |
+
|
221 |
+
return $plugin;
|
222 |
+
}
|
223 |
+
|
224 |
+
public function getSharedConfigVariables() {
|
225 |
+
if ($this->isPreviewMode()) {
|
226 |
+
$shared = get_transient($this->sharedConfigVariableName);
|
227 |
+
} else {
|
228 |
+
$shared = get_option($this->sharedConfigVariableName);
|
229 |
+
}
|
230 |
+
|
231 |
+
return $shared;
|
232 |
+
}
|
233 |
+
|
234 |
public function saveConfigs($configs = null) {
|
235 |
if (!is_array($configs)) {
|
236 |
$configs = $this->configs;
|
237 |
}
|
238 |
|
239 |
if (is_array($configs)) {
|
240 |
+
$newPluginConfigs = $configs;
|
241 |
+
$newSharedConfigs = array();
|
242 |
+
foreach (self::$sharedVariables as $variable) {
|
243 |
+
if(isset($configs[$variable])) {
|
244 |
+
$newSharedConfigs[$variable] = $configs[$variable];
|
245 |
+
unset($newPluginConfigs[$variable]);
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
update_option($this->plugin->getConfigVariableName(), $newPluginConfigs);
|
250 |
+
update_option($this->sharedConfigVariableName, $newSharedConfigs);
|
251 |
$this->configs = $this->getConfigs();
|
252 |
}
|
253 |
|
319 |
public function isUpgrade() {
|
320 |
$this->getConfigs(true);
|
321 |
if ( !isset($this->configs['addthis_plugin_version'])
|
322 |
+
|| $this->configs['addthis_plugin_version'] != $this->getPluginVersion()
|
323 |
) {
|
324 |
return true;
|
325 |
}
|
327 |
return false;
|
328 |
}
|
329 |
|
330 |
+
private function migrationStatusVariable() {
|
331 |
+
$migrationVariable = $this->plugin->getSettingsPageId() . "_migrated_to";
|
332 |
+
return $migrationVariable;
|
333 |
+
}
|
334 |
+
|
335 |
+
private function recurseForOldConfigs($name) {
|
336 |
+
$configs = get_option($name);
|
337 |
+
if (!is_array($configs)) {
|
338 |
+
return null;
|
339 |
+
}
|
340 |
+
$this->migratedConfigSettingsName = $name;
|
341 |
+
|
342 |
+
$migrationVariable = $this->migrationStatusVariable();
|
343 |
+
if ( isset($configs[$migrationVariable])
|
344 |
+
&& $configs[$migrationVariable] !== $this->plugin->getConfigVariableName()
|
345 |
+
) {
|
346 |
+
$migratedConfigs = recurseForOldConfigs($configs[$migrationVariable]);
|
347 |
+
if (is_array($migrationVariable)) {
|
348 |
+
$config = $migrationVariable;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
|
352 |
+
return $configs;
|
353 |
+
}
|
354 |
+
|
355 |
+
private function getOldConfigs() {
|
356 |
$this->getConfigs(true);
|
357 |
+
$migrationVariable = $this->migrationStatusVariable();
|
358 |
+
|
359 |
+
$oldConfigs = $this->recurseForOldConfigs($this->plugin->getOldConfigVariableName());
|
360 |
+
if ( isset($oldConfigs[$migrationVariable])
|
361 |
+
&& $oldConfigs[$migrationVariable] !== $this->plugin->getConfigVariableName()
|
362 |
+
) {
|
363 |
+
if (is_array($this->configs)) {
|
364 |
+
$this->configs = array_merge($oldConfigs, $this->configs);
|
365 |
+
} else {
|
366 |
+
$this->configs = $oldConfigs;
|
367 |
+
}
|
368 |
+
|
369 |
+
$oldConfigs[$migrationVariable] = $this->plugin->getConfigVariableName();
|
370 |
+
update_option($this->migratedConfigSettingsName, $oldConfigs);
|
371 |
+
|
372 |
+
return $this->configs;
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
public function upgradeConfigs() {
|
377 |
+
$this->getOldConfigs();
|
378 |
+
|
379 |
if (is_null($this->configs)) {
|
380 |
return $this->configs;
|
381 |
}
|
382 |
|
383 |
+
$this->configs['addthis_plugin_version'] = $this->getPluginVersion();
|
384 |
|
385 |
+
$upgradeMapping = $this->getSimpleConfigUpgradeMapping();
|
386 |
+
foreach ($upgradeMapping as $configUpgradeMapping) {
|
387 |
foreach ($configUpgradeMapping['current'] as $currentFieldName) {
|
388 |
foreach ($configUpgradeMapping['deprecated'] as $deprecatedFieldName) {
|
389 |
$this->getFromPreviousConfig($deprecatedFieldName, $currentFieldName);
|
420 |
$this->configs['addthis_plugin_controls'] = "AddThis";
|
421 |
}
|
422 |
|
423 |
+
if ( isset($this->configs['above_sharing'])
|
424 |
+
&& !isset($this->configs['above_auto_services'])
|
425 |
+
) {
|
426 |
+
if($this->configs['above_sharing'] == 'above-disable-smart-sharing') {
|
427 |
+
$this->configs['above_auto_services'] = false;
|
428 |
+
}
|
429 |
+
if($this->configs['above_sharing'] == 'above-enabled-smart-sharing') {
|
430 |
+
$this->configs['above_auto_services'] = true;
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
if ( isset($this->configs['below_sharing'])
|
435 |
+
&& !isset($this->configs['below_auto_services'])
|
436 |
+
) {
|
437 |
+
if($this->configs['below_sharing'] == 'below-disable-smart-sharing') {
|
438 |
+
$this->configs['below_auto_services'] = false;
|
439 |
+
}
|
440 |
+
if($this->configs['below_sharing'] == 'below-enabled-smart-sharing') {
|
441 |
+
$this->configs['below_auto_services'] = true;
|
442 |
+
}
|
443 |
+
}
|
444 |
+
|
445 |
+
$deprecatedVariables = $this->getDeprecatedVariables();
|
446 |
+
foreach ($deprecatedVariables as $field) {
|
447 |
+
if (isset($this->configs[$field])) {
|
448 |
+
unset($this->configs[$field]);
|
449 |
+
}
|
450 |
+
}
|
451 |
+
|
452 |
$this->saveConfigs();
|
453 |
return $this->configs;
|
454 |
}
|
639 |
|
640 |
public function addSettingsPage($htmlGeneratingFunction) {
|
641 |
$hook_suffix = add_options_page(
|
642 |
+
$this->plugin->getName(),
|
643 |
+
$this->plugin->getName(),
|
644 |
'manage_options',
|
645 |
+
$this->plugin->getSettingsPageId(),
|
646 |
$htmlGeneratingFunction
|
647 |
);
|
648 |
|
AddThisWordPressSharingButtonsPlugin.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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('AddThisWordPressSharingButtonsPlugin')) {
|
25 |
+
Class AddThisWordPressSharingButtonsPlugin {
|
26 |
+
// implements AddThisWordPressPluginInterface {
|
27 |
+
|
28 |
+
static $version = '5.0.9';
|
29 |
+
static $settingsPageId = 'addthis_social_widget';
|
30 |
+
static $name = "AddThis Sharing Buttons";
|
31 |
+
static $productPrefix = 'wpp';
|
32 |
+
static $oldConfigVariableName = 'addthis_settings';
|
33 |
+
static $configVariableName = 'addthis_sharing_buttons_settings';
|
34 |
+
|
35 |
+
static $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 |
+
);
|
57 |
+
|
58 |
+
static $deprecatedVariables = array(
|
59 |
+
'above_sharing',
|
60 |
+
'addthis_showonarchives',
|
61 |
+
'addthis_showoncats',
|
62 |
+
'addthis_showonhome',
|
63 |
+
'addthis_showonpages',
|
64 |
+
'addthis_showonposts',
|
65 |
+
'addthis_sidebar_only',
|
66 |
+
'below_sharing',
|
67 |
+
'show_above',
|
68 |
+
'show_below',
|
69 |
+
);
|
70 |
+
|
71 |
+
static function getVersion() {
|
72 |
+
return self::$version;
|
73 |
+
}
|
74 |
+
|
75 |
+
static function getDeprecatedVariables() {
|
76 |
+
return self::$deprecatedVariables;
|
77 |
+
}
|
78 |
+
|
79 |
+
static function getSimpleConfigUpgradeMapping() {
|
80 |
+
return self::$simpleConfigUpgradeMappings;
|
81 |
+
}
|
82 |
+
|
83 |
+
static function getName() {
|
84 |
+
return self::$name;
|
85 |
+
}
|
86 |
+
|
87 |
+
static function getSettingsPageId() {
|
88 |
+
return self::$settingsPageId;
|
89 |
+
}
|
90 |
+
|
91 |
+
static function getOldConfigVariableName() {
|
92 |
+
return self::$oldConfigVariableName;
|
93 |
+
}
|
94 |
+
|
95 |
+
static function getConfigVariableName() {
|
96 |
+
return self::$configVariableName;
|
97 |
+
}
|
98 |
+
|
99 |
+
static function getProductVersion() {
|
100 |
+
$productVersion = self::$productPrefix . '-' . self::getVersion();
|
101 |
+
return $productVersion;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* the folder name for the AddThis plugin - OMG why is this hard coded?!?
|
106 |
+
* @return string
|
107 |
+
*/
|
108 |
+
static function getPluginFolder(){
|
109 |
+
return 'addthis';
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
addthis_post_metabox.php
CHANGED
@@ -23,14 +23,22 @@ class addthis_post_metabox{
|
|
23 |
|
24 |
function admin_init()
|
25 |
{
|
26 |
-
$screens =
|
27 |
-
|
28 |
-
{
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
-
add_action('save_post', array($this, 'save_post') );
|
32 |
|
33 |
-
|
|
|
|
|
34 |
}
|
35 |
|
36 |
function default_hidden_meta_boxes($hidden)
|
23 |
|
24 |
function admin_init()
|
25 |
{
|
26 |
+
$screens = array('post', 'page');
|
27 |
+
|
28 |
+
foreach($screens as $screen) {
|
29 |
+
add_meta_box(
|
30 |
+
'addthis',
|
31 |
+
'AddThis',
|
32 |
+
array($this, 'post_metabox'),
|
33 |
+
$screen,
|
34 |
+
'side',
|
35 |
+
'default'
|
36 |
+
);
|
37 |
}
|
|
|
38 |
|
39 |
+
add_action('save_post', array($this, 'save_post'));
|
40 |
+
|
41 |
+
add_filter('default_hidden_meta_boxes', array($this, 'default_hidden_meta_boxes'));
|
42 |
}
|
43 |
|
44 |
function default_hidden_meta_boxes($hidden)
|
addthis_settings_functions.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
function _get_style_options()
|
26 |
{
|
27 |
global $addthis_new_styles;
|
28 |
-
return
|
29 |
}
|
30 |
|
31 |
/**
|
@@ -331,109 +331,87 @@ function _addthis_print_template_checkboxes($type) {
|
|
331 |
|
332 |
function _addthis_print_services_picker($name, $options) {
|
333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
|
335 |
?>
|
336 |
|
337 |
<div class="<?php echo $name;?>_button_set select_row Sharing-Icons-options-container">
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
</div>
|
360 |
-
<div class="above_option select_row">
|
361 |
-
<span class="radio mt4 addthis-checkbox-label">
|
362 |
-
<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">
|
363 |
-
<strong>Select Your Own</strong>
|
364 |
-
</span>
|
365 |
-
</div>
|
366 |
-
|
367 |
-
<div class="customize-buttons">
|
368 |
-
<div class="sharing-buttons">
|
369 |
-
<h4 class="sortable-heading">Button Options</h4>
|
370 |
-
<input type="text" class="sharing-buttons-search" placeholder="Find a service" maxlength="20" size="30" style="width: 230px; height: 41px; margin: 0;">
|
371 |
-
<ul class="sortable"></ul>
|
372 |
-
</div>
|
373 |
-
<div class="selected-services">
|
374 |
-
<h4 class="sortable-heading">Selected Buttons</h4>
|
375 |
-
<ul class="sortable" data-type="addthisButtons"></ul>
|
376 |
-
</div>
|
377 |
-
</div>
|
378 |
-
<a href="#" class="restore-default-options" style="float: left; padding-left: 100px;">Restore default options</a>
|
379 |
-
<div class="vertical-drag">
|
380 |
-
<p>Drag up or down to reorder services</p>
|
381 |
-
</div>
|
382 |
-
<div class="horizontal-drag">
|
383 |
-
<p>Drag across to add service</p>
|
384 |
-
</div>
|
385 |
-
<?php $list = $name.'_chosen_list'; ?>
|
386 |
-
<input type="hidden" id="<?php echo $name?>-chosen-list" name="addthis_settings[<?php echo $name;?>_chosen_list]" value="<?php echo $options[$list];?>"/>
|
387 |
</span>
|
388 |
-
</
|
389 |
-
<
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
|
396 |
<?php
|
397 |
return true;
|
398 |
}
|
399 |
|
400 |
-
/**
|
401 |
-
* Returns an array of template options
|
402 |
-
* @return string[] an array of strings
|
403 |
-
*/
|
404 |
-
function _addthis_deprecated_fields() {
|
405 |
-
$deletedFields = array(
|
406 |
-
'addthis_bitly_key',
|
407 |
-
'addthis_bitly_login',
|
408 |
-
'addthis_brand',
|
409 |
-
'addthis_copytracking1',
|
410 |
-
'addthis_copytracking2',
|
411 |
-
'addthis_copytrackingremove',
|
412 |
-
'addthis_fallback_username',
|
413 |
-
'addthis_for_wordpress',
|
414 |
-
'addthis_header_background',
|
415 |
-
'addthis_header_color',
|
416 |
-
'addthis_nag_username_ignore',
|
417 |
-
'addthis_options',
|
418 |
-
'addthis_password',
|
419 |
-
'addthis_show_stats',
|
420 |
-
'addthis_show_stats',
|
421 |
-
'addthis_showonarchives',
|
422 |
-
'addthis_showoncats',
|
423 |
-
'addthis_showonhome',
|
424 |
-
'addthis_showonpages',
|
425 |
-
'addthis_showonposts',
|
426 |
-
'addthis_sidebar_only',
|
427 |
-
'addthis_username',
|
428 |
-
'options',
|
429 |
-
'password',
|
430 |
-
'profile',
|
431 |
-
'username',
|
432 |
-
);
|
433 |
-
|
434 |
-
return $deletedFields;
|
435 |
-
}
|
436 |
-
|
437 |
/**
|
438 |
* Returns an array of template options
|
439 |
* @return string[] an array of strings
|
25 |
function _get_style_options()
|
26 |
{
|
27 |
global $addthis_new_styles;
|
28 |
+
return $addthis_new_styles;
|
29 |
}
|
30 |
|
31 |
/**
|
331 |
|
332 |
function _addthis_print_services_picker($name, $options) {
|
333 |
|
334 |
+
$checkedValue = ' checked="checked"';
|
335 |
+
$autoServicesChecked = '';
|
336 |
+
$customServicesChecked = '';
|
337 |
+
$autoServicesKey = $name.'_auto_services';
|
338 |
+
if ($options[$autoServicesKey]) {
|
339 |
+
$autoServicesChecked = $checkedValue;
|
340 |
+
} else {
|
341 |
+
$customServicesChecked = $checkedValue;
|
342 |
+
}
|
343 |
|
344 |
?>
|
345 |
|
346 |
<div class="<?php echo $name;?>_button_set select_row Sharing-Icons-options-container">
|
347 |
+
<div id="<?php echo $name;?>_custom_btns">
|
348 |
+
<span class="<?php echo $name;?>-smart-sharing-container">
|
349 |
+
<span class="smart-sharing-inner-container">
|
350 |
+
|
351 |
+
<h4>Services:</h4>
|
352 |
+
<p>AddThis boosts sharing by automatically showing the right buttons to
|
353 |
+
each user based on their location and activity across the web.</p>
|
354 |
+
<div class="above_option select_row">
|
355 |
+
<span class="radio mt4">
|
356 |
+
<input
|
357 |
+
type="radio"
|
358 |
+
checked="checked"
|
359 |
+
name="addthis_settings[<?php echo $autoServicesKey; ?>]"
|
360 |
+
id="<?php echo $name;?>-enable-smart-sharing"
|
361 |
+
<?php echo $autoServicesChecked; ?>
|
362 |
+
value="1"
|
363 |
+
/>
|
364 |
+
<span class="addthis-checkbox-label">
|
365 |
+
<strong>Auto Personalization</strong>
|
366 |
+
<span> (recommended)</span>
|
367 |
+
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
</span>
|
369 |
+
</div>
|
370 |
+
<div class="above_option select_row">
|
371 |
+
<span class="radio mt4 addthis-checkbox-label">
|
372 |
+
<input
|
373 |
+
type="radio"
|
374 |
+
name="addthis_settings[<?php echo $autoServicesKey; ?>]"
|
375 |
+
id="<?php echo $name;?>-disable-smart-sharing"
|
376 |
+
value="0"
|
377 |
+
<?php echo $customServicesChecked; ?>
|
378 |
+
>
|
379 |
+
<strong>Select Your Own</strong>
|
380 |
+
</span>
|
381 |
+
</div>
|
382 |
+
|
383 |
+
<div class="customize-buttons">
|
384 |
+
<div class="sharing-buttons">
|
385 |
+
<h4 class="sortable-heading">Button Options</h4>
|
386 |
+
<input type="text" class="sharing-buttons-search" placeholder="Find a service" maxlength="20" size="30" style="width: 230px; height: 41px; margin: 0;">
|
387 |
+
<ul class="sortable"></ul>
|
388 |
+
</div>
|
389 |
+
<div class="selected-services">
|
390 |
+
<h4 class="sortable-heading">Selected Buttons</h4>
|
391 |
+
<ul class="sortable" data-type="addthisButtons"></ul>
|
392 |
+
</div>
|
393 |
+
</div>
|
394 |
+
<a href="#" class="restore-default-options" style="float: left; padding-left: 100px;">Restore default options</a>
|
395 |
+
<div class="vertical-drag">
|
396 |
+
<p>Drag up or down to reorder services</p>
|
397 |
+
</div>
|
398 |
+
<div class="horizontal-drag">
|
399 |
+
<p>Drag across to add service</p>
|
400 |
+
</div>
|
401 |
+
<?php $list = $name.'_chosen_list'; ?>
|
402 |
+
<input type="hidden" id="<?php echo $name?>-chosen-list" name="addthis_settings[<?php echo $name;?>_chosen_list]" value="<?php echo $options[$list];?>"/>
|
403 |
+
</span>
|
404 |
+
</span>
|
405 |
+
<script type="text/javascript">
|
406 |
+
window.page = 'sharing-buttons';
|
407 |
+
</script>
|
408 |
+
</div>
|
409 |
+
</div>
|
410 |
|
411 |
<?php
|
412 |
return true;
|
413 |
}
|
414 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
/**
|
416 |
* Returns an array of template options
|
417 |
* @return string[] an array of strings
|
addthis_sidebar_widget.php
CHANGED
@@ -31,13 +31,21 @@ class AddThisSidebarWidget extends WP_Widget {
|
|
31 |
function AddThisSidebarWidget()
|
32 |
{
|
33 |
|
34 |
-
$widget_ops = array(
|
|
|
|
|
|
|
35 |
|
36 |
/* Widget control settings. */
|
37 |
-
$control_ops = array(
|
38 |
|
39 |
/* Create the widget. */
|
40 |
-
$this->WP_Widget(
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
}
|
43 |
|
@@ -56,7 +64,7 @@ class AddThisSidebarWidget extends WP_Widget {
|
|
56 |
if ($title)
|
57 |
echo $before_title . $title . $after_title;
|
58 |
|
59 |
-
printf(
|
60 |
|
61 |
echo $after_widget;
|
62 |
}
|
31 |
function AddThisSidebarWidget()
|
32 |
{
|
33 |
|
34 |
+
$widget_ops = array(
|
35 |
+
'classname' => 'atwidget',
|
36 |
+
'description' => 'Make it wasy for your users to share content to over 300 destinations'
|
37 |
+
);
|
38 |
|
39 |
/* Widget control settings. */
|
40 |
+
$control_ops = array('width' => 325);
|
41 |
|
42 |
/* Create the widget. */
|
43 |
+
$this->WP_Widget(
|
44 |
+
'addthis-widget',
|
45 |
+
'AddThis Sharing Buttons',
|
46 |
+
$widget_ops,
|
47 |
+
$control_ops
|
48 |
+
);
|
49 |
|
50 |
}
|
51 |
|
64 |
if ($title)
|
65 |
echo $before_title . $title . $after_title;
|
66 |
|
67 |
+
printf($addthis_new_styles[$instance['style']]['src'], '');
|
68 |
|
69 |
echo $after_widget;
|
70 |
}
|
addthis_social_widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: AddThis Sharing Buttons
|
4 |
* Plugin URI: http://www.addthis.com
|
5 |
* Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
|
6 |
-
* Version: 5.0.
|
7 |
* Author: The AddThis Team
|
8 |
* Author URI: http://www.addthis.com/
|
9 |
* License: GPL2
|
@@ -33,10 +33,12 @@ else return;
|
|
33 |
define( 'addthis_style_default' , 'fb_tw_p1_sc');
|
34 |
define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
|
35 |
|
|
|
36 |
require_once('AddThisWordPressConnector.php');
|
37 |
require_once('AddThisConfigs.php');
|
38 |
|
39 |
-
$
|
|
|
40 |
$addThisConfigs = new AddThisConfigs($cmsConnector);
|
41 |
$addthis_options = $addThisConfigs->getConfigs();
|
42 |
|
@@ -112,8 +114,9 @@ function pluginActivationNotice()
|
|
112 |
* @since 2.0.6
|
113 |
*/
|
114 |
add_action('admin_notices', 'pluginActivationNotice');
|
115 |
-
function addthis_activation_hook(){
|
116 |
-
$
|
|
|
117 |
$addThisConfigs = new AddThisConfigs($cmsConnector);
|
118 |
$options = $addThisConfigs->getConfigs();
|
119 |
$addThisConfigs->saveConfigs($options);
|
@@ -316,6 +319,7 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
316 |
{
|
317 |
global $current_user;
|
318 |
global $addThisConfigs;
|
|
|
319 |
|
320 |
$user_id = $current_user->ID;
|
321 |
$addthis_new_options = array();
|
@@ -383,7 +387,7 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
383 |
|
384 |
// old options that are no longer used, to clean up after ourshelves
|
385 |
if (false) {
|
386 |
-
$deprecatedFields =
|
387 |
foreach ($deprecatedFields as $field) {
|
388 |
delete_option($field);
|
389 |
}
|
@@ -425,17 +429,18 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
425 |
|
426 |
$identifier = addthis_get_identifier($url, $title);
|
427 |
|
428 |
-
echo "\n<!-- AddThis Custom -->\n";
|
429 |
if (!is_array($style) && isset($addthis_new_styles[$style])) {
|
430 |
-
|
431 |
} elseif ($style == 'above') {
|
432 |
-
$
|
433 |
-
echo sprintf($above, $identifier);
|
434 |
} elseif ($style == 'below') {
|
435 |
-
$
|
436 |
-
|
437 |
-
|
438 |
-
|
|
|
|
|
|
|
439 |
echo "\n<!-- End AddThis Custom -->\n";
|
440 |
}
|
441 |
|
@@ -446,13 +451,25 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
446 |
function addthis_get_identifier($url = null, $title = null)
|
447 |
{
|
448 |
|
449 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
$identifier = "addthis:url='$url' ";
|
451 |
-
|
|
|
|
|
452 |
$identifier .= "addthis:title='$title'";
|
|
|
453 |
|
454 |
-
if (!
|
455 |
$identifier = '';
|
|
|
456 |
|
457 |
return $identifier;
|
458 |
}
|
@@ -467,17 +484,15 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
467 |
* @param $options array
|
468 |
*/
|
469 |
|
470 |
-
function addthis_custom_toolbox($options
|
471 |
{
|
472 |
-
$identifier = addthis_get_identifier($url, $title);
|
473 |
-
|
474 |
$outerClasses = 'addthis_toolbox addthis_default_style';
|
475 |
|
476 |
if (isset($options['size']) && $options['size'] == '32')
|
477 |
$outerClasses .= ' addthis_32x32_style';
|
478 |
|
479 |
if (isset($options['type']) && $options['type'] != 'custom_string') {
|
480 |
-
$button = '<div class="'.$outerClasses.'"
|
481 |
|
482 |
if (isset($options['services']) ) {
|
483 |
$services = explode(',', $options['services']);
|
@@ -553,27 +568,70 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
553 |
add_action('admin_notices', 'addthis_admin_notices');
|
554 |
|
555 |
function addthis_admin_notices(){
|
556 |
-
if (!
|
|
|
|
|
|
|
557 |
return;
|
|
|
|
|
558 |
global $cmsConnector;
|
|
|
559 |
|
560 |
-
global $current_user ;
|
561 |
$user_id = $current_user->ID;
|
562 |
-
$options =
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
}
|
|
|
|
|
577 |
}
|
578 |
add_action('admin_init', 'addthis_nag_ignore');
|
579 |
|
@@ -631,7 +689,6 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
631 |
function addthis_save_settings($input)
|
632 |
{
|
633 |
global $addThisConfigs;
|
634 |
-
$options_array = $addThisConfigs->getConfigs();
|
635 |
|
636 |
// if special, do special, else
|
637 |
if ( isset($input['addthis_csr_confirmation'])
|
@@ -640,13 +697,15 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
640 |
if ( isset($input['addthis_profile'])
|
641 |
&& wp_verify_nonce($_POST['pubid_nonce'], 'update_pubid')
|
642 |
) {
|
643 |
-
$
|
644 |
}
|
645 |
} else {
|
646 |
-
$
|
647 |
}
|
648 |
|
649 |
-
|
|
|
|
|
650 |
}
|
651 |
|
652 |
|
@@ -662,34 +721,31 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
662 |
$below_custom_styles = $above_custom_styles = '';
|
663 |
$options = $addThisConfigs->getConfigs();
|
664 |
|
665 |
-
if (
|
666 |
-
$options['above_sharing'] = $data['above_sharing'];
|
667 |
-
if ( isset($data['below_sharing']))
|
668 |
-
$options['below_sharing'] = $data['below_sharing'];
|
669 |
-
|
670 |
-
if ( isset ($data['show_below']) )
|
671 |
$options['below'] = 'none';
|
672 |
-
elseif (isset($data['below'], $styles[$data['below']])
|
673 |
$options['below'] = $data['below'];
|
674 |
-
elseif ($data['below'] == 'disable')
|
675 |
$options['below'] = $data['below'];
|
676 |
-
elseif ($data['below'] == 'none')
|
677 |
-
{
|
678 |
$options['below'] = 'none';
|
679 |
-
}
|
680 |
-
|
681 |
-
|
682 |
-
$options['below_do_custom_services'] = isset($data['below_do_custom_services']) ;
|
683 |
-
$options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']) ;
|
684 |
|
685 |
$options['below'] = 'custom';
|
686 |
-
|
687 |
-
|
688 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
$options['below_custom_more'] = isset($data['below_custom_more']);
|
690 |
-
}
|
691 |
-
elseif ($data['below'] == 'custom_string')
|
692 |
-
{
|
693 |
$options['below'] = 'custom_string';
|
694 |
if (strpos($data['below_custom_string'], "style=") != false) {
|
695 |
$custom_style = explode('style=', $data['below_custom_string']);
|
@@ -697,96 +753,101 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
697 |
$custom_style = explode(' ', $custom_style[0]);
|
698 |
$below_custom_styles = " style=$custom_style[0]";
|
699 |
}
|
700 |
-
$options['below_custom_string'] = addthis_kses(
|
|
|
|
|
|
|
701 |
}
|
702 |
|
703 |
-
if (
|
704 |
$options['wpfooter'] = (bool) $data['wpfooter'];
|
|
|
705 |
|
706 |
-
if (
|
707 |
-
$options['above'] = 'none';
|
708 |
-
elseif ( isset($styles[$data['above']]) )
|
709 |
$options['above'] = $data['above'];
|
710 |
-
elseif ($data['above'] == 'disable')
|
711 |
$options['above'] = $data['above'];
|
712 |
-
elseif ($data['above'] == 'none')
|
713 |
-
{
|
714 |
$options['above'] = 'none';
|
715 |
-
}
|
716 |
-
elseif ($data['above'] == 'custom')
|
717 |
-
{
|
718 |
-
|
719 |
$options['above_do_custom_services'] = isset($data['above_do_custom_services']) ;
|
720 |
$options['above_do_custom_preferred'] = isset($data['above_do_custom_preferred']) ;
|
721 |
$options['above'] = 'custom';
|
722 |
-
|
723 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
724 |
$options['above_custom_preferred'] = (int) $data['above_custom_preferred'] ;
|
725 |
$options['above_custom_more'] = isset($data['above_custom_more']);
|
726 |
-
}
|
727 |
-
elseif ($data['above'] == 'custom_string')
|
728 |
-
{
|
729 |
//[addthis_twitter_template]
|
730 |
-
if (
|
|
|
|
|
731 |
//Parse the first twitter username to be used with via
|
732 |
$options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
|
733 |
}
|
734 |
|
735 |
$options['above'] = 'custom_string';
|
736 |
-
if (strpos($data['above_custom_string'], "style=")
|
737 |
$custom_style = explode('style=', $data['above_custom_string']);
|
738 |
$custom_style = explode('>', $custom_style[1]);
|
739 |
$custom_style = explode(' ', $custom_style[0]);
|
740 |
$above_custom_styles = " style=$custom_style[0]";
|
741 |
}
|
742 |
-
$options['above_custom_string'] = addthis_kses(
|
743 |
-
|
|
|
|
|
744 |
}
|
745 |
|
746 |
if (isset($data['addthis_profile'])) {
|
747 |
$options['addthis_profile'] = sanitize_text_field($data['addthis_profile']);
|
748 |
}
|
749 |
|
750 |
-
if (
|
751 |
-
$options['above_sharing'] = $data['above_sharing'];
|
752 |
-
if ( isset($data['below_sharing']))
|
753 |
-
$options['below_sharing'] = $data['below_sharing'];
|
754 |
-
|
755 |
-
if ( isset ($data['show_below']) )
|
756 |
-
$options['below'] = 'none';
|
757 |
-
elseif ( isset($styles[$data['below']]) )
|
758 |
$options['below'] = $data['below'];
|
759 |
-
elseif ($data['below'] == 'disable')
|
760 |
$options['below'] = $data['below'];
|
761 |
-
elseif ($data['below'] == 'none')
|
762 |
-
{
|
763 |
$options['below'] = 'none';
|
764 |
-
}
|
765 |
-
elseif ($data['below'] == 'custom')
|
766 |
-
{
|
767 |
$options['below_do_custom_services'] = isset($data['below_do_custom_services']) ;
|
768 |
$options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']) ;
|
769 |
|
770 |
$options['below'] = 'custom';
|
771 |
-
|
772 |
-
|
773 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
774 |
$options['below_custom_more'] = isset($data['below_custom_more']);
|
775 |
-
}
|
776 |
-
elseif ($data['below'] == 'custom_string')
|
777 |
-
{
|
778 |
$options['below'] = 'custom_string';
|
779 |
-
if (strpos($data['below_custom_string'], "style=")
|
780 |
$custom_style = explode('style=', $data['below_custom_string']);
|
781 |
$custom_style = explode('>', $custom_style[1]);
|
782 |
$custom_style = explode(' ', $custom_style[0]);
|
783 |
$below_custom_styles = " style=$custom_style[0]";
|
784 |
}
|
785 |
-
$options['below_custom_string'] = addthis_kses(
|
|
|
|
|
|
|
786 |
}
|
787 |
|
788 |
// All the checkbox fields
|
789 |
$checkboxFields = array(
|
|
|
790 |
'addthis_508',
|
791 |
'addthis_above_enabled',
|
792 |
'addthis_addressbar',
|
@@ -796,8 +857,9 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
796 |
'addthis_beforecomments',
|
797 |
'addthis_below_enabled',
|
798 |
'addthis_bitly',
|
799 |
-
'addthis_sidebar_enabled',
|
800 |
'addthis_per_post_enabled',
|
|
|
|
|
801 |
);
|
802 |
|
803 |
// add all share button location template settings to list of checkbox fields
|
@@ -807,8 +869,7 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
807 |
$checkboxFields[] = $optionName;
|
808 |
}
|
809 |
|
810 |
-
foreach ($checkboxFields as $field)
|
811 |
-
{
|
812 |
if (isset($data[$field]) && $data[$field]) {
|
813 |
$options[$field] = true;
|
814 |
} else {
|
@@ -821,26 +882,29 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
821 |
}
|
822 |
|
823 |
//[addthis_twitter_template]
|
824 |
-
if (
|
825 |
//Parse the first twitter username to be used with via
|
826 |
$options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
|
827 |
}
|
828 |
|
829 |
//[addthis_language] =>
|
830 |
-
if (
|
831 |
$options['addthis_language'] = sanitize_text_field($data['addthis_language']);
|
832 |
-
|
833 |
|
834 |
//[atversion]=>
|
835 |
-
if (
|
836 |
$options['atversion'] = sanitize_text_field($data['atversion']);
|
|
|
837 |
|
838 |
//[atversion_update_status]=>
|
839 |
-
if (
|
840 |
$options['atversion_update_status'] = sanitize_text_field($data['atversion_update_status']);
|
|
|
841 |
|
842 |
-
if (
|
843 |
$options['credential_validation_status'] = sanitize_text_field($data['credential_validation_status']);
|
|
|
844 |
|
845 |
if (isset($data['addthis_config_json'])) {
|
846 |
$options['addthis_config_json'] = sanitize_text_field($data['addthis_config_json']);
|
@@ -850,45 +914,43 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
850 |
$options['addthis_share_json'] = sanitize_text_field($data['addthis_share_json']);
|
851 |
}
|
852 |
|
853 |
-
if (
|
854 |
-
{
|
855 |
$options['above_chosen_list'] = sanitize_text_field($data['above_chosen_list']);
|
856 |
-
}
|
857 |
-
else {
|
858 |
$options['above_chosen_list'] = "";
|
859 |
}
|
860 |
|
861 |
-
if (
|
862 |
-
{
|
863 |
$options['below_chosen_list'] = sanitize_text_field($data['below_chosen_list']);
|
864 |
-
}
|
865 |
-
else {
|
866 |
$options['below_chosen_list'] = "";
|
867 |
}
|
868 |
|
869 |
-
if(isset
|
870 |
$options['addthis_sidebar_position'] = $data['addthis_sidebar_position'];
|
871 |
}
|
872 |
|
873 |
-
if(isset
|
874 |
$options['addthis_sidebar_count'] = $data['addthis_sidebar_count'];
|
875 |
}
|
876 |
|
877 |
-
if(isset
|
878 |
$options['addthis_sidebar_theme'] = $data['addthis_sidebar_theme'];
|
879 |
}
|
880 |
|
881 |
-
if(isset($data['addthis_environment'])){
|
882 |
$options['addthis_environment'] = $data['addthis_environment'];
|
883 |
}
|
884 |
|
885 |
-
if(isset
|
886 |
$options['addthis_plugin_controls'] = $data['addthis_plugin_controls'];
|
887 |
}
|
888 |
|
889 |
if (isset($data['addthis_rate_us'])) {
|
|
|
|
|
|
|
890 |
$options['addthis_rate_us'] = $data['addthis_rate_us'];
|
891 |
-
$options['addthis_rate_us_timestamp'] = time();
|
892 |
}
|
893 |
|
894 |
return $options;
|
@@ -918,8 +980,9 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
918 |
add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt', 11);
|
919 |
}
|
920 |
|
921 |
-
if (
|
922 |
add_filter('the_title', 'addthis_display_after_title', 11);
|
|
|
923 |
|
924 |
add_filter('the_content', 'addthis_display_social_widget', 15);
|
925 |
|
@@ -1016,57 +1079,23 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1016 |
echo $after_widget;
|
1017 |
}
|
1018 |
|
1019 |
-
//
|
1020 |
-
function addthis_remove_tag($content
|
1021 |
{
|
1022 |
global $addThisConfigs;
|
1023 |
$options = $addThisConfigs->getConfigs();
|
1024 |
|
1025 |
-
$
|
1026 |
-
|
1027 |
-
|
1028 |
-
$text = get_the_content('');
|
1029 |
-
$text = strip_shortcodes( $text );
|
1030 |
-
|
1031 |
-
remove_filter('the_content', 'addthis_display_social_widget', 15);
|
1032 |
-
|
1033 |
-
$text = apply_filters('the_content', $text);
|
1034 |
-
|
1035 |
-
add_filter('the_content', 'addthis_display_social_widget', 15);
|
1036 |
-
|
1037 |
-
$text = str_replace(']]>', ']]>', $text);
|
1038 |
-
|
1039 |
-
// 3.3 and earlier
|
1040 |
-
if (! function_exists('wp_trim_words'))
|
1041 |
-
$text = strip_tags($text);
|
1042 |
-
$excerpt_length = apply_filters('excerpt_length', 55);
|
1043 |
-
$excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
|
1044 |
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
else
|
1051 |
-
{
|
1052 |
-
$words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
|
1053 |
-
if ( count($words) > $excerpt_length ) {
|
1054 |
-
array_pop($words);
|
1055 |
-
$text = implode(' ', $words);
|
1056 |
-
$text = $text . $excerpt_more;
|
1057 |
-
} else {
|
1058 |
-
$text = implode(' ', $words);
|
1059 |
-
}
|
1060 |
-
}
|
1061 |
-
if (!_addthis_excerpt_buttons_enabled()) {
|
1062 |
-
return $text;
|
1063 |
-
}
|
1064 |
-
return addthis_display_social_widget($text, false, false);
|
1065 |
-
}
|
1066 |
-
else
|
1067 |
-
{
|
1068 |
-
return $content;
|
1069 |
}
|
|
|
|
|
1070 |
}
|
1071 |
|
1072 |
/**
|
@@ -1075,42 +1104,46 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1075 |
function addthis_late_widget($link_text)
|
1076 |
{
|
1077 |
global $addThisConfigs;
|
1078 |
-
|
1079 |
-
|
1080 |
|
|
|
1081 |
if (!_addthis_excerpt_buttons_enabled()) {
|
1082 |
return $link_text;
|
1083 |
}
|
1084 |
|
1085 |
-
|
1086 |
$styles = array_merge($addthis_styles, $addthis_new_styles);
|
1087 |
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
|
|
|
|
1093 |
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
if ($options['below_do_custom_services'])
|
1098 |
-
$belowOptions['services'] = $options['below_custom_services'];
|
1099 |
-
if ($options['below_do_custom_preferred'])
|
1100 |
-
$belowOptions['preferred'] = $options['below_custom_preferred'];
|
1101 |
-
$belowOptions['more'] = $options['below_custom_more'];
|
1102 |
-
return $link_text . apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
|
1103 |
-
}
|
1104 |
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
|
|
|
|
|
|
|
|
|
|
1112 |
}
|
1113 |
-
|
|
|
|
|
|
|
1114 |
}
|
1115 |
|
1116 |
|
@@ -1128,11 +1161,14 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1128 |
}
|
1129 |
}
|
1130 |
|
1131 |
-
function addthis_display_widget_above($styles, $
|
1132 |
$above = '';
|
1133 |
if ($options['addthis_above_enabled'] == true){
|
1134 |
if (isset($styles[$options['above']])) {
|
1135 |
-
if (isset($options['above_chosen_list']
|
|
|
|
|
|
|
1136 |
if (isset($options['above']) && $options['above'] == 'large_toolbox') {
|
1137 |
$aboveOptions['size'] = '32';
|
1138 |
} elseif (isset($options['above']) && $options['above'] == 'small_toolbox') {
|
@@ -1140,9 +1176,9 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1140 |
}
|
1141 |
$aboveOptions['type'] = $options['above'];
|
1142 |
$aboveOptions['services'] = $options['above_chosen_list'];
|
1143 |
-
$above =
|
1144 |
} else {
|
1145 |
-
$above =
|
1146 |
}
|
1147 |
} elseif ($options['above'] == 'custom') {
|
1148 |
$aboveOptions['size'] = $options['above_custom_size'];
|
@@ -1151,20 +1187,23 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1151 |
if ($options['above_do_custom_preferred'])
|
1152 |
$aboveOptions['preferred'] = $options['above_custom_preferred'];
|
1153 |
$aboveOptions['more'] = $options['above_custom_more'];
|
1154 |
-
$above =
|
1155 |
} elseif ($options['above'] == 'custom_string') {
|
1156 |
$custom = preg_replace('/<\s*div\s*/', '<div %1$s ', $options['above_custom_string']);
|
1157 |
-
$above =
|
1158 |
}
|
1159 |
}
|
1160 |
return $above;
|
1161 |
}
|
1162 |
|
1163 |
-
function addthis_display_widget_below($styles, $
|
1164 |
$below = '';
|
1165 |
if ($options['addthis_below_enabled'] == true){
|
1166 |
if (isset($styles[$options['below']])) {
|
1167 |
-
if (isset($options['below_chosen_list']
|
|
|
|
|
|
|
1168 |
if (isset($options['below']) && $options['below'] == 'large_toolbox') {
|
1169 |
$belowOptions['size'] = '32';
|
1170 |
} elseif (isset($options['below']) && $options['below'] == 'small_toolbox') {
|
@@ -1172,19 +1211,19 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1172 |
}
|
1173 |
$belowOptions['type'] = $options['below'];
|
1174 |
$belowOptions['services'] = $options['below_chosen_list'];
|
1175 |
-
$below =
|
1176 |
} else {
|
1177 |
-
$below =
|
1178 |
}
|
1179 |
} elseif ($options['below'] == 'custom') {
|
1180 |
$belowOptions['size'] = $options['below_custom_size'];
|
1181 |
$belowOptions['services'] = $options['below_custom_services'];
|
1182 |
$belowOptions['preferred'] = $options['below_custom_preferred'];
|
1183 |
$belowOptions['more'] = $options['below_custom_more'];
|
1184 |
-
$below =
|
1185 |
} elseif ($options['below'] == 'custom_string') {
|
1186 |
$custom = preg_replace('/<\s*div\s*/', '<div %1$s ', $options['below_custom_string']);
|
1187 |
-
$below =
|
1188 |
}
|
1189 |
}
|
1190 |
return $below;
|
@@ -1238,17 +1277,9 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1238 |
$displayBelow = false;
|
1239 |
}
|
1240 |
|
1241 |
-
|
1242 |
-
$displayBelow = apply_filters('addthis_post_exclude', $displayBelow);
|
1243 |
-
|
1244 |
-
remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
|
1245 |
remove_filter('get_the_excerpt', 'addthis_late_widget');
|
1246 |
-
$
|
1247 |
-
$title = get_the_title();
|
1248 |
-
$url_above = "addthis:url='$url' ";
|
1249 |
-
$url_above .= "addthis:title='". esc_attr( $title) ." '";
|
1250 |
-
$url_below = "addthis:url='$url' ";
|
1251 |
-
$url_below .= "addthis:title='". esc_attr( $title) ." '";
|
1252 |
|
1253 |
// Still here? Well let's add some social goodness
|
1254 |
if ( isset($options['above'])
|
@@ -1256,9 +1287,9 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1256 |
&& $options['above'] != 'disable'
|
1257 |
&& $displayAbove
|
1258 |
) {
|
1259 |
-
$above = addthis_display_widget_above($styles, $
|
1260 |
} elseif ($displayAbove) {
|
1261 |
-
$above =
|
1262 |
} else {
|
1263 |
$above = '';
|
1264 |
}
|
@@ -1269,19 +1300,16 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1269 |
&& $displayBelow
|
1270 |
&& ! $below_excerpt
|
1271 |
) {
|
1272 |
-
$below = addthis_display_widget_below($styles, $
|
1273 |
} elseif ( $below_excerpt
|
1274 |
&& $displayBelow
|
1275 |
&& $options['below'] != 'none'
|
1276 |
) {
|
1277 |
-
$below =
|
1278 |
-
|
1279 |
|
1280 |
if (_addthis_excerpt_buttons_enabled()) {
|
1281 |
add_filter('get_the_excerpt', 'addthis_late_widget', 14);
|
1282 |
}
|
1283 |
-
} elseif ($displayBelow) {
|
1284 |
-
$below = apply_filters('addthis_below_content', '');
|
1285 |
} else {
|
1286 |
$below = '';
|
1287 |
}
|
@@ -1293,15 +1321,15 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1293 |
|
1294 |
if ($at_flag !== '0') {
|
1295 |
if ($displayAbove && isset($above)) {
|
1296 |
-
$content = sprintf($above, $
|
1297 |
}
|
1298 |
if ($displayBelow && isset($below)) {
|
1299 |
-
$content = $content . sprintf($below, $
|
1300 |
}
|
1301 |
}
|
1302 |
|
1303 |
if (($displayAbove || $displayBelow) && $filtered) {
|
1304 |
-
add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11,
|
1305 |
}
|
1306 |
|
1307 |
return $content;
|
@@ -1470,9 +1498,10 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1470 |
$link = !is_null($url) ? $url : ($onSidebar ? get_bloginfo('url') : get_permalink());
|
1471 |
$title = !is_null($title) ? $title : ($onSidebar ? get_bloginfo('title') : the_title('', '', false));
|
1472 |
|
1473 |
-
$content .=
|
1474 |
-
|
1475 |
-
|
|
|
1476 |
."var addthis_product = '". $cmsConnector->getProductVersion() ."';\n";
|
1477 |
|
1478 |
|
@@ -1481,32 +1510,47 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
|
|
1481 |
$content .= ($addthis_settings['customization']) . "\n";
|
1482 |
}
|
1483 |
|
1484 |
-
if ($addthis_settings['menu_type'] === 'dropdown')
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
|
|
|
|
|
|
|
|
1491 |
$content .= ($addthis_settings['language'] == '' ? '' /* no hardcoded image -- we'll choose the language automatically */ : addthis_get_button_img()) . '</a><script data-cfasync="false" type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
|
1492 |
-
}
|
1493 |
-
else if ($addthis_settings['menu_type'] === 'toolbox')
|
1494 |
-
{
|
1495 |
$content .= "\n//-->\n</script>\n";
|
1496 |
-
$content .=
|
1497 |
-
<div
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1503 |
$link = urlencode($link);
|
1504 |
$title = urlencode($title);
|
1505 |
-
$content .=
|
1506 |
-
|
1507 |
-
|
1508 |
-
<
|
1509 |
-
|
|
|
|
|
|
|
|
|
|
|
1510 |
$content .= addthis_get_button_img() . '</a></div>';
|
1511 |
}
|
1512 |
$content .= "\n<!-- AddThis Button END -->";
|
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.9
|
7 |
* Author: The AddThis Team
|
8 |
* Author URI: http://www.addthis.com/
|
9 |
* License: GPL2
|
33 |
define( 'addthis_style_default' , 'fb_tw_p1_sc');
|
34 |
define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
|
35 |
|
36 |
+
require_once('AddThisWordPressSharingButtonsPlugin.php');
|
37 |
require_once('AddThisWordPressConnector.php');
|
38 |
require_once('AddThisConfigs.php');
|
39 |
|
40 |
+
$addThisSharingButtonsPluginObject = new AddThisWordPressSharingButtonsPlugin();
|
41 |
+
$cmsConnector = new AddThisWordPressConnector($addThisSharingButtonsPluginObject);
|
42 |
$addThisConfigs = new AddThisConfigs($cmsConnector);
|
43 |
$addthis_options = $addThisConfigs->getConfigs();
|
44 |
|
114 |
* @since 2.0.6
|
115 |
*/
|
116 |
add_action('admin_notices', 'pluginActivationNotice');
|
117 |
+
function addthis_activation_hook() {
|
118 |
+
$addThisSharingButtonsPluginObject = new AddThisWordPressSharingButtonsPlugin();
|
119 |
+
$cmsConnector = new AddThisWordPressConnector($addThisSharingButtonsPluginObject);
|
120 |
$addThisConfigs = new AddThisConfigs($cmsConnector);
|
121 |
$options = $addThisConfigs->getConfigs();
|
122 |
$addThisConfigs->saveConfigs($options);
|
319 |
{
|
320 |
global $current_user;
|
321 |
global $addThisConfigs;
|
322 |
+
global $cmsConnector;
|
323 |
|
324 |
$user_id = $current_user->ID;
|
325 |
$addthis_new_options = array();
|
387 |
|
388 |
// old options that are no longer used, to clean up after ourshelves
|
389 |
if (false) {
|
390 |
+
$deprecatedFields = $cmsConnector->getDeprecatedVariables();
|
391 |
foreach ($deprecatedFields as $field) {
|
392 |
delete_option($field);
|
393 |
}
|
429 |
|
430 |
$identifier = addthis_get_identifier($url, $title);
|
431 |
|
|
|
432 |
if (!is_array($style) && isset($addthis_new_styles[$style])) {
|
433 |
+
$template = $addthis_new_styles[$style]['src'];
|
434 |
} elseif ($style == 'above') {
|
435 |
+
$template = addthis_display_widget_above($styles, $options);
|
|
|
436 |
} elseif ($style == 'below') {
|
437 |
+
$template = addthis_display_widget_below($styles, $options);
|
438 |
+
} elseif (is_array($style)) {
|
439 |
+
$template = addthis_custom_toolbox($style);
|
440 |
+
}
|
441 |
+
|
442 |
+
echo "\n<!-- AddThis Custom -->\n";
|
443 |
+
echo sprintf($template, $identifier);
|
444 |
echo "\n<!-- End AddThis Custom -->\n";
|
445 |
}
|
446 |
|
451 |
function addthis_get_identifier($url = null, $title = null)
|
452 |
{
|
453 |
|
454 |
+
if (is_null($url)) {
|
455 |
+
$url = get_permalink();
|
456 |
+
}
|
457 |
+
|
458 |
+
if (is_null($title)) {
|
459 |
+
$title = esc_attr(get_the_title());
|
460 |
+
}
|
461 |
+
|
462 |
+
if (!is_null($url)) {
|
463 |
$identifier = "addthis:url='$url' ";
|
464 |
+
}
|
465 |
+
|
466 |
+
if (!is_null($title)) {
|
467 |
$identifier .= "addthis:title='$title'";
|
468 |
+
}
|
469 |
|
470 |
+
if (!isset($identifier)) {
|
471 |
$identifier = '';
|
472 |
+
}
|
473 |
|
474 |
return $identifier;
|
475 |
}
|
484 |
* @param $options array
|
485 |
*/
|
486 |
|
487 |
+
function addthis_custom_toolbox($options)
|
488 |
{
|
|
|
|
|
489 |
$outerClasses = 'addthis_toolbox addthis_default_style';
|
490 |
|
491 |
if (isset($options['size']) && $options['size'] == '32')
|
492 |
$outerClasses .= ' addthis_32x32_style';
|
493 |
|
494 |
if (isset($options['type']) && $options['type'] != 'custom_string') {
|
495 |
+
$button = '<div class="'.$outerClasses.'" %1$s>';
|
496 |
|
497 |
if (isset($options['services']) ) {
|
498 |
$services = explode(',', $options['services']);
|
568 |
add_action('admin_notices', 'addthis_admin_notices');
|
569 |
|
570 |
function addthis_admin_notices(){
|
571 |
+
if ( !current_user_can('manage_options')
|
572 |
+
|| ( defined('ADDTHIS_NO_NOTICES')
|
573 |
+
&& ADDTHIS_NO_NOTICES)
|
574 |
+
) {
|
575 |
return;
|
576 |
+
}
|
577 |
+
|
578 |
global $cmsConnector;
|
579 |
+
global $current_user;
|
580 |
|
|
|
581 |
$user_id = $current_user->ID;
|
582 |
+
$options = $cmsConnector->getConfigs();
|
583 |
+
$message = '';
|
584 |
+
|
585 |
+
$setupMessage = '
|
586 |
+
<div class="updated addthis_setup_nag">
|
587 |
+
<p>
|
588 |
+
Configure the AddThis Sharing Buttons plugin to enable users to share your content around the web.
|
589 |
+
<br />
|
590 |
+
<a href="' . $cmsConnector->getSettingsPageUrl() . '">Configuration options</a>
|
591 |
+
|
|
592 |
+
<a href="?addthis_nag_ignore=0" id="php_below_min_nag-no">Ignore this notice</a>
|
593 |
+
</p>
|
594 |
+
</div>
|
595 |
+
';
|
596 |
+
|
597 |
+
$updatedMessage = '
|
598 |
+
<div class="updated addthis_setup_nag">
|
599 |
+
<p>
|
600 |
+
We have updated the options for the AddThis Sharing Buttons plugin. Check out the
|
601 |
+
<a href="' . $cmsConnector->getSettingsPageUrl() . '">AddThis settings page</a> to see the new styles and options.
|
602 |
+
<br />
|
603 |
+
<a href="' . $cmsConnector->getSettingsPageUrl() . '">See New Options</a>
|
604 |
+
|
|
605 |
+
<a href="?addthis_nag_updated_ignore=0">Ignore this notice</a>
|
606 |
+
</p>
|
607 |
+
</div>
|
608 |
+
';
|
609 |
+
|
610 |
+
if ( !isset($options['addthis_plugin_controls'])
|
611 |
+
&& !get_user_meta($user_id, 'addthis_ignore_notices')
|
612 |
+
) {
|
613 |
+
// nothing set up
|
614 |
+
$message = $setupMessage;
|
615 |
+
} else if( $options['addthis_plugin_controls'] == "AddThis"
|
616 |
+
&& empty($options['addthis_profile'])
|
617 |
+
&& !get_user_meta($user_id, 'addthis_ignore_notices')
|
618 |
+
) {
|
619 |
+
// AddThis mode but no pubid
|
620 |
+
$message = $setupMessage;
|
621 |
+
} else if( $options['addthis_plugin_controls'] != "AddThis"
|
622 |
+
&& empty($options['addthis_above_enabled'])
|
623 |
+
&& empty($options['addthis_below_enabled'])
|
624 |
+
&& empty($options['addthis_sidebar_enabled'])
|
625 |
+
&& !get_user_meta($user_id, 'addthis_ignore_notices')
|
626 |
+
) {
|
627 |
+
// WordPress mode but no tools enabled
|
628 |
+
$message = $setupMessage;
|
629 |
+
} elseif (get_user_meta($user_id, 'addthis_nag_updated_options')) {
|
630 |
+
// upgrade
|
631 |
+
$message = $updatedMessage;
|
632 |
}
|
633 |
+
|
634 |
+
echo $message;
|
635 |
}
|
636 |
add_action('admin_init', 'addthis_nag_ignore');
|
637 |
|
689 |
function addthis_save_settings($input)
|
690 |
{
|
691 |
global $addThisConfigs;
|
|
|
692 |
|
693 |
// if special, do special, else
|
694 |
if ( isset($input['addthis_csr_confirmation'])
|
697 |
if ( isset($input['addthis_profile'])
|
698 |
&& wp_verify_nonce($_POST['pubid_nonce'], 'update_pubid')
|
699 |
) {
|
700 |
+
$configs['addthis_profile'] = $input['addthis_profile'];
|
701 |
}
|
702 |
} else {
|
703 |
+
$configs = addthis_parse_options($input);
|
704 |
}
|
705 |
|
706 |
+
if (isset($configs)) {
|
707 |
+
$addThisConfigs->saveConfigs($configs);
|
708 |
+
}
|
709 |
}
|
710 |
|
711 |
|
721 |
$below_custom_styles = $above_custom_styles = '';
|
722 |
$options = $addThisConfigs->getConfigs();
|
723 |
|
724 |
+
if (isset($data['show_below'])) {
|
|
|
|
|
|
|
|
|
|
|
725 |
$options['below'] = 'none';
|
726 |
+
} elseif (isset($data['below'], $styles[$data['below']])) {
|
727 |
$options['below'] = $data['below'];
|
728 |
+
} elseif ($data['below'] == 'disable') {
|
729 |
$options['below'] = $data['below'];
|
730 |
+
} elseif ($data['below'] == 'none') {
|
|
|
731 |
$options['below'] = 'none';
|
732 |
+
} elseif ($data['below'] == 'custom') {
|
733 |
+
$options['below_do_custom_services'] = isset($data['below_do_custom_services']);
|
734 |
+
$options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']);
|
|
|
|
|
735 |
|
736 |
$options['below'] = 'custom';
|
737 |
+
|
738 |
+
if ( $data['below_custom_size'] == 16
|
739 |
+
|| $data['below_custom_size'] == 32
|
740 |
+
) {
|
741 |
+
$options['below_custom_size'] = $data['below_custom_size'];
|
742 |
+
} else {
|
743 |
+
$options['below_custom_size'] = '';
|
744 |
+
}
|
745 |
+
$options['below_custom_services'] = sanitize_text_field($data['below_custom_services']);
|
746 |
+
$options['below_custom_preferred'] = sanitize_text_field($data['below_custom_preferred']);
|
747 |
$options['below_custom_more'] = isset($data['below_custom_more']);
|
748 |
+
} elseif ($data['below'] == 'custom_string') {
|
|
|
|
|
749 |
$options['below'] = 'custom_string';
|
750 |
if (strpos($data['below_custom_string'], "style=") != false) {
|
751 |
$custom_style = explode('style=', $data['below_custom_string']);
|
753 |
$custom_style = explode(' ', $custom_style[0]);
|
754 |
$below_custom_styles = " style=$custom_style[0]";
|
755 |
}
|
756 |
+
$options['below_custom_string'] = addthis_kses(
|
757 |
+
$data['below_custom_string'],
|
758 |
+
$below_custom_styles
|
759 |
+
);
|
760 |
}
|
761 |
|
762 |
+
if (isset($data['wpfooter'])) {
|
763 |
$options['wpfooter'] = (bool) $data['wpfooter'];
|
764 |
+
}
|
765 |
|
766 |
+
if (isset($styles[$data['above']])) {
|
|
|
|
|
767 |
$options['above'] = $data['above'];
|
768 |
+
} elseif ($data['above'] == 'disable') {
|
769 |
$options['above'] = $data['above'];
|
770 |
+
} elseif ($data['above'] == 'none') {
|
|
|
771 |
$options['above'] = 'none';
|
772 |
+
} elseif ($data['above'] == 'custom') {
|
|
|
|
|
|
|
773 |
$options['above_do_custom_services'] = isset($data['above_do_custom_services']) ;
|
774 |
$options['above_do_custom_preferred'] = isset($data['above_do_custom_preferred']) ;
|
775 |
$options['above'] = 'custom';
|
776 |
+
|
777 |
+
if ( $data['above_custom_size'] == 16
|
778 |
+
|| $data['above_custom_size'] == 32
|
779 |
+
) {
|
780 |
+
$options['above_custom_size'] = $data['above_custom_size'];
|
781 |
+
} else {
|
782 |
+
$options['above_custom_size'] = '';
|
783 |
+
}
|
784 |
+
$options['above_custom_services'] = sanitize_text_field($data['above_custom_services']);
|
785 |
$options['above_custom_preferred'] = (int) $data['above_custom_preferred'] ;
|
786 |
$options['above_custom_more'] = isset($data['above_custom_more']);
|
787 |
+
} elseif ($data['above'] == 'custom_string') {
|
|
|
|
|
788 |
//[addthis_twitter_template]
|
789 |
+
if ( isset($data['addthis_twitter_template'])
|
790 |
+
&& strlen($data['addthis_twitter_template']) != 0
|
791 |
+
) {
|
792 |
//Parse the first twitter username to be used with via
|
793 |
$options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
|
794 |
}
|
795 |
|
796 |
$options['above'] = 'custom_string';
|
797 |
+
if (strpos($data['above_custom_string'], "style=")) {
|
798 |
$custom_style = explode('style=', $data['above_custom_string']);
|
799 |
$custom_style = explode('>', $custom_style[1]);
|
800 |
$custom_style = explode(' ', $custom_style[0]);
|
801 |
$above_custom_styles = " style=$custom_style[0]";
|
802 |
}
|
803 |
+
$options['above_custom_string'] = addthis_kses(
|
804 |
+
$data['above_custom_string'],
|
805 |
+
$above_custom_styles
|
806 |
+
);
|
807 |
}
|
808 |
|
809 |
if (isset($data['addthis_profile'])) {
|
810 |
$options['addthis_profile'] = sanitize_text_field($data['addthis_profile']);
|
811 |
}
|
812 |
|
813 |
+
if (isset($styles[$data['below']])) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
814 |
$options['below'] = $data['below'];
|
815 |
+
} elseif ($data['below'] == 'disable') {
|
816 |
$options['below'] = $data['below'];
|
817 |
+
} elseif ($data['below'] == 'none') {
|
|
|
818 |
$options['below'] = 'none';
|
819 |
+
} elseif ($data['below'] == 'custom') {
|
|
|
|
|
820 |
$options['below_do_custom_services'] = isset($data['below_do_custom_services']) ;
|
821 |
$options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']) ;
|
822 |
|
823 |
$options['below'] = 'custom';
|
824 |
+
if ( $data['below_custom_size'] == 16
|
825 |
+
|| $data['below_custom_size'] == 32
|
826 |
+
) {
|
827 |
+
$options['below_custom_size'] = $data['below_custom_size'];
|
828 |
+
} else {
|
829 |
+
$options['below_custom_size'] = '';
|
830 |
+
}
|
831 |
+
$options['below_custom_services'] = sanitize_text_field($data['below_custom_services']);
|
832 |
+
$options['below_custom_preferred'] = sanitize_text_field($data['below_custom_preferred']);
|
833 |
$options['below_custom_more'] = isset($data['below_custom_more']);
|
834 |
+
} elseif ($data['below'] == 'custom_string') {
|
|
|
|
|
835 |
$options['below'] = 'custom_string';
|
836 |
+
if (strpos($data['below_custom_string'], "style=")) {
|
837 |
$custom_style = explode('style=', $data['below_custom_string']);
|
838 |
$custom_style = explode('>', $custom_style[1]);
|
839 |
$custom_style = explode(' ', $custom_style[0]);
|
840 |
$below_custom_styles = " style=$custom_style[0]";
|
841 |
}
|
842 |
+
$options['below_custom_string'] = addthis_kses(
|
843 |
+
$data['below_custom_string'],
|
844 |
+
$below_custom_styles
|
845 |
+
);
|
846 |
}
|
847 |
|
848 |
// All the checkbox fields
|
849 |
$checkboxFields = array(
|
850 |
+
'above_auto_services',
|
851 |
'addthis_508',
|
852 |
'addthis_above_enabled',
|
853 |
'addthis_addressbar',
|
857 |
'addthis_beforecomments',
|
858 |
'addthis_below_enabled',
|
859 |
'addthis_bitly',
|
|
|
860 |
'addthis_per_post_enabled',
|
861 |
+
'addthis_sidebar_enabled',
|
862 |
+
'below_auto_services',
|
863 |
);
|
864 |
|
865 |
// add all share button location template settings to list of checkbox fields
|
869 |
$checkboxFields[] = $optionName;
|
870 |
}
|
871 |
|
872 |
+
foreach ($checkboxFields as $field) {
|
|
|
873 |
if (isset($data[$field]) && $data[$field]) {
|
874 |
$options[$field] = true;
|
875 |
} else {
|
882 |
}
|
883 |
|
884 |
//[addthis_twitter_template]
|
885 |
+
if (isset($data['addthis_twitter_template'])) {
|
886 |
//Parse the first twitter username to be used with via
|
887 |
$options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
|
888 |
}
|
889 |
|
890 |
//[addthis_language] =>
|
891 |
+
if (isset($data['addthis_language'])) {
|
892 |
$options['addthis_language'] = sanitize_text_field($data['addthis_language']);
|
893 |
+
}
|
894 |
|
895 |
//[atversion]=>
|
896 |
+
if (isset($data['atversion'])) {
|
897 |
$options['atversion'] = sanitize_text_field($data['atversion']);
|
898 |
+
}
|
899 |
|
900 |
//[atversion_update_status]=>
|
901 |
+
if (isset($data['atversion_update_status'])) {
|
902 |
$options['atversion_update_status'] = sanitize_text_field($data['atversion_update_status']);
|
903 |
+
}
|
904 |
|
905 |
+
if (isset($data['credential_validation_status'])) {
|
906 |
$options['credential_validation_status'] = sanitize_text_field($data['credential_validation_status']);
|
907 |
+
}
|
908 |
|
909 |
if (isset($data['addthis_config_json'])) {
|
910 |
$options['addthis_config_json'] = sanitize_text_field($data['addthis_config_json']);
|
914 |
$options['addthis_share_json'] = sanitize_text_field($data['addthis_share_json']);
|
915 |
}
|
916 |
|
917 |
+
if (!empty($data['above_chosen_list'])) {
|
|
|
918 |
$options['above_chosen_list'] = sanitize_text_field($data['above_chosen_list']);
|
919 |
+
} else {
|
|
|
920 |
$options['above_chosen_list'] = "";
|
921 |
}
|
922 |
|
923 |
+
if (!empty($data['below_chosen_list'])) {
|
|
|
924 |
$options['below_chosen_list'] = sanitize_text_field($data['below_chosen_list']);
|
925 |
+
} else {
|
|
|
926 |
$options['below_chosen_list'] = "";
|
927 |
}
|
928 |
|
929 |
+
if (isset($data['addthis_sidebar_position'])) {
|
930 |
$options['addthis_sidebar_position'] = $data['addthis_sidebar_position'];
|
931 |
}
|
932 |
|
933 |
+
if (isset($data['addthis_sidebar_count'])) {
|
934 |
$options['addthis_sidebar_count'] = $data['addthis_sidebar_count'];
|
935 |
}
|
936 |
|
937 |
+
if (isset($data['addthis_sidebar_theme'])) {
|
938 |
$options['addthis_sidebar_theme'] = $data['addthis_sidebar_theme'];
|
939 |
}
|
940 |
|
941 |
+
if (isset($data['addthis_environment'])) {
|
942 |
$options['addthis_environment'] = $data['addthis_environment'];
|
943 |
}
|
944 |
|
945 |
+
if (isset($data['addthis_plugin_controls'])) {
|
946 |
$options['addthis_plugin_controls'] = $data['addthis_plugin_controls'];
|
947 |
}
|
948 |
|
949 |
if (isset($data['addthis_rate_us'])) {
|
950 |
+
if($options['addthis_rate_us'] != $data['addthis_rate_us']) {
|
951 |
+
$options['addthis_rate_us_timestamp'] = time();
|
952 |
+
}
|
953 |
$options['addthis_rate_us'] = $data['addthis_rate_us'];
|
|
|
954 |
}
|
955 |
|
956 |
return $options;
|
980 |
add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt', 11);
|
981 |
}
|
982 |
|
983 |
+
if (!empty($options['addthis_aftertitle'])) {
|
984 |
add_filter('the_title', 'addthis_display_after_title', 11);
|
985 |
+
}
|
986 |
|
987 |
add_filter('the_content', 'addthis_display_social_widget', 15);
|
988 |
|
1079 |
echo $after_widget;
|
1080 |
}
|
1081 |
|
1082 |
+
// if there are suppose to be sharing buttons and they're not there, add them.
|
1083 |
+
function addthis_remove_tag($content)
|
1084 |
{
|
1085 |
global $addThisConfigs;
|
1086 |
$options = $addThisConfigs->getConfigs();
|
1087 |
|
1088 |
+
$checkForToolbox = "addthis_toolbox";
|
1089 |
+
$checkForButton = "addthis_button";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1090 |
|
1091 |
+
if ( _addthis_excerpt_buttons_enabled()
|
1092 |
+
&& strpos($content, $checkForToolbox) === false
|
1093 |
+
&& strpos($content, $checkForButton) === false
|
1094 |
+
) {
|
1095 |
+
$content = addthis_display_social_widget($content, false, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1096 |
}
|
1097 |
+
|
1098 |
+
return $content;
|
1099 |
}
|
1100 |
|
1101 |
/**
|
1104 |
function addthis_late_widget($link_text)
|
1105 |
{
|
1106 |
global $addThisConfigs;
|
1107 |
+
global $addthis_styles;
|
1108 |
+
global $addthis_new_styles;
|
1109 |
|
1110 |
+
remove_filter('get_the_excerpt', 'addthis_late_widget');
|
1111 |
if (!_addthis_excerpt_buttons_enabled()) {
|
1112 |
return $link_text;
|
1113 |
}
|
1114 |
|
1115 |
+
$addThisConfigs = $addThisConfigs->getConfigs();
|
1116 |
$styles = array_merge($addthis_styles, $addthis_new_styles);
|
1117 |
|
1118 |
+
if ( has_excerpt()
|
1119 |
+
&& !is_attachment()
|
1120 |
+
&& isset($addThisConfigs['below'])
|
1121 |
+
&& $addThisConfigs['below'] == 'custom'
|
1122 |
+
) {
|
1123 |
+
$options['size'] = $addThisConfigs['below_custom_size'];
|
1124 |
+
$options['more'] = $addThisConfigs['below_custom_more'];
|
1125 |
|
1126 |
+
if ($addThisConfigs['below_do_custom_services']) {
|
1127 |
+
$options['services'] = $addThisConfigs['below_custom_services'];
|
1128 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1129 |
|
1130 |
+
if ($addThisConfigs['below_do_custom_preferred']) {
|
1131 |
+
$options['preferred'] = $addThisConfigs['below_custom_preferred'];
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
$template = addthis_custom_toolbox($options);
|
1135 |
+
} elseif ( isset($styles[$addThisConfigs['below']])
|
1136 |
+
&& has_excerpt()
|
1137 |
+
&& !is_attachment()
|
1138 |
+
) {
|
1139 |
+
$template = $styles[$addThisConfigs['below']]['src'];
|
1140 |
+
} else {
|
1141 |
+
$template = '';
|
1142 |
}
|
1143 |
+
|
1144 |
+
$buttons = sprintf($template, addthis_get_identifier());
|
1145 |
+
|
1146 |
+
return $link_text . $buttons;
|
1147 |
}
|
1148 |
|
1149 |
|
1161 |
}
|
1162 |
}
|
1163 |
|
1164 |
+
function addthis_display_widget_above($styles, $options) {
|
1165 |
$above = '';
|
1166 |
if ($options['addthis_above_enabled'] == true){
|
1167 |
if (isset($styles[$options['above']])) {
|
1168 |
+
if ( isset($options['above_chosen_list'], $options['above_auto_services'])
|
1169 |
+
&& !$options['above_auto_services']
|
1170 |
+
&& strlen($options['above_chosen_list']) != 0
|
1171 |
+
) {
|
1172 |
if (isset($options['above']) && $options['above'] == 'large_toolbox') {
|
1173 |
$aboveOptions['size'] = '32';
|
1174 |
} elseif (isset($options['above']) && $options['above'] == 'small_toolbox') {
|
1176 |
}
|
1177 |
$aboveOptions['type'] = $options['above'];
|
1178 |
$aboveOptions['services'] = $options['above_chosen_list'];
|
1179 |
+
$above = addthis_custom_toolbox($aboveOptions);
|
1180 |
} else {
|
1181 |
+
$above = $styles[$options['above']]['src'];
|
1182 |
}
|
1183 |
} elseif ($options['above'] == 'custom') {
|
1184 |
$aboveOptions['size'] = $options['above_custom_size'];
|
1187 |
if ($options['above_do_custom_preferred'])
|
1188 |
$aboveOptions['preferred'] = $options['above_custom_preferred'];
|
1189 |
$aboveOptions['more'] = $options['above_custom_more'];
|
1190 |
+
$above = addthis_custom_toolbox($aboveOptions);
|
1191 |
} elseif ($options['above'] == 'custom_string') {
|
1192 |
$custom = preg_replace('/<\s*div\s*/', '<div %1$s ', $options['above_custom_string']);
|
1193 |
+
$above = $custom;
|
1194 |
}
|
1195 |
}
|
1196 |
return $above;
|
1197 |
}
|
1198 |
|
1199 |
+
function addthis_display_widget_below($styles, $options) {
|
1200 |
$below = '';
|
1201 |
if ($options['addthis_below_enabled'] == true){
|
1202 |
if (isset($styles[$options['below']])) {
|
1203 |
+
if ( isset($options['below_chosen_list'], $options['below_auto_services'])
|
1204 |
+
&& !$options['below_auto_services']
|
1205 |
+
&& strlen($options['below_chosen_list']) != 0
|
1206 |
+
) {
|
1207 |
if (isset($options['below']) && $options['below'] == 'large_toolbox') {
|
1208 |
$belowOptions['size'] = '32';
|
1209 |
} elseif (isset($options['below']) && $options['below'] == 'small_toolbox') {
|
1211 |
}
|
1212 |
$belowOptions['type'] = $options['below'];
|
1213 |
$belowOptions['services'] = $options['below_chosen_list'];
|
1214 |
+
$below = addthis_custom_toolbox($belowOptions);
|
1215 |
} else {
|
1216 |
+
$below = $styles[$options['below']]['src'];
|
1217 |
}
|
1218 |
} elseif ($options['below'] == 'custom') {
|
1219 |
$belowOptions['size'] = $options['below_custom_size'];
|
1220 |
$belowOptions['services'] = $options['below_custom_services'];
|
1221 |
$belowOptions['preferred'] = $options['below_custom_preferred'];
|
1222 |
$belowOptions['more'] = $options['below_custom_more'];
|
1223 |
+
$below = addthis_custom_toolbox($belowOptions);
|
1224 |
} elseif ($options['below'] == 'custom_string') {
|
1225 |
$custom = preg_replace('/<\s*div\s*/', '<div %1$s ', $options['below_custom_string']);
|
1226 |
+
$below = $custom;
|
1227 |
}
|
1228 |
}
|
1229 |
return $below;
|
1277 |
$displayBelow = false;
|
1278 |
}
|
1279 |
|
1280 |
+
remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 1);
|
|
|
|
|
|
|
1281 |
remove_filter('get_the_excerpt', 'addthis_late_widget');
|
1282 |
+
$identifier = addthis_get_identifier();
|
|
|
|
|
|
|
|
|
|
|
1283 |
|
1284 |
// Still here? Well let's add some social goodness
|
1285 |
if ( isset($options['above'])
|
1287 |
&& $options['above'] != 'disable'
|
1288 |
&& $displayAbove
|
1289 |
) {
|
1290 |
+
$above = addthis_display_widget_above($styles, $options);
|
1291 |
} elseif ($displayAbove) {
|
1292 |
+
$above = '';
|
1293 |
} else {
|
1294 |
$above = '';
|
1295 |
}
|
1300 |
&& $displayBelow
|
1301 |
&& ! $below_excerpt
|
1302 |
) {
|
1303 |
+
$below = addthis_display_widget_below($styles, $options);
|
1304 |
} elseif ( $below_excerpt
|
1305 |
&& $displayBelow
|
1306 |
&& $options['below'] != 'none'
|
1307 |
) {
|
1308 |
+
$below = '';
|
|
|
1309 |
|
1310 |
if (_addthis_excerpt_buttons_enabled()) {
|
1311 |
add_filter('get_the_excerpt', 'addthis_late_widget', 14);
|
1312 |
}
|
|
|
|
|
1313 |
} else {
|
1314 |
$below = '';
|
1315 |
}
|
1321 |
|
1322 |
if ($at_flag !== '0') {
|
1323 |
if ($displayAbove && isset($above)) {
|
1324 |
+
$content = sprintf($above, $identifier) . $content;
|
1325 |
}
|
1326 |
if ($displayBelow && isset($below)) {
|
1327 |
+
$content = $content . sprintf($below, $identifier);
|
1328 |
}
|
1329 |
}
|
1330 |
|
1331 |
if (($displayAbove || $displayBelow) && $filtered) {
|
1332 |
+
add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11, 1);
|
1333 |
}
|
1334 |
|
1335 |
return $content;
|
1498 |
$link = !is_null($url) ? $url : ($onSidebar ? get_bloginfo('url') : get_permalink());
|
1499 |
$title = !is_null($title) ? $title : ($onSidebar ? get_bloginfo('title') : the_title('', '', false));
|
1500 |
|
1501 |
+
$content .= '
|
1502 |
+
<!-- AddThis Button BEGIN -->
|
1503 |
+
<script data-cfasync="false" type="text/javascript">'
|
1504 |
+
."\n//<!--\n"
|
1505 |
."var addthis_product = '". $cmsConnector->getProductVersion() ."';\n";
|
1506 |
|
1507 |
|
1510 |
$content .= ($addthis_settings['customization']) . "\n";
|
1511 |
}
|
1512 |
|
1513 |
+
if ($addthis_settings['menu_type'] === 'dropdown') {
|
1514 |
+
$content .= '
|
1515 |
+
</script>
|
1516 |
+
<div class="addthis_container">
|
1517 |
+
<a
|
1518 |
+
href="//www.addthis.com/bookmark.php?v='.$atversion.'&username='.$pub.'"
|
1519 |
+
class="addthis_button"
|
1520 |
+
' . addthis_get_identifier($link, $title) . '
|
1521 |
+
>
|
1522 |
+
';
|
1523 |
+
|
1524 |
$content .= ($addthis_settings['language'] == '' ? '' /* no hardcoded image -- we'll choose the language automatically */ : addthis_get_button_img()) . '</a><script data-cfasync="false" type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'"></script></div>';
|
1525 |
+
} else if ($addthis_settings['menu_type'] === 'toolbox') {
|
|
|
|
|
1526 |
$content .= "\n//-->\n</script>\n";
|
1527 |
+
$content .= '
|
1528 |
+
<div
|
1529 |
+
class="addthis_container addthis_toolbox addthis_default_style"
|
1530 |
+
' . addthis_get_identifier($link, $title) . '
|
1531 |
+
>
|
1532 |
+
<a
|
1533 |
+
href="//www.addthis.com/bookmark.php?v='.$atversion.'&username=$pub"
|
1534 |
+
class="addthis_button_compact">
|
1535 |
+
Share
|
1536 |
+
</a>
|
1537 |
+
<span class="addthis_separator">|</span>
|
1538 |
+
<script data-cfasync="false" type="text/javascript" src="//s7.addthis.com/js/'.$atversion.'/addthis_widget.js#username='.$pub.'">
|
1539 |
+
</script>
|
1540 |
+
</div>';
|
1541 |
+
} else {
|
1542 |
$link = urlencode($link);
|
1543 |
$title = urlencode($title);
|
1544 |
+
$content .= '//-->
|
1545 |
+
</script>
|
1546 |
+
<div class="addthis_container">
|
1547 |
+
<a
|
1548 |
+
href="//www.addthis.com/bookmark.php?v='.$atversion.'&username=$pub"
|
1549 |
+
onclick="window.open(\'//www.addthis.com/bookmark.php?v='.$atversion.'&username='.$pub.'&url='.$link.'&title='.$title.'\', \'ext_addthis\', \'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no\'); return false;"
|
1550 |
+
title="Bookmark using any bookmark manager!"
|
1551 |
+
target="_blank"
|
1552 |
+
>
|
1553 |
+
';
|
1554 |
$content .= addthis_get_button_img() . '</a></div>';
|
1555 |
}
|
1556 |
$content .= "\n<!-- AddThis Button END -->";
|
js/options-page.32.js
CHANGED
@@ -162,26 +162,6 @@ jQuery(document).ready(function($) {
|
|
162 |
}
|
163 |
};
|
164 |
|
165 |
-
var show_above = $('input[name="addthis_settings[show_above]"]');
|
166 |
-
var show_below = $('input[name="addthis_settings[show_below]"]');
|
167 |
-
if ( $('#input[name="addthis_settings[show_above]"]').is(':checked'))
|
168 |
-
{
|
169 |
-
$('.above_option').toggleClass('hide');
|
170 |
-
}
|
171 |
-
|
172 |
-
if ( $('#input[name="addthis_settings[show_below]"]').is(':checked'))
|
173 |
-
{
|
174 |
-
$('.below_option').toggleClass('hide');
|
175 |
-
}
|
176 |
-
|
177 |
-
$('input[name="addthis_settings[show_above]"]').change( function() {
|
178 |
-
$('.above_option').toggleClass('hide');
|
179 |
-
});
|
180 |
-
|
181 |
-
$('input[name="addthis_settings[show_below]"]').change( function() {
|
182 |
-
$('.below_option').toggleClass('hide');
|
183 |
-
});
|
184 |
-
|
185 |
var aboveCustomString = $('#above_custom_string');
|
186 |
var aboveCustomStringShow = function(){
|
187 |
if ( aboveCustomString.is(':checked'))
|
162 |
}
|
163 |
};
|
164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
var aboveCustomString = $('#above_custom_string');
|
166 |
var aboveCustomStringShow = function(){
|
167 |
if ( aboveCustomString.is(':checked'))
|
js/options-page.js
CHANGED
@@ -160,26 +160,6 @@ jQuery(document).ready(function($) {
|
|
160 |
}
|
161 |
};
|
162 |
|
163 |
-
var show_above = $('input[name="addthis_settings[show_above]"]');
|
164 |
-
var show_below = $('input[name="addthis_settings[show_below]"]');
|
165 |
-
if ( $('#input[name="addthis_settings[show_above]"]').is(':checked'))
|
166 |
-
{
|
167 |
-
$('.above_option').toggleClass('hide');
|
168 |
-
}
|
169 |
-
|
170 |
-
if ( $('#input[name="addthis_settings[show_below]"]').is(':checked'))
|
171 |
-
{
|
172 |
-
$('.below_option').toggleClass('hide');
|
173 |
-
}
|
174 |
-
|
175 |
-
$('input[name="addthis_settings[show_above]"]').change( function() {
|
176 |
-
$('.above_option').toggleClass('hide');
|
177 |
-
});
|
178 |
-
|
179 |
-
$('input[name="addthis_settings[show_below]"]').change( function() {
|
180 |
-
$('.below_option').toggleClass('hide');
|
181 |
-
});
|
182 |
-
|
183 |
var aboveCustomString = $('#above_custom_string');
|
184 |
var aboveCustomStringShow = function(){
|
185 |
if ( aboveCustomString.is(':checked'))
|
160 |
}
|
161 |
};
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
var aboveCustomString = $('#above_custom_string');
|
164 |
var aboveCustomStringShow = function(){
|
165 |
if ( aboveCustomString.is(':checked'))
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== AddThis Sharing Buttons ===
|
2 |
-
Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, mkitzman,
|
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 tools to help you make your website smarter.
|
9 |
|
@@ -76,6 +76,14 @@ PHP 5+ is preferred; PHP 4 is supported.
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
= 5.0.8 =
|
80 |
* PHP notice fix for AddThisConfigs.php on line 204
|
81 |
|
@@ -346,7 +354,15 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
|
|
346 |
|
347 |
== Upgrade Notice ==
|
348 |
|
349 |
-
= 5.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
* PHP notice fix for AddThisConfigs.php on line 204
|
351 |
|
352 |
= 5.0.7 =
|
1 |
=== AddThis Sharing Buttons ===
|
2 |
+
Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, mkitzman, addthis_paul, addthis_matt, addthis_elsa, ribin_addthis, AddThis_Mike
|
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.9
|
7 |
|
8 |
AddThis provides the best sharing tools to help you make your website smarter.
|
9 |
|
76 |
|
77 |
== Changelog ==
|
78 |
|
79 |
+
= 5.0.9 =
|
80 |
+
* Updated troubleshooting information available to AddThis support to be more in line with other plugins, including providing the anonymous profile IDs to help in moving over statistics to registered profile IDs upon request.
|
81 |
+
* Improving the way variables are being shared to support global AddThis variables between AddThis plugins (not supported yet by any other plugin) and plugin specific settings. Specifically, this is to make sure things such as the profile ID or addthis_config settings are the same across all AddThis plugins.
|
82 |
+
* Refactored the filter used on wp_trim_excerpt in WordPress mode to better interact with other modules' and themes' filters on wp_trim_excerpt, excerpt_length and excerpt_more (such as mh-magazine-lite)
|
83 |
+
* Resolving issues with PHP errors for URLs with %s in them when using "Select Your Own" services
|
84 |
+
* Resolving services bug, where once a user selected their own for above or below content, the custom services where always used, even if the user went back to Auto Personalization
|
85 |
+
* Fixing bug with a PHP warning for undefined index below_chosen_list
|
86 |
+
|
87 |
= 5.0.8 =
|
88 |
* PHP notice fix for AddThisConfigs.php on line 204
|
89 |
|
354 |
|
355 |
== Upgrade Notice ==
|
356 |
|
357 |
+
= 5.0.9 =
|
358 |
+
* Updated troubleshooting information available to AddThis support to be more in line with other plugins, including providing the anonymous profile IDs to help in moving over statistics to registered profile IDs upon request.
|
359 |
+
* Improving the way variables are being shared to support global AddThis variables between AddThis plugins (not supported yet by any other plugin) and plugin specific settings. Specifically, this is to make sure things such as the profile ID or addthis_config settings are the same across all AddThis plugins.
|
360 |
+
* Refactored the filter used on wp_trim_excerpt in WordPress mode to better interact with other modules' and themes' filters on wp_trim_excerpt, excerpt_length and excerpt_more (such as mh-magazine-lite)
|
361 |
+
* Resolving issues with PHP errors for URLs with %s in them when using "Select Your Own" services
|
362 |
+
* Resolving services bug, where once a user selected their own for above or below content, the custom services where always used, even if the user went back to Auto Personalization
|
363 |
+
* Fixing bug with a PHP warning for undefined index below_chosen_list
|
364 |
+
|
365 |
+
= 5.0.8 =
|
366 |
* PHP notice fix for AddThisConfigs.php on line 204
|
367 |
|
368 |
= 5.0.7 =
|