Closed andrebu closed 8 years ago
It's in this file: sftp://earmilk//home/www-data/earmilk/public/wp-content/plugins/addthis-all/backend/AddThisSharingButtonsFeature.php
Line 188 needs to be commented out. It's like this: $title = htmlspecialchars($title); but needs to be changed to this: // $title = htmlspecialchars($title)
Until they come up with a solution, you'll prolly have to keep fixing this once the plugin updates.
This file here:
This line at 188 needs to be commented out (line 189 was added by me):
Result (don't know why ' instead of "):
Not knowing the exact problem (ie, where the encoding/decoding goes wrong) I provide some alternate solutions to try in case simply commenting out the plugin's line ends up unsatisfactory in some case.
Using one of these, either before or after $title = htmlspecialchars($title);
(depending on the situation/bug) should resolve any new bugs with $title htmlencoding:
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
OR
$title = htmlspecialchars_decode($title);
IE:
...
$title = $this->applyFilter($this->filterNamePrefix . 'title', $title, $track);
$title = htmlspecialchars($title);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
return $title;
...
OR
...
$title = $this->applyFilter($this->filterNamePrefix . 'title', $title, $track);
$title = htmlspecialchars($title);
$title = htmlspecialchars_decode($title);
return $title;
...
...
$title = $this->applyFilter($this->filterNamePrefix . 'title', $title, $track);
//$title = htmlspecialchars($title);
//$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
//$title = htmlspecialchars_decode($title);
//$title = 'Hi Montrey, this plugin sucks :/';
return $title;
...
Wrote a filter to "permanently" solve this (by permanently, I mean that if the issue remains the same, you won't have to do any editing or fixing when the AddThis-All plugin is updated. If the issue changes or becomes exacerbated by an update or something else, this filter will prolly stop gettin the job done.):
// ----------------------------------------------------------------------------------------------------
// Decode htmlentities in AddThis Share titles back into their appropriate spcial characters -- Andre
// ----------------------------------------------------------------------------------------------------
function addthis_sharing_quotes_fix( $title ) {
$title = htmlspecialchars_decode($title);
return $title;
}
add_filter( 'addthis_sharing_buttons_title', 'addthis_sharing_quotes_fix', 10, 2 );
AddThis Sharing action converts quotes into html entities (eg, " --> " or #8211)