Skip to content

Commit

Permalink
Merge pull request #388 from t3solution/5.3.8
Browse files Browse the repository at this point in the history
New release v5.3.8
  • Loading branch information
t3solution authored Mar 30, 2024
2 parents 82d8c06 + 84bea90 commit 423a98f
Show file tree
Hide file tree
Showing 35 changed files with 876 additions and 1,086 deletions.
26 changes: 6 additions & 20 deletions Classes/Command/CdnToLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private function getGoogleFonts($googleFonts, $gooleFontsWeights, $baseDir): voi
$googleFontsArr = explode(',', $googleFonts);
foreach ($googleFontsArr as $font) {
$fontFamily = trim($font);
$font = str_replace(' ', '-', trim($font));
$font = str_replace(' ', '-', $fontFamily);
foreach (explode(',', $gooleFontsWeights) as $style) {
$style = trim($style);
$zipFilename = strtolower($font).'?download=zip&subsets=latin&variants='.$style;
Expand All @@ -310,13 +310,8 @@ private function getGoogleFonts($googleFonts, $gooleFontsWeights, $baseDir): voi
font-style: normal;
font-weight: ".$style.";
font-display: swap;
src: url('".$basePath."Resources/Public/CSS/googlefonts/".$file.".eot');
src: local(''),
url('googlefonts/".$file.".eot?#iefix') format('embedded-opentype'),
url('googlefonts/".$file.".woff2') format('woff2'),
url('googlefonts/".$file.".woff') format('woff');
url('googlefonts/".$file.".ttf') format('truetype'),
url('googlefonts/".$file.".svg#".trim(str_replace(' ', '', $fontFamily))."') format('svg');
src: url('googlefonts/".$file.".woff2') format('woff2'),
url('googlefonts/".$file.".ttf') format('truetype');
}".LF.LF;
}
}
Expand Down Expand Up @@ -349,14 +344,12 @@ 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) {
foreach (explode(',', $gooleFontsWeights) as $i=>$style) {
$style = trim($style);
Expand All @@ -368,13 +361,8 @@ private function getGoogleFontsSitepackage($googleFonts, $gooleFontsWeights, $ba
font-style: normal;
font-weight: ".$style.";
font-display: swap;
src: url('".$googlefontsPath.$file.".eot');
src: local(''),
url('".$googlefontsPath.$file.".eot?#iefix') format('embedded-opentype'),
url('".$googlefontsPath.$file.".woff2') format('woff2'),
url('".$googlefontsPath.$file.".woff') format('woff');
url('".$googlefontsPath.$file.".ttf') format('truetype'),
url('".$googlefontsPath.$file.".svg#".trim(str_replace(' ', '', $fontFamily))."') format('svg');
src: url('googlefonts/".$file.".woff2') format('woff2'),
url('googlefonts/".$file.".ttf') format('truetype');
}".LF.LF;
}
}
Expand All @@ -395,7 +383,6 @@ private function getGoogleFiles($zipContent, $baseDir='/'): array
if ($zipContent) {
$localZipPath = $baseDir.'Resources/Public/CSS/googlefonts/';
$localZipFile = $localZipPath.'googlefont.zip';

GeneralUtility::writeFile($localZipFile, $zipContent);
$zip = new \ZipArchive();
if ($zip->open($localZipFile) === true) {
Expand All @@ -409,9 +396,8 @@ private function getGoogleFiles($zipContent, $baseDir='/'): array
}
$googleFiles = scandir($localZipPath);
$css = '';

foreach ($googleFiles as $googleFile) {
if (str_ends_with($googleFile, 'woff')) {
if (str_ends_with($googleFile, 'ttf')) {
$googleFileArr[] = $googleFile;
}
}
Expand Down
5 changes: 3 additions & 2 deletions Classes/Command/CustomScss.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use TYPO3\CMS\Core\Http\RequestFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
Expand Down Expand Up @@ -101,7 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
->from('pages')
->where(
$queryBuilder->expr()->eq('sys_language_uid', 0),
$queryBuilder->expr()->eq('is_siteroot', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
$queryBuilder->expr()->eq('is_siteroot', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT))
)
->executeQuery();
$siteroots = $result->fetchAllAssociative();
Expand Down Expand Up @@ -301,7 +302,7 @@ public function getBootstrapFilesNoZip($settings, $bootstrapVersion, $customPath

# get the Boostrap SCSS-Files
if ($bootstrapVersion > '5.1.3') {
$scssList = '_accordion.scss, _alert.scss, _badge.scss, _breadcrumb.scss, _button-group.scss, _buttons.scss, _card.scss, _carousel.scss, _close.scss, _containers.scss, _dropdown.scss, _forms.scss, _functions.scss, _grid.scss, _helpers.scss, _images.scss, _list-group.scss, _maps.scss, _mixins.scss, _modal.scss, _nav.scss, _navbar.scss, _offcanvas.scss, _pagination.scss, _placeholders.scss, _popover.scss, _progress.scss, _reboot.scss, _root.scss, _spinners.scss, _tables.scss, _toasts.scss, _tooltip.scss, _transitions.scss, _type.scss, _utilities.scss, _variables.scss, bootstrap-grid.scss, bootstrap-reboot.scss, bootstrap-utilities.scss, bootstrap.scss';
$scssList = '_accordion.scss, _alert.scss, _badge.scss, _breadcrumb.scss, _button-group.scss, _buttons.scss, _card.scss, _carousel.scss, _close.scss, _containers.scss, _dropdown.scss, _forms.scss, _functions.scss, _grid.scss, _helpers.scss, _images.scss, _list-group.scss, _maps.scss, _mixins.scss, _modal.scss, _nav.scss, _navbar.scss, _offcanvas.scss, _pagination.scss, _placeholders.scss, _popover.scss, _progress.scss, _reboot.scss, _root.scss, _spinners.scss, _tables.scss, _toasts.scss, _tooltip.scss, _transitions.scss, _type.scss, _utilities.scss, _variables-dark.scss, _variables.scss, bootstrap-grid.scss, bootstrap-reboot.scss, bootstrap-utilities.scss, bootstrap.scss';
} else {
$scssList = '_accordion.scss, _alert.scss, _badge.scss, _breadcrumb.scss, _button-group.scss, _buttons.scss, _card.scss, _carousel.scss, _close.scss, _containers.scss, _dropdown.scss, _forms.scss, _functions.scss, _grid.scss, _helpers.scss, _images.scss, _list-group.scss, _mixins.scss, _modal.scss, _nav.scss, _navbar.scss, _offcanvas.scss, _pagination.scss, _placeholders.scss, _popover.scss, _progress.scss, _reboot.scss, _root.scss, _spinners.scss, _tables.scss, _toasts.scss, _tooltip.scss, _transitions.scss, _type.scss, _utilities.scss, _variables.scss, bootstrap-grid.scss, bootstrap-reboot.scss, bootstrap-utilities.scss, bootstrap.scss';
}
Expand Down
3 changes: 2 additions & 1 deletion Classes/Components/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace T3SBS\T3sbootstrap\Components;

use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Service\FlexFormService;
Expand Down Expand Up @@ -138,7 +139,7 @@ public function getProcessedData(array $processedData, array $flexconf, array $p
->select('listitem')
->from('tx_t3sbootstrap_list_item_inline')
->where(
$queryBuilder->expr()->eq('parentid', $queryBuilder->createNamedParameter($processedData['data']['uid'], \PDO::PARAM_INT))
$queryBuilder->expr()->eq('parentid', $queryBuilder->createNamedParameter($processedData['data']['uid'], Connection::PARAM_INT))
)
->executeQuery()
->fetchAllAssociative();
Expand Down
7 changes: 4 additions & 3 deletions Classes/Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use T3SBS\T3sbootstrap\Domain\Model\Config;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Core\Site\Entity\SiteInterface;
Expand Down Expand Up @@ -58,7 +59,7 @@ public function initializeAction(): void
->count('uid')
->from('sys_template')
->where(
$queryBuilder->expr()->eq('root', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
$queryBuilder->expr()->eq('root', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT))
)
->executeQuery()->fetchOne();
}
Expand All @@ -84,7 +85,7 @@ protected function getCustomScss(string $file): array
->from('pages')
->where(
$queryBuilder->expr()->eq('sys_language_uid', 0),
$queryBuilder->expr()->eq('is_siteroot', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
$queryBuilder->expr()->eq('is_siteroot', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT))
)
->executeQuery();

Expand Down Expand Up @@ -585,7 +586,7 @@ protected function getTreeList($id, $depth, $begin = 0, $permsClause = ''): stri
$statement = $queryBuilder->select('uid')
->from('pages')
->where(
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)),
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, Connection::PARAM_INT)),
$queryBuilder->expr()->eq('sys_language_uid', 0),
QueryHelper::stripLogicalOperatorPrefix($permsClause)
)
Expand Down
41 changes: 40 additions & 1 deletion Classes/DataProcessing/BootstrapProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,28 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$sectionMenuClass = $contentObjectConfiguration['settings.']['sectionMenuClass'];
}

if (!empty($contentObjectConfiguration['settings.']['shortcutsremove'])) {
$currentUid = (int) $GLOBALS['TSFE']->id;
$footerPid = !empty($processorConfiguration['footerPid']) ? (int) $processorConfiguration['footerPid'] : 0;
$removeArr = GeneralUtility::trimExplode(',', $contentObjectConfiguration['settings.']['shortcutsremove']);
if ($processedData['data']['pid'] !== $currentUid && $processedData['data']['pid'] !== $footerPid) {
// if contentByPid for collapsible_accordion or tabs_tab
foreach($removeArr as $remove) {
if (str_contains($processedData['data']['frame_class'], substr($remove,6))) {
$processedData['data']['frame_class'] = 'default';
}
}
}
if ($cType == 'shortcut' && !empty($parentCType)) {
// remove a class or any string from shortcuts if in parent ce/wrapper
foreach($removeArr as $remove) {
if (str_contains($processedData['shortcuts'], $remove)) {
$processedData['shortcuts'] = self::removeChar($processedData['shortcuts'], $remove);
}
}
}
}

// class
$classHelper = GeneralUtility::makeInstance(ClassHelper::class);
$class = $classHelper->getDefaultClass($processedData['data'], $flexconf, $extConf['cTypeClass'], $sectionMenuClass);
Expand Down Expand Up @@ -380,7 +402,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
* @param array $animationSettingsArray
* @return string
*/
private function generateAnimationAttributeSettingsFromAnimationsArray(array $animationSettingsArray)
private function generateAnimationAttributeSettingsFromAnimationsArray(array $animationSettingsArray): string
{
$animationSettings = '';

Expand All @@ -397,4 +419,21 @@ private function generateAnimationAttributeSettingsFromAnimationsArray(array $an
}
return ' '.$animationSettings;
}


/**
* @param string $s
* @param string $c
* @return string
*/
function removeChar(string $s, string $c): string
{
$s = str_replace($c, '', $s);
if (str_contains($s, $c)) {
self::removeChar($s, $c);
}
return $s;
}


}
9 changes: 5 additions & 4 deletions Classes/DataProcessing/ConfigProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
Expand Down Expand Up @@ -627,7 +628,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
->count('uid')
->from('tt_content')
->where(
$queryBuilder->expr()->eq('colPos', $queryBuilder->createNamedParameter(20, \PDO::PARAM_INT))
$queryBuilder->expr()->eq('colPos', $queryBuilder->createNamedParameter(20, Connection::PARAM_INT))
)
->executeQuery()
->fetchOne();
Expand All @@ -645,7 +646,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
->count('uid')
->from('tt_content')
->where(
$queryBuilder->expr()->eq('colPos', $queryBuilder->createNamedParameter(21, \PDO::PARAM_INT))
$queryBuilder->expr()->eq('colPos', $queryBuilder->createNamedParameter(21, Connection::PARAM_INT))
)
->executeQuery()
->fetchOne();
Expand Down Expand Up @@ -688,7 +689,7 @@ protected function getNavigationColor(int $languageUid): string
)
)
->andWhere(
$queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($languageUid, \PDO::PARAM_INT))
$queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($languageUid, Connection::PARAM_INT))
)
->executeQuery();

Expand Down Expand Up @@ -752,7 +753,7 @@ protected function getTreeList(int $id, int $depth, int $begin = 0, string $perm
$statement = $queryBuilder->select('uid')
->from('pages')
->where(
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)),
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, Connection::PARAM_INT)),
$queryBuilder->expr()->eq('sys_language_uid', 0),
QueryHelper::stripLogicalOperatorPrefix($permsClause)
)
Expand Down
3 changes: 2 additions & 1 deletion Classes/DataProcessing/GalleryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;
use TYPO3\CMS\Frontend\ContentObject\Exception\ContentRenderingException;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Service\FlexFormService;
use TYPO3\CMS\Core\Page\AssetCollector;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
Expand Down Expand Up @@ -791,7 +792,7 @@ protected function countContentRecord($uid, $table='tt_content', $equal='uid'):
->count('uid')
->from($table)
->where(
$queryBuilder->expr()->eq($equal, $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT))
$queryBuilder->expr()->eq($equal, $queryBuilder->createNamedParameter($uid, Connection::PARAM_INT))
)
->executeQuery()->fetchOne();

Expand Down
13 changes: 7 additions & 6 deletions Classes/DataProcessing/LastModifiedProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

Expand Down Expand Up @@ -74,8 +75,8 @@ protected function isMenuRecentlyUpdatedOnPage(): bool
->select('uid')
->from('tt_content')
->where(
$queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($sysLanguageUid, \PDO::PARAM_INT)),
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter(self::getCurrentUid(), \PDO::PARAM_INT)),
$queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($sysLanguageUid, Connection::PARAM_INT)),
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter(self::getCurrentUid(), Connection::PARAM_INT)),
$queryBuilder->expr()->eq('CType', $queryBuilder->createNamedParameter('menu_recently_updated'))
)
->executeQuery()
Expand All @@ -101,8 +102,8 @@ protected function getRecentlyUpdated($setMaxResults): array
->from('tt_content')
->orderBy('tstamp', 'DESC')
->where(
$queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($sysLanguageUid, \PDO::PARAM_INT)),
$queryBuilder->expr()->neq('pid', $queryBuilder->createNamedParameter(self::getCurrentUid(), \PDO::PARAM_INT))
$queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($sysLanguageUid, Connection::PARAM_INT)),
$queryBuilder->expr()->neq('pid', $queryBuilder->createNamedParameter(self::getCurrentUid(), Connection::PARAM_INT))
)
->setMaxResults($setMaxResults)
->executeQuery()
Expand Down Expand Up @@ -139,8 +140,8 @@ protected function getPageTitle($uid): string
->select('uid', 'title', 'nav_title')
->from('pages')
->where(
$queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)),
$queryBuilder->expr()->eq('doktype', $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT))
$queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, Connection::PARAM_INT)),
$queryBuilder->expr()->eq('doktype', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT))
)
->executeQuery()
->fetch();
Expand Down
Loading

0 comments on commit 423a98f

Please sign in to comment.