Skip to content

Commit a03e844

Browse files
authored
Merge pull request #453 from t3solution/5.3.23
See release notes at https://www.t3sbootstrap.de/log
2 parents deda2ff + d549d1f commit a03e844

File tree

114 files changed

+1618
-1094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1618
-1094
lines changed

Classes/Backend/FormDataProvider/FlexFormManipulation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function addData(array $result): array
8484
&& $name['config']['type'] === 'select'
8585
&& substr($field, 0, -1) === $key) {
8686
$addArr = ['label' => trim($add), 'value' => lcfirst(GeneralUtility::underscoredToUpperCamelCase(trim($add)))];
87-
array_push($dataStructure['sheets'][$sheetName]['ROOT']['el'][$key]['config']['items'], $addArr);
87+
$dataStructure['sheets'][$sheetName]['ROOT']['el'][$key]['config']['items'][] = $addArr;
8888
}
8989
}
9090
}

Classes/Command/CdnToLocal.php

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use TYPO3\CMS\Core\Utility\GeneralUtility;
1111
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
1212
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
13-
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
1413
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
1514
use TYPO3\CMS\Core\Http\RequestFactory;
1615

@@ -59,14 +58,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5958

6059
if (!empty($settings['cdn']['googlefonts']) && empty($settings['cdn']['noZip'])) {
6160
if (empty($settings['sitepackage'])) {
62-
self::getGoogleFonts($settings['cdn']['googlefonts'], $settings['gooleFontsWeights'], $baseDir);
61+
$this->getGoogleFonts($settings['cdn']['googlefonts'], $settings['gooleFontsWeights'], $baseDir);
6362
} else {
64-
self::getGoogleFontsSitepackage($settings['cdn']['googlefonts'], $settings['gooleFontsWeights'], $baseDir);
63+
$this->getGoogleFontsSitepackage($settings['cdn']['googlefonts'], $settings['gooleFontsWeights'], $baseDir);
6564
}
6665
} else {
6766
$localZipPath = $baseDir.'Resources/Public/T3SB-CSS/googlefonts/';
6867
if (is_dir($localZipPath)) {
69-
parent::rmDir($localZipPath);
68+
$this->rmDir($localZipPath);
7069
}
7170
$cssFile = $baseDir.'Resources/Public/T3SB-CSS/googlefonts.css';
7271
if (file_exists($cssFile)) {
@@ -75,130 +74,130 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7574
}
7675

7776
foreach ($settings['cdn'] as $key=>$version) {
78-
if ($key == 'jquery') {
77+
if ($key === 'jquery') {
7978
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
8079
$customFileName = 'jquery.min.js';
8180
$cdnPath = 'https://code.jquery.com/jquery-'.$version.'.min.js';
82-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
81+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
8382
}
8483

85-
if ($key == 'bootstrap') {
84+
if ($key === 'bootstrap') {
8685
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
8786
$customFileName = 'bootstrap.min.css';
8887
if ($settings['cdn']['bootswatch']) {
8988
$bootswatchTheme = $settings['cdn']['bootswatch'];
9089
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootswatch@'.$version.'/dist/'.$bootswatchTheme.'/'.$customFileName;
91-
self::writeCustomFile($customPath, $customFileName, $cdnPath, true);
90+
$this->writeCustomFile($customPath, $customFileName, $cdnPath, true);
9291
} else {
9392
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootstrap@'.$version.'/dist/css/'.$customFileName;
94-
self::writeCustomFile($customPath, $customFileName, $cdnPath, true);
93+
$this->writeCustomFile($customPath, $customFileName, $cdnPath, true);
9594
}
9695

9796
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
9897
$customFileName = 'bootstrap.min.js';
9998
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootstrap@'.$version.'/dist/js/'.$customFileName;
100-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
99+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
101100
$customFileName = 'bootstrap.bundle.min.js';
102101
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootstrap@'.$version.'/dist/js/'.$customFileName;
103-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
102+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
104103
}
105104

106-
if ($key == 'popperjs') {
105+
if ($key === 'popperjs') {
107106
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
108107
$customFileName = 'popper.js';
109108
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/'.$version.'/umd/popper.min.js';
110-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
109+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
111110
}
112111

113-
if ($key == 'jqueryEasing') {
112+
if ($key === 'jqueryEasing') {
114113
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
115114
$customFileName = 'jquery.easing.min.js';
116115
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/'.$version.'/'.$customFileName;
117-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
116+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
118117
}
119118

120-
if ($key == 'lazyload') {
119+
if ($key === 'lazyload') {
121120
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
122121
$customFileName = 'lazyload.min.js';
123122
$cdnPath = 'https://cdn.jsdelivr.net/npm/vanilla-lazyload@'.$version.'/dist/'.$customFileName;
124-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
123+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
125124
}
126125

127-
if ($key == 'picturefill') {
126+
if ($key === 'picturefill') {
128127
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
129128
$customFileName = 'picturefill.min.js';
130129
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/picturefill/'.$version.'/'.$customFileName;
131-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
130+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
132131
}
133132

134-
if ($key == 'animate') {
133+
if ($key === 'animate') {
135134
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
136135
$customFileName = 'animate.compat.css';
137136
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/'.$version.'/'.$customFileName;
138-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
137+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
139138
}
140139

141-
if ($key == 'baguetteBox') {
140+
if ($key === 'baguetteBox') {
142141
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
143142
$customFileName = 'baguetteBox.min.css';
144143
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/'.$version.'/'.$customFileName;
145-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
144+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
146145

147146
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
148147
$customFileName = 'baguetteBox.min.js';
149148
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/'.$version.'/'.$customFileName;
150-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
149+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
151150
}
152-
if ($key == 'halkabox') {
151+
if ($key === 'halkabox') {
153152
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
154153
$customFileName = 'halkaBox.min.css';
155154
$cdnPath = 'https://cdn.jsdelivr.net/npm/halkabox@'.$version.'/dist/'.$customFileName;
156-
self::writeCustomFile($customPath, $customFileName, $cdnPath, true);
155+
$this->writeCustomFile($customPath, $customFileName, $cdnPath, true);
157156

158157
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
159158
$customFileName = 'halkaBox.min.js';
160159
$cdnPath = 'https://cdn.jsdelivr.net/npm/halkabox@'.$version.'/dist/'.$customFileName;
161-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
160+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
162161
}
163162

164-
if ($key == 'glightbox') {
163+
if ($key === 'glightbox') {
165164
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
166165
$customFileName = 'glightbox.min.css';
167166
$cdnPath = 'https://cdn.jsdelivr.net/npm/glightbox@'.$version.'/dist/css/'.$customFileName;
168-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
167+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
169168

170169
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
171170
$customFileName = 'glightbox.min.js';
172171
$cdnPath = 'https://cdn.jsdelivr.net/npm/glightbox@'.$version.'/dist/js/'.$customFileName;
173-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
172+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
174173
}
175174

176-
if ($key == 'masonry') {
175+
if ($key === 'masonry') {
177176
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
178177
$customFileName = 'masonry.pkgd.min.js';
179178
$cdnPath = 'https://cdnjs.cloudflare.com/ajax/libs/masonry/'.$version.'/'.$customFileName;
180-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
179+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
181180
}
182181

183-
if ($key == 'jarallax') {
182+
if ($key === 'jarallax') {
184183
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
185184
$customFileName = 'jarallax.min.js';
186185
$cdnPath = 'https://unpkg.com/jarallax@'.$version.'/dist/'.$customFileName;
187-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
186+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
188187
$customFileName = 'jarallax-video.min.js';
189188
$cdnPath = 'https://unpkg.com/jarallax@'.$version.'/dist/'.$customFileName;
190-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
189+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
191190
}
192191

193-
if ($key == 'swiper') {
192+
if ($key === 'swiper') {
194193
$customPath = $baseDir.'Resources/Public/T3SB-CSS/';
195194
$customFileName = 'swiper-bundle.min.css';
196195
$cdnPath = 'https://unpkg.com/swiper@'.$version.'/'.$customFileName;
197-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
196+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
198197
$customPath = $baseDir.'Resources/Public/T3SB-JS/';
199198
$customFileName = 'swiper-bundle.min.js';
200199
$cdnPath = 'https://unpkg.com/swiper@'.$version.'/'.$customFileName;
201-
self::writeCustomFile($customPath, $customFileName, $cdnPath);
200+
$this->writeCustomFile($customPath, $customFileName, $cdnPath);
202201
}
203202
}
204203

@@ -222,7 +221,9 @@ private function writeCustomFile($customPath, $customFileName, $cdnPath, $extend
222221
unlink($customFile);
223222
}
224223
if (!is_dir($customPath)) {
225-
mkdir($customPath, 0777, true);
224+
if (!mkdir($customPath, 0777, true) && !is_dir($customPath)) {
225+
throw new \RuntimeException(sprintf('Directory "%s" was not created', $customPath));
226+
}
226227
}
227228

228229
GeneralUtility::writeFile($customFile, $customContent);
@@ -235,7 +236,9 @@ private function getGoogleFonts($googleFonts, $gooleFontsWeights, $baseDir): voi
235236
if (is_dir($localZipPath)) {
236237
parent::rmDir($localZipPath);
237238
}
238-
mkdir($localZipPath, 0777, true);
239+
if (!mkdir($localZipPath, 0777, true) && !is_dir($localZipPath)) {
240+
throw new \RuntimeException(sprintf('Directory "%s" was not created', $localZipPath));
241+
}
239242
$googleFontsArr = explode(',', $googleFonts);
240243
foreach ($googleFontsArr as $font) {
241244
$fontFamily = trim($font);
@@ -245,7 +248,7 @@ private function getGoogleFonts($googleFonts, $gooleFontsWeights, $baseDir): voi
245248
$zipFilename = strtolower($font).'?download=zip&subsets=latin&variants='.$style;
246249
$zipFilePath = 'https://gwfh.mranftl.com/api/fonts/';
247250
$zipContent = GeneralUtility::makeInstance(RequestFactory::class)->request($zipFilePath . $zipFilename)->getBody()->getContents();
248-
$fontArr[$fontFamily] = self::getGoogleFiles($zipContent, $baseDir);
251+
$fontArr[$fontFamily] = $this->getGoogleFiles($zipContent, $baseDir);
249252
}
250253
}
251254

@@ -265,7 +268,7 @@ private function getGoogleFonts($googleFonts, $gooleFontsWeights, $baseDir): voi
265268
foreach (explode(',', $gooleFontsWeights) as $i=>$style) {
266269
$style = trim($style);
267270
$file = str_replace($replace, '', explode('.', $googlePath[0])[0]).$style;
268-
$style = $style == 'regular' ? '400' : $style;
271+
$style = $style === 'regular' ? '400' : $style;
269272
$css .= "@font-face {
270273
font-family: '".$fontFamily."';
271274
font-style: normal;
@@ -292,7 +295,9 @@ private function getGoogleFontsSitepackage($googleFonts, $gooleFontsWeights, $ba
292295
if (is_dir($localZipPath)) {
293296
parent::rmDir($localZipPath);
294297
}
295-
mkdir($localZipPath, 0777, true);
298+
if (!mkdir($localZipPath, 0777, true) && !is_dir($localZipPath)) {
299+
throw new \RuntimeException(sprintf('Directory "%s" was not created', $localZipPath));
300+
}
296301
$googleFontsArr = explode(',', $googleFonts);
297302

298303
foreach ($googleFontsArr as $font) {
@@ -304,7 +309,7 @@ private function getGoogleFontsSitepackage($googleFonts, $gooleFontsWeights, $ba
304309
$zipFilename = strtolower($font).'?download=zip&subsets=latin&variants='.$style;
305310
$zipFilePath = 'https://gwfh.mranftl.com/api/fonts/';
306311
$zipContent = GeneralUtility::makeInstance(RequestFactory::class)->request($zipFilePath . $zipFilename)->getBody()->getContents();
307-
$fontArr[$fontFamily] = self::getGoogleFiles($zipContent, $baseDir);
312+
$fontArr[$fontFamily] = $this->getGoogleFiles($zipContent, $baseDir);
308313
}
309314
}
310315

@@ -324,7 +329,7 @@ private function getGoogleFontsSitepackage($googleFonts, $gooleFontsWeights, $ba
324329
foreach (explode(',', $gooleFontsWeights) as $i=>$style) {
325330
$style = trim($style);
326331
$file = str_replace($replace, '', explode('.', $googlePath[0])[0]).$style;
327-
$style = $style == 'regular' ? '400' : $style;
332+
$style = $style === 'regular' ? '400' : $style;
328333
$googlefontsPath = 'googlefonts/';
329334
$css .= "@font-face {
330335
font-family: '".$fontFamily."';
@@ -385,7 +390,7 @@ private function generateRandomString($length = 4): string
385390
$charactersLength = strlen($characters);
386391
$randomString = '';
387392
for ($i = 0; $i < $length; $i++) {
388-
$randomString .= $characters[rand(0, $charactersLength - 1)];
393+
$randomString .= $characters[random_int(0, $charactersLength - 1)];
389394
}
390395
return $randomString;
391396
}

Classes/Command/CommandBase.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,26 @@ public function rmDir(string $path): int
2727
return -2;
2828
}
2929
while ($entry = @readdir($dir)) {
30-
if ($entry == '.' || $entry == '..') continue;
30+
if ($entry === '.' || $entry === '..') continue;
3131
if (is_dir ($path.'/'.$entry)) {
3232
$res = self::rmDir ($path.'/'.$entry);
3333
if ($res == -1) {
3434
@closedir ($dir);
3535
return -2;
36-
} else if ($res == -2) {
37-
@closedir ($dir);
38-
return -2;
39-
} else if ($res == -3) {
40-
@closedir ($dir);
41-
return -3;
42-
} else if ($res != 0) {
43-
@closedir ($dir);
44-
return -2;
4536
}
46-
} else if (is_file ($path.'/'.$entry) || is_link ($path.'/'.$entry)) {
37+
if ($res == -2) {
38+
@closedir ($dir);
39+
return -2;
40+
}
41+
if ($res == -3) {
42+
@closedir ($dir);
43+
return -3;
44+
}
45+
if ($res != 0) {
46+
@closedir ($dir);
47+
return -2;
48+
}
49+
} else if (is_file ($path.'/'.$entry) || is_link ($path.'/'.$entry)) {
4750
$res = @unlink ($path.'/'.$entry);
4851
if (!$res) {
4952
@closedir ($dir);

0 commit comments

Comments
 (0)