WordPress Share Buttons Plugin – AddThis - Version 4.0.7

Version Description

  • Added node marker and loop cap to getFirstElderWithCondition to solve infinite loop
  • Fixed the issue where characters *,+,- were printed in feeds
Download this release

Release Info

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

Code changes from version 4.0.6 to 4.0.7

addthis-toolbox.php CHANGED
@@ -95,29 +95,31 @@ class Addthis_ToolBox
95
  */
96
  public function addExcerptCode($content)
97
  {
98
- self::$postTitlesAndUrlsById[] = array(
99
- 'id' => get_the_ID(),
100
- 'title' => get_the_title(),
101
- 'url' => get_permalink(),
102
- 'content' => $content
103
- );
104
-
105
- if(preg_match('/[\+\-\*]{3}/', $content) == false) {
106
- //Homepage = 567
107
- if (is_home() || is_front_page()) {
108
- return '+' . '-' . '*' . $content;
109
- //Page = 576
110
- } else if (is_page()) {
111
- return '+' . '*' . '-' . $content;
112
- //Single Post = 675
113
- } else if (is_single()) {
114
- return '-' . '*' . '+' . $content;
115
- //Category = 657
116
- } else if (is_category()) {
117
- return '-' . '+' . '*' . $content;
118
- //Archive = 756
119
- } else if (is_archive()) {
120
- return '*' . '+' . '-' . $content;
 
 
121
  }
122
  }
123
  return $content;
@@ -137,7 +139,7 @@ class Addthis_ToolBox
137
  */
138
  public function addWidget($content)
139
  {
140
- if (Addthis_Wordpress::getPubid() && !is_404()) {
141
  global $post;
142
  $postid = $post->ID;
143
  $at_flag = get_post_meta( $postid, '_at_widget', TRUE );
95
  */
96
  public function addExcerptCode($content)
97
  {
98
+ if(!is_feed()) {
99
+ self::$postTitlesAndUrlsById[] = array(
100
+ 'id' => get_the_ID(),
101
+ 'title' => get_the_title(),
102
+ 'url' => get_permalink(),
103
+ 'content' => $content
104
+ );
105
+
106
+ if(preg_match('/[\+\-\*]{3}/', $content) == false) {
107
+ //Homepage = + - *
108
+ if (is_home() || is_front_page()) {
109
+ return '+' . '-' . '*' . $content;
110
+ //Page = + * -
111
+ } else if (is_page()) {
112
+ return '+' . '*' . '-' . $content;
113
+ //Single Post = - * +
114
+ } else if (is_single()) {
115
+ return '-' . '*' . '+' . $content;
116
+ //Category = - + *
117
+ } else if (is_category()) {
118
+ return '-' . '+' . '*' . $content;
119
+ //Archive = * + -
120
+ } else if (is_archive()) {
121
+ return '*' . '+' . '-' . $content;
122
+ }
123
  }
124
  }
125
  return $content;
139
  */
140
  public function addWidget($content)
141
  {
142
+ if (Addthis_Wordpress::getPubid() && !is_404() && !is_feed()) {
143
  global $post;
144
  $postid = $post->ID;
145
  $at_flag = get_post_meta( $postid, '_at_widget', TRUE );
addthis_social_widget.php CHANGED
@@ -23,7 +23,7 @@
23
  * Plugin Name: AddThis for WordPress
24
  * Plugin URI: http://www.addthis.com
25
  * Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
26
- * Version: 4.0.6
27
  *
28
  * Author: The AddThis Team
29
  * Author URI: http://www.addthis.com/blog
@@ -32,8 +32,8 @@ if (!defined('ADDTHIS_INIT')) define('ADDTHIS_INIT', 1);
32
  else return;
33
 
34
  define( 'addthis_style_default' , 'fb_tw_p1_sc');
35
- define( 'ADDTHIS_PLUGIN_VERSION' , '4.0.6');
36
- define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-4.0.6');
37
  define( 'ADDTHIS_ATVERSION', '300');
38
  define( 'ADDTHIS_ATVERSION_MANUAL_UPDATE', -1);
39
  define( 'ADDTHIS_ATVERSION_AUTO_UPDATE', 0);
23
  * Plugin Name: AddThis for WordPress
24
  * Plugin URI: http://www.addthis.com
25
  * Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
26
+ * Version: 4.0.7
27
  *
28
  * Author: The AddThis Team
29
  * Author URI: http://www.addthis.com/blog
32
  else return;
33
 
34
  define( 'addthis_style_default' , 'fb_tw_p1_sc');
35
+ define( 'ADDTHIS_PLUGIN_VERSION' , '4.0.7');
36
+ define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-4.0.7');
37
  define( 'ADDTHIS_ATVERSION', '300');
38
  define( 'ADDTHIS_ATVERSION_MANUAL_UPDATE', -1);
39
  define( 'ADDTHIS_ATVERSION_AUTO_UPDATE', 0);
includes/js/add-divs-to-coded-excerpts.js CHANGED
@@ -98,13 +98,15 @@ function findCorrespondingPostObjById(excerptNode, postList) {
98
  /**
99
  * Halts on first success
100
  */
 
101
  function getFirstElderWithCondition(node, conditionFunc) {
 
102
  //breadth first search
103
  var queue = [];
104
  queue.push(node);
105
  //while Q is not empty
106
  var pos = 0;
107
- while(queue.length > 0) {
108
  var node = queue.shift();
109
 
110
  //check the condition (which is the point of the search)
@@ -116,7 +118,14 @@ function getFirstElderWithCondition(node, conditionFunc) {
116
  var parentNode = node.parentNode;
117
  if(parentNode) {
118
  adjacentNodes.push(parentNode);
119
- adjacentNodes = adjacentNodes.concat(getSiblings(parentNode));
 
 
 
 
 
 
 
120
  }
121
  //for all edges from v to w in G.adjacentEdges(v) do
122
  for(var i=0; i<adjacentNodes.length; i++) {
@@ -231,6 +240,9 @@ function getSiblings(n) {
231
  return siblings;
232
  }
233
 
 
 
 
234
  function longestCommonSubstring(string1, string2){
235
  // init max value
236
  var longestCommonSubstring = 0;
98
  /**
99
  * Halts on first success
100
  */
101
+ var nodeMarker = 0;
102
  function getFirstElderWithCondition(node, conditionFunc) {
103
+ nodeMarker++;
104
  //breadth first search
105
  var queue = [];
106
  queue.push(node);
107
  //while Q is not empty
108
  var pos = 0;
109
+ while(queue.length > 0 && pos < 500) {
110
  var node = queue.shift();
111
 
112
  //check the condition (which is the point of the search)
118
  var parentNode = node.parentNode;
119
  if(parentNode) {
120
  adjacentNodes.push(parentNode);
121
+ var siblings = getSiblings(parentNode);
122
+ for(var k=0; k<siblings.length; k++) {
123
+ var sib = siblings[k];
124
+ if(!sib['visited' + nodeMarker]) {
125
+ sib['visited' + nodeMarker] = true;
126
+ adjacentNodes.push(sib);
127
+ }
128
+ }
129
  }
130
  //for all edges from v to w in G.adjacentEdges(v) do
131
  for(var i=0; i<adjacentNodes.length; i++) {
240
  return siblings;
241
  }
242
 
243
+ /**
244
+ * Returns the longest common substring
245
+ */
246
  function longestCommonSubstring(string1, string2){
247
  // init max value
248
  var longestCommonSubstring = 0;
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: srijith.v, solchea, _mjk_, addthis_paul, abramsm
3
  Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools
4
  Requires at least: 3.0
5
  Tested up to: 4.1
6
- Stable tag: 4.0.6
7
 
8
  AddThis provides the best sharing, social, recommended content, and conversion tools to help you make
9
  your website smarter.
@@ -82,6 +82,10 @@ PHP 5+ is preferred; PHP 4 is supported.
82
 
83
  == Changelog ==
84
 
 
 
 
 
85
  = 4.0.6 =
86
  * Adds data-url and data-title attributes to get_the_excerpt toolbox divs
87
 
@@ -305,6 +309,10 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
305
 
306
  == Upgrade Notice ==
307
 
 
 
 
 
308
  = 4.0.6 =
309
  * Adds data-url and data-title attributes to get_the_excerpt toolbox divs
310
 
3
  Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools
4
  Requires at least: 3.0
5
  Tested up to: 4.1
6
+ Stable tag: 4.0.7
7
 
8
  AddThis provides the best sharing, social, recommended content, and conversion tools to help you make
9
  your website smarter.
82
 
83
  == Changelog ==
84
 
85
+ = 4.0.7 =
86
+ * Added node marker and loop cap to getFirstElderWithCondition to solve infinite loop
87
+ * Fixed the issue where characters *,+,- were printed in feeds
88
+
89
  = 4.0.6 =
90
  * Adds data-url and data-title attributes to get_the_excerpt toolbox divs
91
 
309
 
310
  == Upgrade Notice ==
311
 
312
+ = 4.0.7 =
313
+ * Added node marker and loop cap to getFirstElderWithCondition to solve infinite loop
314
+ * Fixed the issue where characters *,+,- were printed in feeds
315
+
316
  = 4.0.6 =
317
  * Adds data-url and data-title attributes to get_the_excerpt toolbox divs
318