Skip to content

Commit

Permalink
Merge pull request #275 from t3solution/5.2.6
Browse files Browse the repository at this point in the history
New release v5.2.6
  • Loading branch information
t3solution authored Oct 8, 2022
2 parents 99cc787 + 6630e84 commit 6723c3f
Show file tree
Hide file tree
Showing 17 changed files with 177 additions and 98 deletions.
14 changes: 8 additions & 6 deletions Classes/Command/CdnToLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class CdnToLocal extends CommandBase
const localZipPath = 'fileadmin/T3SB/Resources/Public/CSS/googlefonts/';
const zipFilePath = 'https://google-webfonts-helper.herokuapp.com/api/fonts/';
const localGoogleFile = 'fileadmin/T3SB/Resources/Public/CSS/googlefonts.css';
const googleFilestyles = ['300', 'regular', '700'];

protected $configurationManager;

Expand Down Expand Up @@ -77,7 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$settings['cdn']['fontawesome'] = $settings['cdn']['fontawesome6latest'];
}
if ( !empty($settings['cdn']['googlefonts']) && empty($settings['cdn']['noZip']) ) {
self::getGoogleFonts($settings['cdn']['googlefonts'], $settings['preloadGooleFonts']);
self::getGoogleFonts($settings['cdn']['googlefonts'], $settings['preloadGooleFonts'], $settings['gooleFontsWeights']);
} else {
$localZipPath = GeneralUtility::getFileAbsFileName(self::localZipPath);
if ( is_dir($localZipPath) ) {
Expand Down Expand Up @@ -300,7 +299,7 @@ private function writeCustomFile($customPath, $customFileName, $cdnPath, $extend
}


private function getGoogleFonts($googleFonts, $preloadGooleFonts) {
private function getGoogleFonts($googleFonts, $preloadGooleFonts, $gooleFontsWeights) {
$localZipPath = GeneralUtility::getFileAbsFileName(self::localZipPath);
if ( is_dir($localZipPath) ) {
parent::rmDir($localZipPath);
Expand All @@ -311,7 +310,8 @@ private function getGoogleFonts($googleFonts, $preloadGooleFonts) {
foreach ($googleFontsArr as $font) {
$fontFamily = trim($font);
$font = str_replace(' ', '-', trim($font));
foreach ( self::googleFilestyles as $style ) {
foreach ( explode(',', $gooleFontsWeights) as $style ) {
$style = trim($style);
$zipFilename = strtolower($font).'?download=zip&subsets=latin&variants='.$style;
$zipContent = GeneralUtility::getURL(self::zipFilePath . $zipFilename);
$fontArr[$fontFamily] = self::getGoogleFiles($zipContent, $localZipFile, $localZipPath);
Expand All @@ -325,8 +325,9 @@ private function getGoogleFonts($googleFonts, $preloadGooleFonts) {
$css = '';
$headerData = '';
foreach ($sliceArr as $fontFamily=>$googlePath) {
foreach ( self::googleFilestyles as $i=>$style ) {
$file = str_replace('300','', explode('.', $googlePath[0])[0]).trim($style);
foreach ( explode(',', $gooleFontsWeights) as $i=>$style ) {
$style = trim($style);
$file = str_replace('300','', explode('.', $googlePath[0])[0]).$style;
$style = $style == 'regular' ? '400' : $style;
if (!empty($preloadGooleFonts)) {
$num = self::generateRandomString();
Expand All @@ -343,6 +344,7 @@ private function getGoogleFonts($googleFonts, $preloadGooleFonts) {
font-family: '".$fontFamily."';
font-style: normal;
font-weight: ".$style.";
font-display: swap;
src: url('/fileadmin/T3SB/Resources/Public/CSS/googlefonts/".$file.".eot');
src: local(''),
url('/fileadmin/T3SB/Resources/Public/CSS/googlefonts/".$file.".eot?#iefix') format('embedded-opentype'),
Expand Down
12 changes: 7 additions & 5 deletions Classes/Command/CustomScss.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
$bootstrapScssPath = GeneralUtility::getFileAbsFileName($bootstrapScssDir);

if ($settings['cdn']['noZip']) {
self::getSccFilesNoZip($settings, $bootstrapVersion, $bootstrapScssPath);
self::getBootstrapFilesNoZip($settings, $bootstrapVersion, $bootstrapScssPath);
} else {
self::getSccFiles($bootstrapVersion);
self::getBootstrapFiles($bootstrapVersion);
}
if (!file_exists(GeneralUtility::getFileAbsFileName(self::localZipPath.'scss/bootstrap.scss'))) {
self::getSccFiles($settings, $bootstrapVersion, $bootstrapScssPath);
self::getBootstrapFiles($settings, $bootstrapVersion, $bootstrapScssPath);
}

# Custom
Expand Down Expand Up @@ -237,7 +237,7 @@ private function deleteFilesFromDirectory($directory){
}


public function getSccFiles($bootstrapVersion): void
public function getBootstrapFiles($bootstrapVersion): void
{
$localZipPath = GeneralUtility::getFileAbsFileName(self::localZipPath);
if ( is_dir($localZipPath) ) {
Expand All @@ -257,11 +257,13 @@ public function getSccFiles($bootstrapVersion): void
} else {
throw new \InvalidArgumentException('Sorry ZIP creation failed at this time! Set the constant "bootstrap.cdn.noZip=1" and try again.', 1657464538);
}

$renameFrom = GeneralUtility::getFileAbsFileName(self::localZipPath.'bootstrap-'.$bootstrapVersion.'/scss');
$renameTo = GeneralUtility::getFileAbsFileName(self::localZipPath.'scss');
if ( is_dir($renameFrom) ) {
rename($renameFrom, $renameTo);
}

parent::rmDir(GeneralUtility::getFileAbsFileName(self::localZipPath.'bootstrap-'.$bootstrapVersion));
$zipFile = GeneralUtility::getFileAbsFileName(self::localZipPath.self::localZipFile);
if (file_exists($zipFile)) unlink($zipFile);
Expand All @@ -271,7 +273,7 @@ public function getSccFiles($bootstrapVersion): void
}


public function getSccFilesNoZip($settings, $bootstrapVersion, $customPath): void
public function getBootstrapFilesNoZip($settings, $bootstrapVersion, $customPath): void
{
$gitURL = 'https://raw.githubusercontent.com/twbs/bootstrap/';
$bootstrapPath = 'fileadmin/T3SB/Resources/Public/Contrib/Bootstrap/scss';
Expand Down
17 changes: 13 additions & 4 deletions Classes/DataProcessing/ConfigProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
if ( !empty($contentObjectConfiguration['settings.']['pages.']['override.']) ) {
foreach ( $contentObjectConfiguration['settings.']['pages.']['override.'] as $field=>$override ) {
if (!empty($override)) {
if ( ($field === 'tx_t3sbootstrap_titlecolor' || $field === 'tx_t3sbootstrap_subtitlecolor') && str_starts_with($override, '--bs-')) {
if ( $field == 'smallColumns' ) {
$processedData['colAside'] = $override;
$processedData['data'][$field] = $override;
$smallColumns = $override;
} elseif ( ($field === 'tx_t3sbootstrap_titlecolor' || $field === 'tx_t3sbootstrap_subtitlecolor') && str_starts_with($override, '--bs-')) {
$processedData['data'][$field] = 'var('.$override.')';
} else {
$processedData['data'][$field] = $override;
Expand All @@ -110,15 +114,13 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$threeCol = $backendLayoutNextLevel == 'pagets__ThreeCol' ? TRUE : FALSE;
}
if ($oneCol === FALSE) {
$smallColumns = (int)$processedData['data']['tx_t3sbootstrap_smallColumns'];
$processedData['colAside'] = $smallColumns;
if ($threeCol === TRUE) {
$smallColumns = $smallColumns < 6 ? $smallColumns : 5;
$processedData['colMain'] = 12 - $smallColumns * 2;
} else {
$processedData['colMain'] = 12 - $smallColumns;
}
$processedData['colAside'] = (12 - $processedData['colMain']) / 2;
$processedData['colAside'] = $smallColumns;
}

// grid breakpoint
Expand Down Expand Up @@ -381,6 +383,13 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
}
}

// color
$processedData['config']['navbar']['colorschemes'] = explode(' ', $processedRecordVariables['navbarColor'])[0];
$processedData['config']['navbar']['gradient'] = '';
if ( explode(' ', $processedRecordVariables['navbarColor'])[1] ) {
$processedData['config']['navbar']['gradient'] = explode(' ', $processedRecordVariables['navbarColor'])[1];
}

// content only on rootpage
if ( ($processedRecordVariables['homepageUid'] == $frontendController->id) && $processedRecordVariables['contentOnlyOnRootpage'] ) {
$processedData['config']['navbar']['enable'] = FALSE;
Expand Down
1 change: 0 additions & 1 deletion Classes/Wrapper/BackgroundWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function getProcessedData(array $processedData, array $flexconf, bool $we
$youTubeRenderer = GeneralUtility::makeInstance(YouTubeRenderer::class);
$processedData['videoId'] = $youTubeRenderer->render($file);
} else {

if ( $file->getMimeType() === 'video/vimeo' || $file->getExtension() === 'vimeo' ) {
// vimeo video
$processedData['vimeo'] = TRUE;
Expand Down
31 changes: 17 additions & 14 deletions Configuration/TypoScript/constants.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ plugin.tx_t3sbootstrap {
}


bootstrap.cdn.bootstraplatest = 5.2.0
bootstrap.cdn.bootstraplatest = 5.2.2
bootstrap.cdn.noZip = 0
bootstrap.cdn.fontawesome5latest = 5.15.4
bootstrap.cdn.fontawesome6latest = 6.1.2
bootstrap.cdn.fontawesome6latest = 6.2.0

#-------------------------------------------------------------------------------
# Constant Editor
Expand All @@ -36,15 +36,15 @@ bootstrap.cdn {
# cat=bootstrap-cdn/a-google/10; type=small; label=Comma separated list with google fonts:integrate Google Fonts "GDPR"-compliant locally into your website (e.g.: Montserrat,Fira Sans)
googlefonts =
# cat=bootstrap-cdn/b-version/10; type=small; label=Bootstrap:
bootstrap = 5.2.0
bootstrap = 5.2.2
# cat=bootstrap-cdn/b-version/11; type=small; label=Popper js:
popperjs = 2.11.5
popperjs = 2.11.6
# cat=bootstrap-cdn/b-version/13; type=small; label=Masonry js:
masonry = 4.2.2
# cat=bootstrap-cdn/b-version/12; type=small; label=Fontawesome: e.g. 5.15.4 or 6.1.2
fontawesome = 5.15.4
# cat=bootstrap-cdn/b-version/12; type=small; label=Fontawesome: e.g. 5.15.4 or 6.2.0
fontawesome = 6.2.0
# cat=bootstrap-cdn/b-version/20; type=small; label=jQuery library:
jquery = 3.6.0
jquery = 3.6.1
# cat=bootstrap-cdn/b-version/22; type=small; label=jQuery Easing:
jqueryEasing = 1.4.1
# cat=bootstrap-cdn/b-version/25; type=int+; label=Cookieconsent: set to 3 only to get v3.x (latest)
Expand All @@ -63,23 +63,23 @@ bootstrap.cdn {
halkabox = 1.6.0
# cat=bootstrap-cdn/b-version/45; type=small; label=G Lightbox:
glightbox = 3.2.0
# cat=bootstrap-cdn/b-version/50; type=small; label=Jarallax:
# cat=bootstrap-cdn/b-version/50; type=small; label=Jarallax: set to 2 only to get v2.x (latest)
jarallax = 2
# cat=bootstrap-cdn/b-version/60; type=small; label=Swiper:
# cat=bootstrap-cdn/b-version/60; type=small; label=Swiper: set to 8 only to get v8.x (latest)
swiper = 8

# cat=bootstrap-cdn/c-integrity/10; type=small; label=Bootstrap CSS:
bootstrapCssIntegrity = sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx
bootstrapCssIntegrity = sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi
# cat=bootstrap-cdn/c-integrity/11; type=small; label=Bootstrap JS:
bootstrapJsIntegrity = sha384-ODmDIVzN+pFdexxHEHFBQH3/9/vQ9uori45z4JjnFsRydbmQbmL5t1tQ0culUzyK
bootstrapJsIntegrity = sha384-IDwe1+LCz02ROU9k972gdyvl+AESN10+x7tBKgc9I5HFtuNz0wWnPclzo6p9vxnk
# cat=bootstrap-cdn/c-integrity/12; type=small; label=Bootstrap Bundle JS:
bootstrapBundleJsIntegrity = sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa
bootstrapBundleJsIntegrity = sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3
# cat=bootstrap-cdn/c-integrity/13; type=small; label=Popper js:
popperjsIntegrity = sha384-Xe+8cL9oJa6tN/veChSP7q+mnSPaj5Bcu9mPX5F5xIGE0DVittaqT5lorf0EI7Vk
popperjsIntegrity = sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3
# cat=bootstrap-cdn/c-integrity/14; type=small; label=Masonry js:
masonryIntegrity = sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D
# cat=bootstrap-cdn/c-integrity/20; type=small; label=jQuery library:
jqueryIntegrity =
jqueryIntegrity = sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=
# cat=bootstrap-cdn/c-integrity/22; type=small; label=jQuery Easing:
jqueryEasingIntegrity =
# cat=bootstrap-cdn/c-integrity/25; type=small; label=Cookieconsent:
Expand Down Expand Up @@ -244,6 +244,9 @@ bootstrap.backToTopForAllPages = 0

# Preload the google fonts includedby bootstrap.cdn.googlefonts if activated (execute scheduler task t3sbootstrap:cdnToLocal)
bootstrap.preloadGooleFonts = 0
# font-weights for Google fonts (regular == 400)
bootstrap.gooleFontsWeights = 300, regular, 700

# GTM Account ID - include the Google Tag Manager if entered
bootstrap.gtm =

Expand Down
1 change: 1 addition & 0 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.tx_t3sbootstrap {
breakpoint.xxl = {$bootstrap.navbar.breakpoint.xxl}
disableJquery = {$bootstrap.disable.jquery}
preloadGooleFonts = {$bootstrap.preloadGooleFonts}
gooleFontsWeights = {$bootstrap.gooleFontsWeights}
cdn {
// Versions
enable = {$bootstrap.cdn.enable}
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Partials/Content/Card/ProfileCard.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<f:if condition="{card.multiImage.socialmedia.enable}">
<div class="icon-block text-center my-2">
<f:for each="{card.multiImage.socialmediaLinks}" key="company" as="socialmediaLink">
<a target="_blank" title="{company}" href="{socialmediaLink}"><i class="fa fa-{company}"></i></a>
<a target="_blank" title="{company}" href="{socialmediaLink}"><i class="fa-brands fa-{company}"></i></a>
</f:for>
</div>
</f:if>
Expand Down
23 changes: 1 addition & 22 deletions Resources/Private/Partials/FunctionAssets.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,6 @@
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
return rect.top + scrollTop;
}

/**
* Object.prototype.forEach(TYPO3.settings.ADDHEIGHT) polyfill
* https://gomakethings.com/looping-through-objects-with-es6/
* @author Chris Ferdinandi
* @license MIT
*/
if (!Object.prototype.forEach) {
Object.defineProperty(Object.prototype, 'forEach', {
value: function (callback, thisArg) {
if (this == null) {
throw new TypeError('Not an object');
}
thisArg = thisArg || window;
for (var key in this) {
if (this.hasOwnProperty(key)) {
callback.call(thisArg, this[key], key, this);
}
}
}
});
}
</f:asset.script>


Expand Down Expand Up @@ -183,6 +161,7 @@
<f:asset.script identifier="navbartransparent_function">
// Navbar transparent - Navbar/Assets.html
function t3sbTransparentNavbar(colorschemes, gradient) {
if (colorschemes) colorschemes = 'bg-'+colorschemes;
window.onscroll = function(){
var navbar = document.getElementById('main-navbar');
var top = window.pageYOffset || document.documentElement.scrollTop;
Expand Down
10 changes: 7 additions & 3 deletions Resources/Private/Partials/Layouts/Assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,26 @@
<f:if condition="{codesnippet} && {settings.codesnippet}">
<f:if condition="{settings.cdn}">
<f:then>
<f:asset.css identifier="codesnippetCssPrimary"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/{settings.highlightVersion}/styles/default.min.css" />
<f:asset.css identifier="codesnippetCssSecondary"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/{settings.highlightVersion}/styles/a11y-light.min.css" />
<f:asset.script identifier="codesnippetJsPrimary"
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/{settings.highlightVersion}/highlight.min.js"
integrity="{settings.highlightIntegrity}" />
<f:comment>
<f:asset.css identifier="codesnippetCssPrimary"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/{settings.highlightVersion}/styles/default.min.css" />
<f:asset.script identifier="codesnippetJsSecondary"
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/{settings.highlightVersion}/languages/php.min.js"
integrity="{settings.highlightIntegrity}" />
</f:comment>
</f:then>
<f:else>
<f:asset.css identifier="codesnippetCssPrimary" href="fileadmin/T3SB/Resources/Public/CSS/highlight.default.min.css" />
<f:asset.css identifier="codesnippetCssSecondary" href="fileadmin/T3SB/Resources/Public/CSS/highlight.a11y-light.min.css" />
<f:asset.script identifier="codesnippetJsPrimary" src="fileadmin/T3SB/Resources/Public/JS/highlight.min.js" />
<f:comment>
<f:asset.css identifier="codesnippetCssPrimary" href="fileadmin/T3SB/Resources/Public/CSS/highlight.default.min.css" />
<f:asset.script identifier="codesnippetJsSecondary" src="fileadmin/T3SB/Resources/Public/JS/highlight.php.min.js" />
</f:comment>
</f:else>
</f:if>
<f:asset.script identifier="vanilla_codesnippetJsInline">
Expand Down
Loading

0 comments on commit 6723c3f

Please sign in to comment.