Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

Fix open graph issue with K2 and OG protocol by Codeboxr

By: manchumahara on Jan 5th, 2013  |  syntax: PHP  |  size: 2.27 KB  |  views: 514  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. */