manchumahara

Fix open graph issue with K2 and OG protocol by Codeboxr

Jan 5th, 2013
1,286
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Go to(windows style path) joomla root/components/com_k2/views/item/view.html.php  
  2. // and comment line from 445 to 455
  3. /*
  4. $document->setMetaData('og:url', $uri->toString());
  5.         $document->setMetaData('og:title', htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8'));
  6.         $document->setMetaData('og:type', 'Article');
  7.         $facebookImage = 'image'.$params->get('facebookImage', 'Small');
  8.         if ($item->$facebookImage && JFile::exists(JPATH_SITE.$item->$facebookImage))
  9.         {
  10.             $image = substr(JURI::root(), 0, -1).str_replace(JURI::root(true), '', $item->$facebookImage);
  11.             $document->setMetaData('og:image', $image);
  12.             $document->setMetaData('image', $image);
  13.         }
  14.         $document->setMetaData('og:description', htmlspecialchars(strip_tags($document->getDescription()), ENT_QUOTES, 'UTF-8'));
  15. */
  16.  
  17. For joomla root/components/com_k2/views/latest​/view.html.php
  18.  
  19. comment line from line 256 - 261
  20. // Set Facebook meta data
  21. /*
  22.         $document = JFactory::getDocument();
  23.         $uri = JURI::getInstance();
  24.         $document->setMetaData('og:url', $uri->toString());
  25.         $document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle());
  26.         $document->setMetaData('og:type', 'website');
  27.         $document->setMetaData('og:description', strip_tags($document->getDescription()));
  28. */
  29.  
  30. For joomla root/components/com_k2/views/itemlist/view.html.php  line 690 to 701
  31.  
  32. // Set Facebook meta data
  33. /*
  34.         $document = JFactory::getDocument();
  35.         $uri = JURI::getInstance();
  36.         $document->setMetaData('og:url', $uri->toString());
  37.         $document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle());
  38.         $document->setMetaData('og:type', 'website');
  39.         if ($task == 'category' && $this->category->image && strpos($this->category->image, 'placeholder/category.png') === false)
  40.         {
  41.             $image = substr(JURI::root(), 0, -1).str_replace(JURI::root(true), '', $this->category->image);
  42.             $document->setMetaData('og:image', $image);
  43.             $document->setMetaData('image', $image);
  44.         }
  45.         $document->setMetaData('og:description', strip_tags($document->getDescription()));
  46.  
  47. */
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×