Advertisement
manchumahara

ForFaysalssvbutton

May 12th, 2013
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.59 KB | None | 0 0
  1. //pinterest.com
  2.     static function show_pinterest_button(&$sbutton) {
  3.         extract($sbutton);
  4.        
  5.         $fixclass   = '';        
  6.         $button     = '';        
  7.         $media      = '';
  8.        
  9.         $linkbuttonstyle = 'normal';
  10.         if($style == 'normal'){            
  11.             if($showcount == 0){
  12.                 $width = 32; $height = 32;
  13.                 $linkbuttonstyle = 'normal';
  14.             }
  15.         }
  16.         else{
  17.             if($showcount == 0){
  18.                 $linkbuttonstyle = 'compact';
  19.                 $width = 60;  $height = 20;
  20.             }
  21.         }
  22.        
  23.         if($showcount){
  24.            
  25.             if($pinimg != ''){
  26.                 $pinimg = urlencode($pinimg);
  27.                 $media = '&media='.$pinimg;
  28.             }
  29.             else{
  30.                 $media = '';
  31.             }
  32.  
  33.  
  34.             if($media == '' && $bookmark){
  35.                 if($style == 'normal') {            
  36.                     $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>';                
  37.                     //$button .= '<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>';            
  38.                 }
  39.                 else {        
  40.                     $localcompactbutton = JURI::root().'plugins/content/socialshareandvotebutton/socialshareandvotebutton/pincompact.png';
  41.                     $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>';                
  42.                     //$button .= '<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>';
  43.                 }
  44.             }
  45.             else{
  46.                 $fixclass = 'allshare_button_pinterestfix';
  47.                
  48.                 if(!defined('cbpinterestsharejs') && $js) {
  49.                     define('cbpinterestsharejs', true);
  50.                     $button .= ' <script>(function() {
  51.                                var s = document.createElement(\'script\');
  52.                                s.type = \'text/javascript\';
  53.                                s.async = true;
  54.                                s.src = (\'https:\' == document.location.protocol ? \'https:\' : \'http:\')  +\'//assets.pinterest.com/js/pinit.js\';
  55.                                var x = document.getElementsByTagName(\'script\')[0];
  56.                                x.parentNode.insertBefore(s, x);
  57.                                })();</script>';
  58.                 }
  59.  
  60.                 $link = urlencode($link);
  61.                 if($style == 'normal') {            
  62.                     $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>';                
  63.                     //$button .= '<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>';            
  64.                 }
  65.                 else {            
  66.                     $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>';
  67.                     //$button .= '<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>';
  68.                 }
  69.             }
  70.         } else {
  71.            
  72.             $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>';            
  73.         }                                
  74.        
  75.        
  76.        
  77.         $button = '<div class="allshare_button allshare_button_pinterest '.$fixclass.'">'.$button.'</div>';
  78.         return $button;
  79.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement