11505 bug catégorie de fonte vide + warning sur variable non initialisée
This commit is contained in:
parent
50bff9081d
commit
5195d970d2
@ -432,6 +432,7 @@ class theme extends common {
|
|||||||
/**
|
/**
|
||||||
* Stocker les images incluses dans la bannière perso dans un tableau
|
* Stocker les images incluses dans la bannière perso dans un tableau
|
||||||
*/
|
*/
|
||||||
|
$files = [];
|
||||||
preg_match_all('/<img[^>]+>/i',$featureContent, $results);
|
preg_match_all('/<img[^>]+>/i',$featureContent, $results);
|
||||||
foreach($results[0] as $value) {
|
foreach($results[0] as $value) {
|
||||||
// Lire le contenu XML
|
// Lire le contenu XML
|
||||||
@ -462,7 +463,7 @@ class theme extends common {
|
|||||||
'tinyHidden' => $this->getInput('themeHeaderTinyHidden', helper::FILTER_BOOLEAN),
|
'tinyHidden' => $this->getInput('themeHeaderTinyHidden', helper::FILTER_BOOLEAN),
|
||||||
'feature' => $this->getInput('themeHeaderFeature'),
|
'feature' => $this->getInput('themeHeaderFeature'),
|
||||||
'featureContent' => $featureContent,
|
'featureContent' => $featureContent,
|
||||||
'featureFiles' => $files
|
'featureFiles' => $files
|
||||||
]]);
|
]]);
|
||||||
// Modification de la position du menu selon la position de la bannière
|
// Modification de la position du menu selon la position de la bannière
|
||||||
if ( $this->getData(['theme','header','position']) == 'site' )
|
if ( $this->getData(['theme','header','position']) == 'site' )
|
||||||
@ -1190,21 +1191,20 @@ class theme extends common {
|
|||||||
*/
|
*/
|
||||||
$gf = false;
|
$gf = false;
|
||||||
$fileContent = '<!-- Fontes personnalisées -->';
|
$fileContent = '<!-- Fontes personnalisées -->';
|
||||||
//if ( is_array($this->getData(['fonts', 'imported'])) &&
|
if ( !empty($this->getData(['fonts', 'imported'])) ) {
|
||||||
// !empty($this->getData(['fonts', 'imported'])) ) {
|
foreach ($this->getData(['fonts', 'imported']) as $fontId => $fontValue) {
|
||||||
foreach ($this->getData(['fonts', 'imported']) as $fontId => $fontValue) {
|
if (
|
||||||
if (
|
( $scope === 'user' && in_array($fontId, $fontsInstalled) )
|
||||||
( $scope === 'user' && in_array($fontId, $fontsInstalled) )
|
|| $scope === 'all'
|
||||||
|| $scope === 'all'
|
) {
|
||||||
) {
|
//Pré chargement à revoir
|
||||||
//Pré chargement à revoir
|
//$fileContent .= '<link rel="preload" href="' . $fontValue['resource'] . '" crossorigin="anonymous" as="style">';
|
||||||
//$fileContent .= '<link rel="preload" href="' . $fontValue['resource'] . '" crossorigin="anonymous" as="style">';
|
$fileContent .= '<link href="' . $fontValue['resource'] .'" rel="stylesheet">';
|
||||||
$fileContent .= '<link href="' . $fontValue['resource'] .'" rel="stylesheet">';
|
// Pré connect pour api.google
|
||||||
// Pré connect pour api.google
|
$gf = strpos($fontValue['resource'], 'fonts.googleapis.com') === false ? $gf || false : $gf || true;
|
||||||
$gf = strpos($fontValue['resource'], 'fonts.googleapis.com') === false ? $gf || false : $gf || true;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
// Ajoute le préconnect des fontes Googles.
|
// Ajoute le préconnect des fontes Googles.
|
||||||
$fileContent = $gf ? '<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>' . $fileContent
|
$fileContent = $gf ? '<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>' . $fileContent
|
||||||
@ -1216,27 +1216,26 @@ class theme extends common {
|
|||||||
* Fontes installées localement
|
* Fontes installées localement
|
||||||
*/
|
*/
|
||||||
$fileContentCss = '';
|
$fileContentCss = '';
|
||||||
//if ( is_array($this->getData(['fonts', 'files'])) &&
|
if ( !empty($this->getData(['fonts', 'files'])) ) {
|
||||||
// !empty($this->getData(['fonts', 'files'])) ) {
|
foreach ($this->getData(['fonts', 'files']) as $fontId => $fontValue) {
|
||||||
foreach ($this->getData(['fonts', 'files']) as $fontId => $fontValue) {
|
if (
|
||||||
if (
|
|
||||||
( $scope === 'user' && in_array($fontId, $fontsInstalled) )
|
( $scope === 'user' && in_array($fontId, $fontsInstalled) )
|
||||||
|| $scope === 'all'
|
|| $scope === 'all'
|
||||||
) {
|
) {
|
||||||
if (file_exists(self::DATA_DIR . 'fonts/' . $fontValue['resource']) ) {
|
if (file_exists(self::DATA_DIR . 'fonts/' . $fontValue['resource']) ) {
|
||||||
// Extension
|
// Extension
|
||||||
$path_parts = pathinfo(helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontValue['resource']);
|
$path_parts = pathinfo(helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontValue['resource']);
|
||||||
// Chargement de la police
|
// Chargement de la police
|
||||||
$fileContentCss .= '@font-face {' ;
|
$fileContentCss .= '@font-face {' ;
|
||||||
$fileContentCss .= 'font-family:"' . $fontValue['name'] . '";';
|
$fileContentCss .= 'font-family:"' . $fontValue['name'] . '";';
|
||||||
$fileContentCss .= 'src: url("' . $fontValue['resource'] . '") format("' . $path_parts['extension'] . '");';
|
$fileContentCss .= 'src: url("' . $fontValue['resource'] . '") format("' . $path_parts['extension'] . '");';
|
||||||
$fileContentCss .= '}' ;
|
$fileContentCss .= '}' ;
|
||||||
// Préchargement
|
// Préchargement
|
||||||
//$fileContent = '<link rel="preload" href="' . self::DATA_DIR . 'fonts/' . $fontValue['resource'] . '" type="font/woff" crossorigin="anonymous" as="font">' . $fileContent;
|
//$fileContent = '<link rel="preload" href="' . self::DATA_DIR . 'fonts/' . $fontValue['resource'] . '" type="font/woff" crossorigin="anonymous" as="font">' . $fileContent;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
// Enregistre la personnalisation
|
// Enregistre la personnalisation
|
||||||
file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fileContent);
|
file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fileContent);
|
||||||
|
Loading…
Reference in New Issue
Block a user