Project

General

Profile

Feature #81223 » forceInline.patch

Raphael Graf, 2017-05-14 19:58

View differences:

typo3/sysext/core/Classes/Page/PageRenderer.php
* @param string $allWrap
* @param bool $excludeFromConcatenation
* @param string $splitChar The char used to split the allWrap value, default is "|"
* @param bool $forceInline
*/
public function addCssFile($file, $rel = 'stylesheet', $media = 'all', $title = '', $compress = true, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|')
public function addCssFile($file, $rel = 'stylesheet', $media = 'all', $title = '', $compress = true, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $forceInline = false)
{
if (!isset($this->cssFiles[$file])) {
$this->cssFiles[$file] = [
......
'forceOnTop' => $forceOnTop,
'allWrap' => $allWrap,
'excludeFromConcatenation' => $excludeFromConcatenation,
'splitChar' => $splitChar
'splitChar' => $splitChar,
'forceInline' => $forceInline
];
}
}
......
$cssFiles = '';
if (!empty($this->cssFiles)) {
foreach ($this->cssFiles as $file => $properties) {
$file = $this->getStreamlinedFileName($file);
$tag = '<link rel="' . htmlspecialchars($properties['rel'])
. '" type="text/css" href="' . htmlspecialchars($file)
. '" media="' . htmlspecialchars($properties['media']) . '"'
. ($properties['title'] ? ' title="' . htmlspecialchars($properties['title']) . '"' : '')
. $this->endingSlash . '>';
$href = $this->getStreamlinedFileName($file);
if ($properties['forceInline'] && @is_file($file)) {
$cssInline = file_get_contents($file);
$tag = '<style type="text/css"'
. ' media="' . htmlspecialchars($properties['media']) . '"'
. ($properties['title'] ? ' title="' . htmlspecialchars($properties['title']) . '"' : '')
. '>' . "\n"
. $cssInline
. '</style>';
} else {
$tag = '<link rel="' . htmlspecialchars($properties['rel'])
. '" type="text/css" href="' . htmlspecialchars($href)
. '" media="' . htmlspecialchars($properties['media']) . '"'
. ($properties['title'] ? ' title="' . htmlspecialchars($properties['title']) . '"' : '')
. $this->endingSlash . '>';
}
if ($properties['allWrap']) {
$wrapArr = explode($properties['splitChar'] ?: '|', $properties['allWrap'], 2);
$tag = $wrapArr[0] . $tag . $wrapArr[1];
typo3/sysext/frontend/Classes/Page/PageGenerator.php
(bool)$cssFileConfig['forceOnTop'],
$cssFileConfig['allWrap'],
(bool)$cssFileConfig['excludeFromConcatenation'],
$cssFileConfig['allWrap.']['splitChar']
$cssFileConfig['allWrap.']['splitChar'],
$cssFileConfig['forceInline']
);
unset($cssFileConfig);
}
(1-1/2)