Skip to content

Commit

Permalink
Update sharethis.class.php
Browse files Browse the repository at this point in the history
Fix 'title' and 'url' read error on the posts list page by using 'buttons.js' instead of current sharebutton js.
  • Loading branch information
hhren1984 committed Mar 4, 2016
1 parent d539ea1 commit 1913946
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions addons/sharethis/sharethis.class.php
Expand Up @@ -38,17 +38,10 @@ function insert_code_block( & $params )

//TODO: allow per post-type inclusion

$title = "'" . $item->dget( 'title', 'htmlattr' ) . "'";
$url = "'" . $item->get_permanent_url() . "'";
$title = $item->dget( 'title', 'htmlattr' );
$url = $item->get_permanent_url();

$content .= "\n".'<div class="sharethis">
<script type="text/javascript" language="javascript">
SHARETHIS.addEntry( {
title : '. $title .',
url : '. $url .'},
{ button: true }
) ;
</script></div>' . "\n";
$content .= "\n".'<div class="st_sharethis" displayText="ShareThis" st_url="'.$url.'" st_title="'.$title.'" style="margin-bottom:5px;"></div>' . "\n";
return true;
}

Expand All @@ -57,11 +50,9 @@ function insert_code_block( & $params )

function SkinBeginHtmlHead( & $params )
{
$url = "http://w.sharethis.com/widget/?tabs=web%2Cpost%2Cemail&amp;charset=utf-8&amp;services=";
$url .= urlencode( $this->coll_settings['sharethis_services'] ) ;
$url .= '&amp;style=default&amp;publisher=' . $this->coll_settings['sharethis_publisher_id'];

$url = 'http://w.sharethis.com/button/buttons.js';
require_js( $url );
add_headline('<script type="text/javascript">stLight.options({publisher:"'.$this->coll_settings['sharethis_publisher_id'].'",onhover: false});</script>');
return true;
}

Expand All @@ -70,4 +61,4 @@ function RenderItemAsHtml( & $params )
$this->insert_code_block( $params );
}

}
}

0 comments on commit 1913946

Please sign in to comment.