Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //pinterest.com
- static function show_pinterest_button(&$sbutton) {
- extract($sbutton);
- $fixclass = '';
- $button = '';
- $media = '';
- $linkbuttonstyle = 'normal';
- if($style == 'normal'){
- if($showcount == 0){
- $width = 32; $height = 32;
- $linkbuttonstyle = 'normal';
- }
- }
- else{
- if($showcount == 0){
- $linkbuttonstyle = 'compact';
- $width = 60; $height = 20;
- }
- }
- if($showcount){
- if($pinimg != ''){
- $pinimg = urlencode($pinimg);
- $media = '&media='.$pinimg;
- }
- else{
- $media = '';
- }
- if($media == '' && $bookmark){
- if($style == 'normal') {
- $button .= '<a href="javascript:void((function(){var%20e=document.createElement(\'script\');e.setAttribute(\'type\',\'text/javascript\');e.setAttribute(\'charset\',\'UTF-8\');e.setAttribute(\'src\',\'http://assets.pinterest.com/js/pinmarklet.js?r=\'+Math.random()*99999999);document.body.appendChild(e)})());"><img border="0" src="http://passets-cdn.pinterest.com/images/about/buttons/big-p-button.png" title="Pin It" /></a>';
- //$button .= '<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>';
- }
- else {
- $localcompactbutton = JURI::root().'plugins/content/socialshareandvotebutton/socialshareandvotebutton/pincompact.png';
- $button .= '<a href="javascript:void((function(){var%20e=document.createElement(\'script\');e.setAttribute(\'type\',\'text/javascript\');e.setAttribute(\'charset\',\'UTF-8\');e.setAttribute(\'src\',\'http://assets.pinterest.com/js/pinmarklet.js?r=\'+Math.random()*99999999);document.body.appendChild(e)})());"><img border="0" src="'.$localcompactbutton.'" title="Pin It" /></a>';
- //$button .= '<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>';
- }
- }
- else{
- $fixclass = 'allshare_button_pinterestfix';
- if(!defined('cbpinterestsharejs') && $js) {
- define('cbpinterestsharejs', true);
- $button .= ' <script>(function() {
- var s = document.createElement(\'script\');
- s.type = \'text/javascript\';
- s.async = true;
- s.src = (\'https:\' == document.location.protocol ? \'https:\' : \'http:\') +\'//assets.pinterest.com/js/pinit.js\';
- var x = document.getElementsByTagName(\'script\')[0];
- x.parentNode.insertBefore(s, x);
- })();</script>';
- }
- $link = urlencode($link);
- if($style == 'normal') {
- $button .= '<a href="http://pinterest.com/pin/create/button/?url='.$link.'&description='.$title.$media.'" class="pin-it-button" count-layout="vertical"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>';
- //$button .= '<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>';
- }
- else {
- $button .= '<a href="http://pinterest.com/pin/create/button/?url='.$link.'&description='.$title.$media.'" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>';
- //$button .= '<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>';
- }
- }
- } else {
- $button .= '<span class="cbsoclshareitem cbsoclshareitem' . $linkbuttonstyle . ' cbsoclshareitempinterestnormal"><a href="http://pinterest.com/pin/create/button/?url='.$link.'&description='.$title.$media.'" class="pin-it-button" count-layout="horizontal">Pin It</a></span>';
- }
- $button = '<div class="allshare_button allshare_button_pinterest '.$fixclass.'">'.$button.'</div>';
- return $button;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement