I have:
Joomla 2.5.11
K2 2.6.6
Upon installing a component which loads html content through XMLHttpRequest with response "application/json" both in front-end and back-end, the component breaks down. When disabling "System - K2" plugin the component works.
On inspecting the System-K2 plugin I have found that the onAfterRender method modifies the JResponse body doing a substitution on the html tag (adding: prefix="og:
ogp.me/ns#" attribute) and replacing some openGraph meta tags in the document.
This happens without discrimination on: document type, frontend/backend, component.
I have done the following modifications to the plugin resolving my problems:
function onAfterRender() {
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
if ($mainframe->isAdmin()) {return;}
if ($document->getType() != 'html') {return;}
if (JRequest::getCmd('option') != 'com_k2') {return;}
/*from here on the rest is left untouched*/
I think:
1) In back-end this stuff is unneeded - so it should not be executed
2) Surely, this stuff should be only done on html documents
3) Questionably, but I think k2 plugin should work only when in k2 component
I hope this helps someone and if it is considered worthy it will be included/fixed in some future version.
K2 rules!
Adam