Project

General

Profile

Bug #22273 » 22273.patch

Tobias Hochgürtel, 2011-07-29 21:26

View differences:

t3lib/class.t3lib_pagerenderer.php 2011-02-26 00:21:11.000000000 +0100
* @param boolean $forceOnTop
* @return void
*/
public function addCssFile($file, $rel = 'stylesheet', $media = 'all', $title = '', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $debug = false) {
public function addCssFile($file, $rel = 'stylesheet', $media = 'all', $title = '', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '') {
if (!isset($this->cssFiles[$file])) {
$this->cssFiles[$file] = array(
'rel' => $rel,
......
'allWrap' => $allWrap
);
}
if($debug){
I::info($this->cssFiles, "\$this->pageRenderer->cssFiles");
}
}
/*CSS Inline Blocks */
......
/* */
/* */
/*****************************************************/
/**
* USER_INT, Objects generated Header-Data (JS(head/footer)|CSS(head/footer)) are not Updated / Added to the Content OutPut.
* - BEGIN
* @see http://forge.typo3.org/issues/22273
* @author Tobias Hochguertel, <tobias.hochguertel@online.de>
*/
/**
* NOTE:
* Following Constants are defined...
---------------------------------------
const PART_COMPLETE = 0;
const PART_HEADER = 1;
const PART_FOOTER = 2;
*
*/
/**
* renderCssFiles()
*
* @param String $cssFiles="", An Already Setuped/Rendered $cssFiles Variable.
* @return String
*/
protected function renderCssFiles($cssFiles = "")
{
if (count($this->cssFiles))
{
foreach ($this->cssFiles as $file => $properties)
{
$file = t3lib_div::resolveBackPath($file);
$file = t3lib_div::createVersionNumberedFilename($file);
$tag = '<link rel="' . htmlspecialchars($properties['rel']) . '" type="text/css" href="' .
htmlspecialchars($file) . '" media="' . htmlspecialchars($properties['media']) . '"' .
($properties['title'] ? ' title="' . htmlspecialchars($properties['title']) . '"' : '') .
$endingSlash . '>';
if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE)
{
$tag = str_replace('|', $tag, $properties['allWrap']);
}
if ($properties['forceOnTop'])
{
$cssFiles = $tag . LF . $cssFiles;
}
else
{
$cssFiles .= LF . $tag;
}
}
}
return $cssFiles;
}
/**
* renderCssInline()
*
* @param String $cssInline="", An Already Setuped/Rendered $cssInline Variable.
* @return String
*/
protected function renderCssInline($cssInline = "")
{
if (count($this->cssInline))
{
foreach ($this->cssInline as $name => $properties)
{
if ($properties['forceOnTop']) {
$cssInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $cssInline;
}
else
{
$cssInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
}
}
$cssInline = $this->inlineCssWrap[0] . $cssInline . $this->inlineCssWrap[1];
}
return $cssInline;
}
/**
* renderJsFooterLibs()
*
* @param String $jsFooterLibs="", An Already Setuped/Rendered $jsFooterLibs Variable.
* @param String $jsLibs="", An Already Setuped/Rendered $jsLibs Variable.
* @return Array Keys: [ 'jsFooterLibs', 'jsLibs' ].
*/
protected function renderJsFooterLibs($jsFooterLibs = "", $jsLibs = "")
{
if (count($this->jsLibs)) {
foreach ($this->jsLibs as $name => $properties) {
$properties['file'] = t3lib_div::resolveBackPath($properties['file']);
$properties['file'] = t3lib_div::createVersionNumberedFilename($properties['file']);
$tag = '<script src="' . htmlspecialchars($properties['file']) . '" type="' . htmlspecialchars($properties['type']) . '"></script>';
if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
$tag = str_replace('|', $tag, $properties['allWrap']);
}
if ($properties['forceOnTop']) {
if ($properties['section'] === self::PART_HEADER) {
$jsLibs = $tag . LF . $jsLibs;
} else {
$jsFooterLibs = $tag . LF . $jsFooterLibs;
}
} else {
if ($properties['section'] === self::PART_HEADER) {
$jsLibs .= LF . $tag;
} else {
$jsFooterLibs .= LF . $tag;
}
}
}
}
if ($this->moveJsFromHeaderToFooter) {
$jsFooterLibs = $jsLibs . LF . $jsFooterLibs;
$jsLibs = '';
}
return array(
'jsFooterLibs' => $jsFooterLibs,
'jsLibs' => $jsLibs
);
}
/**
* renderJsFiles()
*
* @param String $jsFiles="", An Already Setuped/Rendered $jsFiles Variable.
* @param String $jsFooterFiles="", An Already Setuped/Rendered $jsFooterFiles Variable.
* @return Array Keys: [ 'jsFiles', 'jsFooterFiles' ].
*/
protected function renderJsFiles($jsFiles = "", $jsFooterFiles = "")
{
if (count($this->jsFiles)) {
foreach ($this->jsFiles as $file => $properties) {
$file = t3lib_div::resolveBackPath($file);
$file = t3lib_div::createVersionNumberedFilename($file);
$tag = '<script src="' . htmlspecialchars($file) . '" type="' . htmlspecialchars($properties['type']) . '"></script>';
if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
$tag = str_replace('|', $tag, $properties['allWrap']);
}
if ($properties['forceOnTop']) {
if ($properties['section'] === self::PART_HEADER) {
$jsFiles = $tag . LF . $jsFiles;
} else {
$jsFooterFiles = $tag . LF . $jsFooterFiles;
}
} else {
if ($properties['section'] === self::PART_HEADER) {
$jsFiles .= LF . $tag;
} else {
$jsFooterFiles .= LF . $tag;
}
}
}
}
if ($this->moveJsFromHeaderToFooter) {
$jsFooterFiles = $jsFiles . LF . $jsFooterFiles;
$jsFiles = '';
}
return array(
'jsFiles' => $jsFiles,
'jsFooterFiles' => $jsFooterFiles
);
}
/**
* renderJsInline()
*
* @param String $jsInline="", An Already Setuped/Rendered $jsInline Variable.
* @param String $jsFooterInline="", An Already Setuped/Rendered $jsFooterInline Variable.
* @return Array Keys: [ 'jsInline', 'jsFooterInline' ].
*/
protected function renderJsInline($jsInline = "", $jsFooterInline = "" )
{
if (count($this->jsInline)) {
foreach ($this->jsInline as $name => $properties) {
if ($properties['forceOnTop']) {
if ($properties['section'] === self::PART_HEADER) {
$jsInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsInline;
} else {
$jsFooterInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsFooterInline;
}
} else {
if ($properties['section'] === self::PART_HEADER) {
$jsInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
} else {
$jsFooterInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
}
}
}
}
if ($jsInline) {
$jsInline = $this->inlineJavascriptWrap[0] . $jsInline . $this->inlineJavascriptWrap[1];
}
if ($jsFooterInline) {
$jsFooterInline = $this->inlineJavascriptWrap[0] . $jsFooterInline . $this->inlineJavascriptWrap[1];
}
if ($this->moveJsFromHeaderToFooter) {
$jsFooterInline = $jsInline . LF . $jsFooterInline;
$jsInline = '';
}
return array(
'jsInline' => $jsInline,
'jsFooterInline' => $jsFooterInline
);
}
/**
* INTpageRenderer_HeaderFooterIncludes,
*
*
*
* @return Array(
'jsLibs' => &$jsLibs,
'jsFiles' => &$jsFiles,
'jsFooterFiles' => &$jsFooterFiles,
'jsInline' => &$jsInline,
'jsFooterInline' => &$jsFooterInline,
'jsFooterLibs' => &$jsFooterLibs,
);
*/
public function INTpageRenderer_HeaderFooterIncludes()
{
$jsFiles = '';
$cssFiles = '';
$cssInline = '';
$jsInline = '';
$jsFooterInline = '';
$jsFooterLibs = '';
$jsFooterFiles = '';
// preRenderHook for possible manuipulation
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'])) {
$params = array(
'jsLibs' => &$this->jsLibs,
'jsFooterLibs' => &$this->jsFooterLibs,
'jsFiles' => &$this->jsFiles,
'jsFooterFiles' => &$this->jsFooterFiles,
'cssFiles' => &$this->cssFiles,
'headerData' => &$this->headerData,
'footerData' => &$this->footerData,
'jsInline' => &$this->jsInline,
'jsFooterInline' => &$this->jsFooterInline,
'cssInline' => &$this->cssInline,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'] as $hook) {
t3lib_div::callUserFunction($hook, $params, $this);
}
}
$jsLibs = $this->renderJsLibraries();
if ($this->concatenateFiles) {
// do the file concatenation
$this->doConcatenate();
}
if ($this->compressCss || $this->compressJavascript) {
// do the file compression
$this->doCompress();
}
$cssFiles = $this->renderCssFiles($cssFiles);
$cssInline = $this->renderCssInline($cssInline);
extract($this->renderJsFooterLibs($jsFooterLibs, $jsLibs), EXTR_REFS);
extract($this->renderJsFiles($jsFiles, $jsFooterFiles), EXTR_REFS);
extract($this->renderJsInline($jsInline, $jsFooterInline), EXTR_REFS);
// postRenderHook for possible manipulation
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postProcess'])) {
$params = array (
'jsLibs' => &$jsLibs,
'jsFiles' => &$jsFiles,
'jsFooterFiles' => &$jsFooterFiles,
'cssFiles' => &$cssFiles,
'headerData' => &$this->headerData,
'footerData' => &$this->footerData,
'jsInline' => &$jsInline,
'cssInline' => &$cssInline,
'xmlPrologAndDocType' => &$this->xmlPrologAndDocType,
'htmlTag' => &$this->htmlTag,
'headTag' => &$this->headTag,
'charSet' => &$this->charSet,
'metaCharsetTag' => &$this->metaCharsetTag,
'shortcutTag' => &$this->shortcutTag,
'inlineComments' => &$this->inlineComments,
'baseUrl' => &$this->baseUrl,
'baseUrlTag' => &$this->baseUrlTag,
'favIcon' => &$this->favIcon,
'iconMimeType' => &$this->iconMimeType,
'titleTag' => &$this->titleTag,
'title' => &$this->title,
'metaTags' => &$metaTags,
'jsFooterInline' => &$jsFooterInline,
'jsFooterLibs' => &$jsFooterLibs,
'bodyContent' => &$this->bodyContent,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postProcess'] as $hook) {
t3lib_div::callUserFunction($hook, $params, $this);
}
}
return Array(
'jsLibs' => &$jsLibs,
'jsFiles' => &$jsFiles,
'jsFooterFiles' => &$jsFooterFiles,
'jsInline' => &$jsInline,
'jsFooterInline' => &$jsFooterInline,
'jsFooterLibs' => &$jsFooterLibs,
);
}
/**
* USER_INT, Objects generated Header-Data (JS(head/footer)|CSS(head/footer)) are not Updated / Added to the Content OutPut.
* - END
* @see http://forge.typo3.org/issues/22273
* @author Tobias Hochguertel, <tobias.hochguertel@online.de>
*/
/**
* render the section (Header or Footer)
*
......
$this->shortcutTag = str_replace(' />', '>', $this->shortcutTag);
$endingSlash = '';
}
$cssFiles = $this->renderCssFiles($cssFiles);
/*
if (count($this->cssFiles)) {
foreach ($this->cssFiles as $file => $properties) {
$file = t3lib_div::resolveBackPath($file);
......
$cssFiles .= LF . $tag;
}
}
}*/
}
if (count($this->cssInline)) {
foreach ($this->cssInline as $name => $properties) {
if ($properties['forceOnTop']) {
$cssInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $cssInline;
} else {
$cssInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
}
}
$cssInline = $this->inlineCssWrap[0] . $cssInline . $this->inlineCssWrap[1];
}
// if (count($this->cssInline)) {
// foreach ($this->cssInline as $name => $properties) {
// if ($properties['forceOnTop']) {
// $cssInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $cssInline;
// } else {
// $cssInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
// }
// }
// $cssInline = $this->inlineCssWrap[0] . $cssInline . $this->inlineCssWrap[1];
// }
$cssInline = $this->renderCssInline($cssInline);
/*
if (count($this->jsLibs)) {
foreach ($this->jsLibs as $name => $properties) {
$properties['file'] = t3lib_div::resolveBackPath($properties['file']);
......
}
}
}
*/
extract($this->renderJsFooterLibs($jsFooterLibs, $jsLibs), EXTR_REFS);
/*
if (count($this->jsFiles)) {
foreach ($this->jsFiles as $file => $properties) {
$file = t3lib_div::resolveBackPath($file);
......
}
}
}
*/
extract($this->renderJsFiles($jsFiles, $jsFooterFiles), EXTR_REFS);
// if (count($this->jsInline)) {
// foreach ($this->jsInline as $name => $properties) {
// if ($properties['forceOnTop']) {
// if ($properties['section'] === self::PART_HEADER) {
// $jsInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsInline;
// } else {
// $jsFooterInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsFooterInline;
// }
// } else {
// if ($properties['section'] === self::PART_HEADER) {
// $jsInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
// } else {
// $jsFooterInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
// }
// }
// }
// }
extract($this->renderJsInline($jsInline, $jsFooterInline), EXTR_REFS);
if (count($this->jsInline)) {
foreach ($this->jsInline as $name => $properties) {
if ($properties['forceOnTop']) {
if ($properties['section'] === self::PART_HEADER) {
$jsInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsInline;
} else {
$jsFooterInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsFooterInline;
}
} else {
if ($properties['section'] === self::PART_HEADER) {
$jsInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
} else {
$jsFooterInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
}
}
}
}
/*
if ($jsInline) {
$jsInline = $this->inlineJavascriptWrap[0] . $jsInline . $this->inlineJavascriptWrap[1];
}
......
if ($jsFooterInline) {
$jsFooterInline = $this->inlineJavascriptWrap[0] . $jsFooterInline . $this->inlineJavascriptWrap[1];
}
*/
// get template
......
$templatePart = explode('###BODY###', $template);
$template = $templatePart[$part - 1];
}
/*
if ($this->moveJsFromHeaderToFooter) {
$jsFooterLibs = $jsLibs . LF . $jsFooterLibs;
$jsLibs = '';
......
$jsFooterInline = $jsInline . LF . $jsFooterInline;
$jsInline = '';
}
*/
// postRenderHook for possible manipulation
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-postProcess'])) {
typo3/sysext/cms/tslib/class.tslib_fe.php 2011-02-26 00:21:11.000000000 +0100
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
require_once(t3lib_extMgm::extPath('hfp_magazine') . 'Classes/Core/include_firebug.php');
require_once(t3lib_extMgm::extPath('hfp_magazine') . 'Classes/Core/class.tx_hfpmagazine_insight_controller.php');
require_once(t3lib_extMgm::extPath('hfp_magazine') . 'Classes/Core/class.tx_hfpmagazine_log_controller.php');
/**
* Class for the built TypoScript based Front End
*
......
$this->additionalJavaScript = $this->config['INTincScript_ext']['additionalJavaScript'];
$this->additionalCSS = $this->config['INTincScript_ext']['additionalCSS'];
$this->JSCode = $this->additionalHeaderData['JSCode'];
$this->JSImgCode = $this->additionalHeaderData['JSImgCode'];
$this->JSImgCode = $this->additionalHeaderData['JSImgCode'];
$this->divSection='';
do {
$INTiS_config = $this->config['INTincScript'];
$this->INTincScript_includeLibs($INTiS_config);
$this->INTincScript_process($INTiS_config);
// Check if there were new items added to INTincScript during the previous execution:
$INTiS_config = array_diff_assoc($this->config['INTincScript'], $INTiS_config);
$reprocess = (count($INTiS_config) ? true : false);
} while($reprocess);
/**
* USER_INT, Objects generated Header-Data (JS(head/footer)|CSS(head/footer)) are not Updated / Added to the Content OutPut.
* - BEGIN
* @see http://forge.typo3.org/issues/22273
* @author Tobias Hochguertel, <tobias.hochguertel@online.de>
*/
$INTpageRenderer_HeaderFooterIncludes = $this->pageRenderer->INTpageRenderer_HeaderFooterIncludes();
$this->additionalHeaderData[] = $INTpageRenderer_HeaderFooterIncludes['jsFiles'];
/**
* USER_INT, Objects generated Header-Data (JS(head/footer)|CSS(head/footer)) are not Updated / Added to the Content OutPut.
* - END
* @see http://forge.typo3.org/issues/22273
* @author Tobias Hochguertel, <tobias.hochguertel@online.de>
*/
$GLOBALS['TT']->push('Substitute header section');
$this->INTincScript_loadJSCode();
$this->content = str_replace('<!--HD_'.$this->config['INTincScript_ext']['divKey'].'-->', $this->convOutputCharset(implode(LF,$this->additionalHeaderData),'HD'), $this->content);
......
$this->setAbsRefPrefix();
$GLOBALS['TT']->pull();
}
/**
* Include libraries for uncached objects.
......
$GLOBALS['TT']->setTSlogMessage('Parts: '.count($INTiS_splitC));
$GLOBALS['TT']->pull();
foreach($INTiS_splitC as $INTiS_c => $INTiS_cPart) {
foreach($INTiS_splitC as $INTiS_c => $INTiS_cPart) {
if (substr($INTiS_cPart,32,3)=='-->') { // If the split had a comment-end after 32 characters it's probably a split-string
$INTiS_key = 'INT_SCRIPT.'.substr($INTiS_cPart,0,32);
$GLOBALS['TT']->push('Include '.$INTiS_config[$INTiS_key]['file'],'');
(2-2/3)