/** * Insert require.js config an app ini script into body. * * @return void */ public function onAfterRender() { // Could be component was unistalled but not the plugin if (!class_exists('FabrikString')) { return; } $script = self::js(); $content = JResponse::getBody(); if (!stristr($content, '</body>')) { $content .= $script; } else { $content = FabrikString::replaceLast('</body>', $script . '</body>', $content); } JResponse::setBody($content); }
/** * Insert require.js config an app ini script into body. * * @return void */ public function onAfterRender() { // Could be component was uninstalled but not the plugin if (!class_exists('FabrikString')) { return; } $app = JFactory::getApplication(); $script = self::js(); self::clearJs(); self::storeHeadJs(); $version = new JVersion(); $lessThanThreeFour = version_compare($version->RELEASE, '3.4', '<'); $content = $lessThanThreeFour ? JResponse::getBody() : $app->getBody(); if (!stristr($content, '</body>')) { $content .= $script; } else { $content = FabrikString::replaceLast('</body>', $script . '</body>', $content); } $lessThanThreeFour ? JResponse::setBody($content) : $app->setBody($content); }