本文整理匯總了PHP中FabrikString::replaceLast方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikString::replaceLast方法的具體用法?PHP FabrikString::replaceLast怎麽用?PHP FabrikString::replaceLast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikString
的用法示例。
在下文中一共展示了FabrikString::replaceLast方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onAfterRender
/**
* 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);
}
示例2: onAfterRender
/**
* 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);
}