Skip to content

Commit

Permalink
Merge pull request #394 from t3solution/5.3.11
Browse files Browse the repository at this point in the history
New release v5.3.11
  • Loading branch information
t3solution committed May 19, 2024
2 parents 87e757b + 7ee8cc2 commit 047aff4
Show file tree
Hide file tree
Showing 50 changed files with 7,097 additions and 161 deletions.
Binary file removed Classes/.DS_Store
Binary file not shown.
Binary file removed Classes/Backend/.DS_Store
Binary file not shown.
8 changes: 2 additions & 6 deletions Classes/Backend/EventListener/FlexForm/FlexformEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ public function __invoke(AfterFlexFormDataStructureParsedEvent $event): void
$dataStructure = $event->getDataStructure();
$identifier = $event->getIdentifier();

if (!empty($settings['sitepackage'])) {
$ffPath = 'EXT:t3sb_package/T3SB/FlexForms/';
} else {
$ffPath = '/fileadmin/T3SB/FlexForms/';
}
$ffPath = Environment::getPublicPath() . '/fileadmin/T3SB/FlexForms/';

foreach ($GLOBALS['TCA']['tt_content']['columns']['tx_t3sbootstrap_flexform']['config']['ds'] as $key=>$flexForm) {
$flexForms[$key] = substr($flexForm, 46, -4);
Expand All @@ -47,7 +43,7 @@ public function __invoke(AfterFlexFormDataStructureParsedEvent $event): void
if (array_key_exists($identifier['dataStructureKey'], $flexForms)) {
if ($identifier['type'] === 'tca' && $identifier['tableName'] === 'tt_content'
&& $identifier['fieldName'] === 'tx_t3sbootstrap_flexform' && $identifier['dataStructureKey']) {
$file = Environment::getPublicPath() . $ffPath.$flexForms[$identifier['dataStructureKey']].'.xml';
$file = $ffPath.$flexForms[$identifier['dataStructureKey']].'.xml';
if (file_exists($file)) {
$content = @file_get_contents($file);
if ($content) {
Expand Down
11 changes: 10 additions & 1 deletion Classes/Backend/Preview/DefaultPreviewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,16 @@ public function renderPageModulePreviewHeader(GridColumnItem $item): string
}

if (!empty($flexconfSettings)) {
$flexconfSettings = '<div style="padding:1rem;color:#7e00b4;border: 1px solid #7e00b4;display:block;margin-bottom:.75rem;"><strong>Settings:</strong> ' . rtrim($flexconfSettings, ', ') . '</div>';
$icon = '<span style="width:14px;height:14px;display:block;float:right;margin-left:5px;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path d="M7.593 11.43L3.565 5.79A.5.5 0 0 1 3.972 5h8.057a.5.5 0 0 1 .407.791l-4.028 5.64a.5.5 0 0 1-.815-.001z"></path>
</svg>
</span>';
$flexconfSettings = '<a title="Settings" class="" data-bs-toggle="collapse" href="#collapse-'.$record['uid'].'" role="button"
aria-expanded="false" aria-controls="collapse-'.$record['uid'].'">'.$icon.'</a><div class="collapse"
id="collapse-'.$record['uid'].'"><div class="card card-body p-0">
<div style="padding:1rem;color:#7e00b4;border: 1px solid #7e00b4;display:block;margin-bottom:0;">
<strong>Settings:</strong> ' . rtrim($flexconfSettings, ', ') . '</div></div></div>';
}

return $flexconfSettings.$outHeader;
Expand Down
74 changes: 44 additions & 30 deletions Classes/Command/CdnToLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$baseDir = GeneralUtility::getFileAbsFileName('fileadmin/T3SB/');
} else {
if (ExtensionManagementUtility::isLoaded('t3sb_package')) {
$baseDir = GeneralUtility::getFileAbsFileName('EXT:t3sb_package/T3SB/');
$baseDir = GeneralUtility::getFileAbsFileName('EXT:t3sb_package/');
} else {
throw new \InvalidArgumentException('Your t3sb_package is not loaded!', 1657464787);
}
Expand All @@ -77,26 +77,26 @@ protected function execute(InputInterface $input, OutputInterface $output): int
self::getGoogleFontsSitepackage($settings['cdn']['googlefonts'], $settings['gooleFontsWeights'], $baseDir);
}
} else {
$localZipPath = $baseDir.'Resources/Public/CSS/googlefonts/';
$localZipPath = $baseDir.'Resources/Public/T3SB-CSS/googlefonts/';
if (is_dir($localZipPath)) {
parent::rmDir($localZipPath);
}
$cssFile = $baseDir.'Resources/Public/CSS/googlefonts.css';
$cssFile = $baseDir.'Resources/Public/T3SB-CSS/googlefonts.css';
if (file_exists($cssFile)) {
unlink($cssFile);
}
}

foreach ($settings['cdn'] as $key=>$version) {
if ($key == 'jquery') {
$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'jquery.min.js';
$cdnPath = 'https://code.jquery.com/jquery-'.$version.'.min.js';
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'bootstrap') {
$customPath = $baseDir.'Resources/Public/CSS/';
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
$customFileName = 'bootstrap.min.css';
if ($settings['cdn']['bootswatch']) {
$bootswatchTheme = $settings['cdn']['bootswatch'];
Expand All @@ -107,7 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
self::writeCustomFile($customPath, $customFileName, $cdnPath, true);
}

$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'bootstrap.min.js';
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootstrap@'.$version.'/dist/js/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
Expand All @@ -117,7 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if ($key == 'popperjs') {
$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'popper.js';
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/'.$version.'/umd/popper.min.js';
self::writeCustomFile($customPath, $customFileName, $cdnPath);
Expand All @@ -130,7 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
mkdir($customPath, 0777, true);
}
} else {
$customPath = $baseDir.'Resources/Public/CSS/';
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
$customFileName = 'fontawesome.min.css';
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/'.$version.'/css/all.min.css';
self::writeCustomFile($customPath, $customFileName, $cdnPath);
Expand All @@ -147,85 +147,85 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
}

$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'fontawesome.min.js';
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/'.$version.'/js/all.min.js';
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}
}

if ($key == 'jqueryEasing') {
$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'jquery.easing.min.js';
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'lazyload') {
$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'lazyload.min.js';
$cdnPath = 'https://cdn.jsdelivr.net/npm/vanilla-lazyload@'.$version.'/dist/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'picturefill') {
$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'picturefill.min.js';
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/picturefill/'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'animate') {
$customPath = $baseDir.'Resources/Public/CSS/';
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
$customFileName = 'animate.compat.css';
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'baguetteBox') {
$customPath = $baseDir.'Resources/Public/CSS/';
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
$customFileName = 'baguetteBox.min.css';
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);

$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'baguetteBox.min.js';
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}
if ($key == 'halkabox') {
$customPath = $baseDir.'Resources/Public/CSS/';
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
$customFileName = 'halkaBox.min.css';
$cdnPath = 'https://cdn.jsdelivr.net/npm/halkabox@'.$version.'/dist/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath, true);

$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'halkaBox.min.js';
$cdnPath = 'https://cdn.jsdelivr.net/npm/halkabox@'.$version.'/dist/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'glightbox') {
$customPath = $baseDir.'Resources/Public/CSS/';
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
$customFileName = 'glightbox.min.css';
$cdnPath = 'https://cdn.jsdelivr.net/npm/glightbox@'.$version.'/dist/css/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);

$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'glightbox.min.js';
$cdnPath = 'https://cdn.jsdelivr.net/npm/glightbox@'.$version.'/dist/js/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'masonry') {
$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'masonry.pkgd.min.js';
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/masonry/'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'jarallax') {
$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'jarallax.min.js';
$cdnPath = 'https://unpkg.com/jarallax@'.$version.'/dist/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
Expand All @@ -235,11 +235,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if ($key == 'swiper') {
$customPath = $baseDir.'Resources/Public/CSS/';
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
$customFileName = 'swiper-bundle.min.css';
$cdnPath = 'https://unpkg.com/swiper@'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
$customPath = $baseDir.'Resources/Public/JS/';
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
$customFileName = 'swiper-bundle.min.js';
$cdnPath = 'https://unpkg.com/swiper@'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
Expand Down Expand Up @@ -275,7 +275,7 @@ private function writeCustomFile($customPath, $customFileName, $cdnPath, $extend

private function getGoogleFonts($googleFonts, $gooleFontsWeights, $baseDir): void
{
$localZipPath = $baseDir.'Resources/Public/CSS/googlefonts/';
$localZipPath = $baseDir.'Resources/Public/T3SB-CSS/googlefonts/';
if (is_dir($localZipPath)) {
parent::rmDir($localZipPath);
}
Expand All @@ -301,9 +301,14 @@ private function getGoogleFonts($googleFonts, $gooleFontsWeights, $baseDir): voi
$css = '';
$headerData = '';
foreach ($sliceArr as $fontFamily=>$googlePath) {

$gp = explode('.', $googlePath[0]);
$gp = explode('-', $gp[0]);
$replace = end($gp);

foreach (explode(',', $gooleFontsWeights) as $i=>$style) {
$style = trim($style);
$file = str_replace('300', '', explode('.', $googlePath[0])[0]).$style;
$file = str_replace($replace, '', explode('.', $googlePath[0])[0]).$style;
$style = $style == 'regular' ? '400' : $style;
$css .= "@font-face {
font-family: '".$fontFamily."';
Expand All @@ -316,7 +321,7 @@ private function getGoogleFonts($googleFonts, $gooleFontsWeights, $baseDir): voi
}
}
if (!empty($css)) {
$cssFile = $baseDir.'Resources/Public/CSS/googlefonts.css';
$cssFile = $baseDir.'Resources/Public/T3SB-CSS/googlefonts.css';
if (file_exists($cssFile)) {
unlink($cssFile);
}
Expand All @@ -327,15 +332,17 @@ private function getGoogleFonts($googleFonts, $gooleFontsWeights, $baseDir): voi

private function getGoogleFontsSitepackage($googleFonts, $gooleFontsWeights, $baseDir): void
{
$localZipPath = $baseDir.'Resources/Public/CSS/googlefonts/';
$localZipPath = $baseDir.'Resources/Public/T3SB-CSS/googlefonts/';
if (is_dir($localZipPath)) {
parent::rmDir($localZipPath);
}
mkdir($localZipPath, 0777, true);
$googleFontsArr = explode(',', $googleFonts);

foreach ($googleFontsArr as $font) {
$fontFamily = trim($font);
$font = str_replace(' ', '-', trim($font));

foreach (explode(',', $gooleFontsWeights) as $style) {
$style = trim($style);
$zipFilename = strtolower($font).'?download=zip&subsets=latin&variants='.$style;
Expand All @@ -344,16 +351,23 @@ private function getGoogleFontsSitepackage($googleFonts, $gooleFontsWeights, $ba
$fontArr[$fontFamily] = self::getGoogleFiles($zipContent, $baseDir);
}
}

if (is_array($fontArr)) {
foreach ($fontArr as $fontFamily=>$googlePath) {
$sliceArr[$fontFamily] = array_slice($googlePath, 0, 1);
}
$css = '';
$headerData = '';

foreach ($sliceArr as $fontFamily=>$googlePath) {

$gp = explode('.', $googlePath[0]);
$gp = explode('-', $gp[0]);
$replace = end($gp);

foreach (explode(',', $gooleFontsWeights) as $i=>$style) {
$style = trim($style);
$file = str_replace('300', '', explode('.', $googlePath[0])[0]).$style;
$file = str_replace($replace, '', explode('.', $googlePath[0])[0]).$style;
$style = $style == 'regular' ? '400' : $style;
$googlefontsPath = 'googlefonts/';
$css .= "@font-face {
Expand All @@ -367,7 +381,7 @@ private function getGoogleFontsSitepackage($googleFonts, $gooleFontsWeights, $ba
}
}
if (!empty($css)) {
$cssFile = $baseDir.'Resources/Public/CSS/googlefonts.css';
$cssFile = $baseDir.'Resources/Public/T3SB-CSS/googlefonts.css';
if (file_exists($cssFile)) {
unlink($cssFile);
}
Expand All @@ -381,7 +395,7 @@ private function getGoogleFiles($zipContent, $baseDir='/'): array
{
$googleFileArr = [];
if ($zipContent) {
$localZipPath = $baseDir.'Resources/Public/CSS/googlefonts/';
$localZipPath = $baseDir.'Resources/Public/T3SB-CSS/googlefonts/';
$localZipFile = $localZipPath.'googlefont.zip';
GeneralUtility::writeFile($localZipFile, $zipContent);
$zip = new \ZipArchive();
Expand Down
6 changes: 3 additions & 3 deletions Classes/Command/CustomScss.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$baseDir = GeneralUtility::getFileAbsFileName('fileadmin/T3SB/');
} else {
if (ExtensionManagementUtility::isLoaded('t3sb_package')) {
$baseDir = GeneralUtility::getFileAbsFileName("EXT:t3sb_package/T3SB/");
$baseDir = GeneralUtility::getFileAbsFileName("EXT:t3sb_package/");
} else {
throw new \InvalidArgumentException('Your t3sb_package is not loaded!', 1657464787);
}
Expand All @@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

# Custom
$customPath = $baseDir.'Resources/Public/SCSS/';
$customPath = $baseDir.'Resources/Public/T3SB-SCSS/';

if (!is_dir($customPath)) {
mkdir($customPath, 0777, true);
Expand Down Expand Up @@ -139,7 +139,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
mkdir($includePath, 0777, true);
}

$customDir = $baseDir.'Resources/Public/SCSS/';
$customDir = $baseDir.'Resources/Public/T3SB-SCSS/';
if ($key === 0) {
$includeContent = '
@import "'.$customDir.'custom-variables";
Expand Down
Loading

0 comments on commit 047aff4

Please sign in to comment.