Esempio n. 1
0
 public function getTagHtml()
 {
     if ($this->fields->exists('image') && $this->getParamValue('image') != "") {
         self::$needsJavascript = true;
         $url = $this->getParamValueEx('href', 'url', null, SCSocialUtilities::getStrippedUrl());
         $layout = $this->getParamValue('layout');
         $url = rawurlencode($url);
         $image = rawurlencode($this->getParamValue('image'));
         $desc = rawurlencode($this->getParamValue('desc'));
         $tagButtonText = '<a href="//pinterest.com/pin/create/button/?url=' . $url;
         if ($image) {
             $tagButtonText .= '&media=' . $image;
         }
         if ($desc) {
             $tagButtonText .= '&description=' . $desc;
         }
         $tagButtonText .= '"';
         if ($layout) {
             $tagButtonText .= SCEasyTags::getShareButtonLayout('pinterest', $layout, '"');
         } else {
             $tagButtonText .= $this->getField('data-pin-config', 'pin_count', null, 'none', 'data-pin-config');
         }
         if (strpos($tagButtonText, 'above') !== false) {
             $pinItButton = 'pinit_fg_en_rect_gray_28.png';
             $tagButtonText .= $this->getField('data-pin-height', '', null, '28', 'data-pin-height');
         } else {
             $pinItButton = 'pin_it_button.png';
         }
         $tagButtonText .= ' data-pin-do="buttonPin" ><img src="//assets.pinterest.com/images/pidgets/' . $pinItButton . '" alt="Share on Pinterest"/></a>';
     } else {
         $tagButtonText = '';
     }
     return $tagButtonText;
 }
Esempio n. 2
0
 private function replaceJSPlaceholders()
 {
     $contents = JResponse::getBody();
     $javascript = '';
     $providers = JFBCFactory::getAllProviders();
     foreach ($providers as $provider) {
         $javascript .= $provider->getHeadData();
     }
     $pinterestWidgets = JFBCFactory::getAllWidgets('pinterest');
     $javascript .= $pinterestWidgets[0]->getHeadData();
     JFBConnectProviderPinterestWidgetShare::$needsJavascript = false;
     $contents = str_replace('<SourceCoastProviderJSPlaceholder />', $javascript, $contents);
     JResponse::setBody($contents);
 }