本文整理汇总了PHP中JResponse::getBody方法的典型用法代码示例。如果您正苦于以下问题:PHP JResponse::getBody方法的具体用法?PHP JResponse::getBody怎么用?PHP JResponse::getBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JResponse
的用法示例。
在下文中一共展示了JResponse::getBody方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showPopup
function showPopup()
{
global $mainframe;
jimport('joomla.application.helper');
$client = JApplicationHelper::getClientInfo($mainframe->getClientID());
// settings from config.xml
$dumpConfig =& JComponentHelper::getParams('com_dump');
$w = $dumpConfig->get('popupwidth', 500);
$h = $dumpConfig->get('popupheight', 500);
// build the url
$url = JURI::base(true) . '/index.php?option=com_dump&view=tree&tmpl=component';
/* @TODO remove this and implement this in a later version using JRoute
// only add Itemid in Site
if ( $mainframe->isSite() ) {
$url .= '&Itemid=' . DumpHelper::getComponentItemid( 'com_dump' );
}
*/
// create the javascript
// We can't use $document, because it's already rendered
$nl = "\n";
$script = $nl . '<!-- J!Dump -->' . $nl . '<script type="text/javascript">' . $nl . '// <!--' . $nl . 'window.open( "' . $url . '", "dump_' . $client->name . '", "height=' . $h . ',width=' . $w . ',toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1");' . $nl . '// -->' . $nl . '</script>' . $nl . '<!-- / J!Dump -->';
// add the code to the header (thanks jenscski)
// JResponse::appendBody( $script );
$body = JResponse::getBody();
$body = str_replace('</head>', $script . '</head>', $body);
JResponse::setBody($body);
}
示例2: __construct
public function __construct()
{
$this->body = JResponse::getBody();
$this->bInfo = null;
$buf = $this->parseIt();
JResponse::setBody($buf);
}
示例3: _modifyResponsiveTemplate
function _modifyResponsiveTemplate()
{
// Get the current HTML body.
$body = trim(JResponse::getBody());
// Correct doctype declaration.
$doctype = '<!doctype html>';
// Modified flag.
$modified = false;
// Found doctype declaration.
if (preg_match('#<\\!doctype(.*?)>#is', $body, $match)) {
// Make sure it's the correct type.
if (strtolower($match[0]) != $doctype) {
$body = str_replace($match[0], $doctype, $body);
$modified = true;
}
} else {
// No doctype declaration, just add it.
$body = $doctype . "\n" . $body;
$modified = true;
}
// Set the new body only if we've modified it.
if ($modified) {
JResponse::setBody($body);
}
}
示例4: onAfterRender
public function onAfterRender()
{
// only in html and feeds
if (JFactory::getDocument()->getType() !== 'html' && JFactory::getDocument()->getType() !== 'feed') {
return;
}
$html = JResponse::getBody();
if ($html == '') {
return;
}
if (JFactory::getDocument()->getType() != 'html') {
$this->helpers->get('replace')->replaceTags($html, 'body');
$this->helpers->get('clean')->cleanLeftoverJunk($html);
JResponse::setBody($html);
return;
}
// only do stuff in body
list($pre, $body, $post) = nnText::getBody($html);
$this->helpers->get('replace')->replaceTags($body, 'body');
$html = $pre . $body . $post;
$this->helpers->get('clean')->cleanLeftoverJunk($html);
// replace head with newly generated head
// this is necessary because the plugins might have added scripts/styles to the head
$this->helpers->get('head')->updateHead($html);
JResponse::setBody($html);
}
示例5: onAfterRender
/**
*
* Process data after render
* @return string
*/
function onAfterRender()
{
$app = JFactory::getApplication();
if ($app->isAdmin()) {
return;
}
$body = JResponse::getBody();
$plgParams = $this->plgParams;
$disable_map = $plgParams->get('disable_map', 0);
if ($disable_map) {
$body = $this->removeCode($body);
JResponse::setBody($body);
return;
}
if (!preg_match($this->_plgCodeNew, $body) && !preg_match($this->_plgCode, $body)) {
return;
}
$body = $this->stylesheet($this->plugin, $body);
//ignore short-code that placed in text/editor field
$pattern = '#value\\s*=\\s*"[^"]*?{jamap.*?}(\\s*{/jamap})?[^"]*?"#';
$pattern2 = '#<textarea[^>]*?>[\\s\\S]*?{jamap.*?}(\\s*{/jamap})?[\\s\\S]*?</textarea>#';
$body = preg_replace_callback($pattern, array($this, 'escapeMap'), $body);
$body = preg_replace_callback($pattern2, array($this, 'escapeMap'), $body);
//generate map
$body = preg_replace_callback($this->_plgCodeNew, array($this, 'genMap'), $body);
$body = preg_replace_callback($this->_plgCode, array($this, 'genMap'), $body);
//restore short codes
$body = str_replace(array('{[jamap]', '{/[jamap]}'), array('{jamap', '{/jamap}'), $body);
JResponse::setBody($body);
}
示例6: addCustomTagsToDocument
function addCustomTagsToDocument($tags)
{
if (empty($tags)) return ;
$content = '';
if (AriJoomlaUtils::isJoomla15())
{
$content = JResponse::getBody();
}
else
{
$content = @ob_get_contents();
@ob_clean();
}
$content = preg_replace('/(<\/head\s*>)/i', join('', $tags) . '$1', $content);
if (AriJoomlaUtils::isJoomla15())
{
JResponse::setBody($content);
}
else
{
echo $content;
}
}
示例7: onAfterRender
/**
* Run on the joomla onAfterRender trigger
*/
public function onAfterRender()
{
// Use this plugin only in site application
if (JFactory::getApplication()->isSite()) {
//check if pdf is to be output
$printpdf = JRequest::getInt('pdf');
if ($printpdf == 1) {
//get document html from joomla cycle
$data = JResponse::getBody();
//convert paths in html to full paths
$this->fullPaths($data);
//setup dompdf objects
$pdf = $this->engine;
//create pdf using dompdf engine
$pdf->load_html($data);
$pdf->set_paper($this->params->get('size', 'letter'), $this->params->get('orientation', 'portrait'));
$pdf->render();
//get and set pdf title to page title
$this->setName(JFactory::getDocument()->getTitle());
//present pdf to user
$pdf->stream($this->getName() . '.pdf');
return '';
}
}
}
示例8: onAfterRender
function onAfterRender()
{
$plugin =& JPluginHelper::getPlugin('system', 'phocapdffabrik');
$pluginP = new JParameter($plugin->params);
$pdfDestination = $pluginP->get('pdf_destination', 'S');
/*global $mainframe;
if ($mainframe->isAdmin()) {
return;
}*/
// IE 7 bug
include_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_phocapdf' . DS . 'helpers' . DS . 'phocapdfbrowser.php';
$document =& JFactory::getDocument();
$doctype = $document->getType();
if ($doctype == 'html') {
$bodySite = JResponse::getBody();
if ($pdfDestination == 'I' || $pdfDestination == 'D') {
// Remome OnClick
$bodySite = preg_replace_callback('/<a(.+)href="(.*)format=pdf(.*)"(.+)onclick="(.*)"/Ui', array('plgSystemPhocaPDFFabrik', 'phocaPDFCallbackOnClick'), $bodySite);
} else {
//$bodySite = preg_replace_callback('/<a(.+)href="(.*)format=pdf(.*)"/Ui', array('plgSystemPhocaPDFFabrik', 'phocaPDFCallback'), $bodySite);
// IE 7 bug
$bodySite = preg_replace_callback('/<a(.+)href="(.*)format=pdf(.*)"(.+)onclick="(.*)"/Ui', array('plgSystemPhocaPDFFabrik', 'phocaPDFCallbackOnClickIE'), $bodySite);
}
JResponse::setBody($bodySite);
}
return true;
}
示例9: onAfterRender
public function onAfterRender()
{
$fbml = '<html xmlns:fb="http://ogp.me/ns/fb#" ';
$html = JResponse::getBody();
$html = JString::str_ireplace('<html', $fbml, $html);
JResponse::setBody($html);
}
示例10: onAfterRender
function onAfterRender()
{
global $mainframe;
$jatypo = JRequest::getCmd('jatypo');
if (!$mainframe->isAdmin() && !$jatypo) {
return;
}
$tmpl = dirname(__FILE__) . DS . 'jatypo' . DS . 'tmpl' . DS . 'default.php';
$html = $this->loadTemplate($tmpl);
//$html = file_get_contents ($tmpl);
//if (preg_match ('/<body[^>]*>(.*)<\/body>/s', $html, $matches)) $html = $matches[1];
$buffer = JResponse::getBody();
if ($mainframe->isAdmin()) {
if (preg_match('/id=\\"editor-xtd-buttons\\"/', $buffer)) {
//exist editor
//$html = "<div id=\"jatypo-wrap\">$html</div>";
$buffer = preg_replace('/<\\/body>/', "\n{$html}\n</body>", $buffer);
JResponse::setBody($buffer);
}
return;
}
//replace body by the sample
$buffer = preg_replace('/<body([^>]*)>.*<\\/body>/s', "<body\\1>{$html}</body>", $buffer);
JResponse::setBody($buffer);
}
示例11: onAfterRender
function onAfterRender()
{
if (class_exists('JEventDispatcher', false)) {
$dispatcher = JEventDispatcher::getInstance();
} else {
$dispatcher = JDispatcher::getInstance();
}
$dispatcher->trigger('onNextendBeforeCompileHead');
ob_start();
if (class_exists('N2AssetsManager')) {
echo N2AssetsManager::getCSS();
echo N2AssetsManager::getJs();
}
$head = ob_get_clean();
if ($head != '') {
$application = JFactory::getApplication();
if (class_exists('JApplicationWeb') && method_exists($application, 'getBody')) {
$body = $application->getBody();
$mode = 'JApplicationWeb';
} else {
$body = JResponse::getBody();
$mode = 'JResponse';
}
$body = preg_replace('/<\\/head>/', $head . '</head>', $body, 1);
switch ($mode) {
case 'JResponse':
JResponse::setBody($body);
break;
default:
$application->setBody($body);
}
}
}
示例12: _renderStatus
public function _renderStatus()
{
$date = JFactory::getDate();
$jparam = new JConfig();
if (!JFile::exists(JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community' . DS . 'community.xml')) {
return false;
}
if (JFile::exists($jparam->tmp_path . DS . 'jomsocialupdate.ini')) {
$lastcheckdate = JFile::read($jparam->tmp_path . DS . 'jomsocialupdate.ini');
} else {
$lastcheckdate = $date->toFormat();
}
JFile::write($jparam->tmp_path . DS . 'jomsocialupdate.ini', $lastcheckdate);
$dayInterval = 1;
// days
$currentdate = $date->toFormat();
$checkVersion = strtotime($currentdate) > strtotime($lastcheckdate) + $dayInterval * 60 * 60 * 24;
// Load language
$lang = JFactory::getLanguage();
$lang->load('com_community', JPATH_ROOT . DS . 'administrator');
$button = $this->_getButton($checkVersion);
$html = JResponse::getBody();
$html = str_replace('<div id="module-status">', '<div id="module-status">' . $button, $html);
// Load AJAX library for the back end.
$jax = new JAX(rtrim(JURI::root(), '/') . '/plugins/system/pc_includes');
$jax->setReqURI(rtrim(JURI::root(), '/') . '/administrator/index.php');
$jaxScript = $jax->getScript();
JResponse::setBody($html . $jaxScript);
}
示例13: onAfterRender
function onAfterRender()
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
// we don't care about /administrator or pages that aren't html
if ($app->isAdmin() || JRequest::getVar('format') == 'raw' || $app->isSite() && $doc->getType() != 'html') {
return true;
}
// default favicon and individual menu-item assignments
$default = (int) $this->params->get('default', 0);
$assignmentsobject = (array) $this->params->get('assignments');
$assignments = array();
foreach ($assignmentsobject as $key => $assignment) {
$assignments[$key] = (array) $assignment;
}
// no default and no assignments = no point
if (!$default && !count($assignments)) {
return true;
}
$favicon = $this->getFavicon($default, $assignments);
// no favicon found and no valid default
if (!$favicon) {
return true;
}
$buffer = JResponse::getBody();
$link = '<link href="' . $favicon . '" rel="shortcut icon" type="image/vnd.microsoft.icon" />';
preg_match('/<link href=.* rel="shortcut icon" type=.*\\/>/', $buffer, $position, PREG_OFFSET_CAPTURE);
if (isset($position[0]) && isset($position[0][0]) && strlen($position[0][0])) {
$buffer = str_replace($position[0][0], $link, $buffer);
} else {
$buffer = str_replace("</head>", "\t{$link}\n</head>", $buffer);
}
JResponse::setBody($buffer);
}
示例14: _modifyResponsiveTemplate
function _modifyResponsiveTemplate()
{
$buffer = JResponse::getBody();
$buffer = trim($buffer);
$lines = RSFormProHelper::explode($buffer);
$line = $lines[0];
if (strtolower($line) != '<!doctype html>') {
// single line
if (strpos($line, '>') !== false) {
$buffer = str_replace($line, '<!doctype html>', $buffer);
} else {
// should be on multiple lines
$i = 0;
while (strpos($line, '>') === false) {
$i++;
$line = $lines[$i];
}
// bail out, we might be modifying something else
if (strpos($line, '<') !== false) {
return;
}
// remove the first lines...
for ($j = 0; $j <= $i; $j++) {
unset($lines[$j]);
}
// add this on the first line
array_unshift($lines, '<!doctype html>');
// join the new buffer
$buffer = implode("\r\n", $lines);
}
JResponse::setBody($buffer);
}
}
示例15: registerOnAfterRenderBodyFilter
/**
* Registers a handler to filter the final output
*
* @param callable $handler A function( $body ) { return $bodyChanged; }
* @return self To allow chaining.
*/
public function registerOnAfterRenderBodyFilter($handler)
{
$this->registerEvent('onAfterRender', function () use($handler) {
\JResponse::setBody($handler(\JResponse::getBody()));
});
return $this;
}