Fonts pluriel
This commit is contained in:
parent
63d02f358c
commit
8d8d35a540
@ -1100,8 +1100,8 @@ class layout extends common
|
|||||||
public function showFonts()
|
public function showFonts()
|
||||||
{
|
{
|
||||||
// Import des fontes liées au thème
|
// Import des fontes liées au thème
|
||||||
if (file_exists(self::DATA_DIR . 'fonts/font.html')) {
|
if (file_exists(self::DATA_DIR . 'font/font.html')) {
|
||||||
include_once(self::DATA_DIR . 'fonts/font.html');
|
include_once(self::DATA_DIR . 'font/font.html');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ class core extends common
|
|||||||
if (!is_dir(self::DATA_DIR . 'font')) {
|
if (!is_dir(self::DATA_DIR . 'font')) {
|
||||||
mkdir(self::DATA_DIR . 'font');
|
mkdir(self::DATA_DIR . 'font');
|
||||||
}
|
}
|
||||||
file_put_contents(self::DATA_DIR . 'fonts/font.html', $fontFile);
|
file_put_contents(self::DATA_DIR . 'font/font.html', $fontFile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fontes installées localement
|
* Fontes installées localement
|
||||||
@ -150,10 +150,10 @@ class core extends common
|
|||||||
foreach ($fonts as $fontId) {
|
foreach ($fonts as $fontId) {
|
||||||
// Validité du tableau :
|
// Validité du tableau :
|
||||||
if (isset($fontsAvailable['files'][$fontId])) {
|
if (isset($fontsAvailable['files'][$fontId])) {
|
||||||
if (file_exists(self::DATA_DIR . 'fonts/' . $fontId)) {
|
if (file_exists(self::DATA_DIR . 'font/' . $fontId)) {
|
||||||
// Chargement de la police
|
// Chargement de la police
|
||||||
$css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";';
|
$css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";';
|
||||||
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontsAvailable['files'][$fontId]['resource'] . '");}';
|
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'font/' . $fontsAvailable['files'][$fontId]['resource'] . '");}';
|
||||||
// Tableau pour la construction de la feuille de style
|
// Tableau pour la construction de la feuille de style
|
||||||
$fonts[$fontId] = $fontsAvailable['files'][$fontId]['font-family'];
|
$fonts[$fontId] = $fontsAvailable['files'][$fontId]['font-family'];
|
||||||
} else {
|
} else {
|
||||||
@ -322,7 +322,7 @@ class core extends common
|
|||||||
if (!is_dir(self::DATA_DIR . 'font')) {
|
if (!is_dir(self::DATA_DIR . 'font')) {
|
||||||
mkdir(self::DATA_DIR . 'font');
|
mkdir(self::DATA_DIR . 'font');
|
||||||
}
|
}
|
||||||
file_put_contents(self::DATA_DIR . 'fonts/font.html', $fontFile);
|
file_put_contents(self::DATA_DIR . 'font/font.html', $fontFile);
|
||||||
|
|
||||||
// Enregistre la personnalisation
|
// Enregistre la personnalisation
|
||||||
file_put_contents(self::DATA_DIR . 'theme.css', $css);
|
file_put_contents(self::DATA_DIR . 'theme.css', $css);
|
||||||
@ -380,7 +380,7 @@ class core extends common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Enregistre la personnalisation
|
// Enregistre la personnalisation
|
||||||
file_put_contents(self::DATA_DIR . 'fonts/font.html', $fontFile);
|
file_put_contents(self::DATA_DIR . 'font/font.html', $fontFile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fontes installées localement
|
* Fontes installées localement
|
||||||
@ -388,10 +388,10 @@ class core extends common
|
|||||||
foreach ($fonts as $fontId) {
|
foreach ($fonts as $fontId) {
|
||||||
// Validité du tableau :
|
// Validité du tableau :
|
||||||
if (isset($fontsAvailable['files'][$fontId])) {
|
if (isset($fontsAvailable['files'][$fontId])) {
|
||||||
if (file_exists(self::DATA_DIR . 'fonts/' . $fontId)) {
|
if (file_exists(self::DATA_DIR . 'font/' . $fontId)) {
|
||||||
// Chargement de la police
|
// Chargement de la police
|
||||||
$css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";';
|
$css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";';
|
||||||
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontsAvailable['files'][$fontId]['resource'] . '");}';
|
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'font/' . $fontsAvailable['files'][$fontId]['resource'] . '");}';
|
||||||
// Tableau pour la construction de la feuille de style
|
// Tableau pour la construction de la feuille de style
|
||||||
$fonts[$fontId] = $fontsAvailable['files'][$fontId]['font-family'];
|
$fonts[$fontId] = $fontsAvailable['files'][$fontId]['font-family'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -583,7 +583,7 @@ class theme extends common
|
|||||||
/**
|
/**
|
||||||
* Options des fontes
|
* Options des fontes
|
||||||
*/
|
*/
|
||||||
public function fonts()
|
public function font()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Toutes les fontes installées sont chargées
|
// Toutes les fontes installées sont chargées
|
||||||
@ -689,7 +689,7 @@ class theme extends common
|
|||||||
$type === 'files' &&
|
$type === 'files' &&
|
||||||
file_exists(self::FILE_DIR . 'source/' . $ressource)
|
file_exists(self::FILE_DIR . 'source/' . $ressource)
|
||||||
) {
|
) {
|
||||||
copy(self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource);
|
copy(self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'font/' . $ressource);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
@ -752,7 +752,7 @@ class theme extends common
|
|||||||
$type === 'files' &&
|
$type === 'files' &&
|
||||||
file_exists(self::FILE_DIR . 'source/' . $ressource)
|
file_exists(self::FILE_DIR . 'source/' . $ressource)
|
||||||
) {
|
) {
|
||||||
copy(self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource);
|
copy(self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'font/' . $ressource);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
@ -979,7 +979,7 @@ class theme extends common
|
|||||||
|
|
||||||
// Substitution des fontes Google
|
// Substitution des fontes Google
|
||||||
if ($modele = 'theme') {
|
if ($modele = 'theme') {
|
||||||
$c = $this->subFonts(self::DATA_DIR . 'theme.json');
|
$c = $this->subFont(self::DATA_DIR . 'theme.json');
|
||||||
// Un remplacement nécessite la régénération de la feuille de style
|
// Un remplacement nécessite la régénération de la feuille de style
|
||||||
if (
|
if (
|
||||||
$c > 0
|
$c > 0
|
||||||
@ -989,7 +989,7 @@ class theme extends common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($modele = 'admin') {
|
if ($modele = 'admin') {
|
||||||
$c = $this->subFonts(self::DATA_DIR . 'admin.json');
|
$c = $this->subFont(self::DATA_DIR . 'admin.json');
|
||||||
// Un remplacement nécessite la régénération de la feuille de style
|
// Un remplacement nécessite la régénération de la feuille de style
|
||||||
if (
|
if (
|
||||||
$c > 0
|
$c > 0
|
||||||
@ -1081,11 +1081,11 @@ class theme extends common
|
|||||||
$zip->addEmptyDir(self::DATA_DIR . 'font');
|
$zip->addEmptyDir(self::DATA_DIR . 'font');
|
||||||
$fonts = $this->getData(['font', 'files']);
|
$fonts = $this->getData(['font', 'files']);
|
||||||
foreach ($fonts as $fontId => $fontName) {
|
foreach ($fonts as $fontId => $fontName) {
|
||||||
$zip->addFile(self::DATA_DIR . 'fonts/' . $fontName, self::DATA_DIR . 'fonts/' . $fontName);
|
$zip->addFile(self::DATA_DIR . 'font/' . $fontName, self::DATA_DIR . 'font/' . $fontName);
|
||||||
}
|
}
|
||||||
if (file_exists(self::DATA_DIR . 'fonts/font.html')) {
|
if (file_exists(self::DATA_DIR . 'font/font.html')) {
|
||||||
|
|
||||||
$zip->addFile(self::DATA_DIR . 'fonts/font.html', self::DATA_DIR . 'fonts/font.html');
|
$zip->addFile(self::DATA_DIR . 'font/font.html', self::DATA_DIR . 'font/font.html');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'theme':
|
case 'theme':
|
||||||
@ -1119,11 +1119,11 @@ class theme extends common
|
|||||||
$zip->addEmptyDir(self::DATA_DIR . 'font');
|
$zip->addEmptyDir(self::DATA_DIR . 'font');
|
||||||
$fonts = $this->getData(['font', 'files']);
|
$fonts = $this->getData(['font', 'files']);
|
||||||
foreach ($fonts as $fontId => $fontName) {
|
foreach ($fonts as $fontId => $fontName) {
|
||||||
$zip->addFile(self::DATA_DIR . 'fonts/' . $fontName, self::DATA_DIR . 'fonts/' . $fontName);
|
$zip->addFile(self::DATA_DIR . 'font/' . $fontName, self::DATA_DIR . 'font/' . $fontName);
|
||||||
}
|
}
|
||||||
if (file_exists(self::DATA_DIR . 'fonts/font.html')) {
|
if (file_exists(self::DATA_DIR . 'font/font.html')) {
|
||||||
|
|
||||||
$zip->addFile(self::DATA_DIR . 'fonts/font.html', self::DATA_DIR . 'fonts/font.html');
|
$zip->addFile(self::DATA_DIR . 'font/font.html', self::DATA_DIR . 'font/font.html');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1138,7 +1138,7 @@ class theme extends common
|
|||||||
* @param string $file, nom du fichier json à convertir
|
* @param string $file, nom du fichier json à convertir
|
||||||
* @return int nombre de substitution effectuées
|
* @return int nombre de substitution effectuées
|
||||||
*/
|
*/
|
||||||
private function subFonts($file)
|
private function subFont($file)
|
||||||
{
|
{
|
||||||
// Tableau de substitution des fontes
|
// Tableau de substitution des fontes
|
||||||
$fonts = [
|
$fonts = [
|
||||||
@ -1271,24 +1271,24 @@ class theme extends common
|
|||||||
($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 . 'font/' . $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 . 'font/' . $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 . 'font/' . $fontValue['resource'] . '" type="font/woff" crossorigin="anonymous" as="font">' . $fileContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enregistre la personnalisation
|
// Enregistre la personnalisation
|
||||||
file_put_contents(self::DATA_DIR . 'fonts/font.html', $fileContent);
|
file_put_contents(self::DATA_DIR . 'font/font.html', $fileContent);
|
||||||
// Enregistre la personnalisation
|
// Enregistre la personnalisation
|
||||||
file_put_contents(self::DATA_DIR . 'fonts/fonts.css', $fileContentCss);
|
file_put_contents(self::DATA_DIR . 'font/font.css', $fileContentCss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<div class="col2 offset4">
|
<div class="col2 offset4">
|
||||||
<?php echo template::button('themeFonts', [
|
<?php echo template::button('themeFonts', [
|
||||||
'ico' => 'font',
|
'ico' => 'font',
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/fonts',
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/font',
|
||||||
'value' => 'Fontes'
|
'value' => 'Fontes'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
@ -68,7 +68,7 @@
|
|||||||
<div class="col2 offset4">
|
<div class="col2 offset4">
|
||||||
<?php echo template::button('themeFonts', [
|
<?php echo template::button('themeFonts', [
|
||||||
'ico' => 'font',
|
'ico' => 'font',
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/fonts',
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/font',
|
||||||
'value' => 'Fontes'
|
'value' => 'Fontes'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -184,13 +184,8 @@ class translate extends common
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Langues disponibles avec la mise à jour
|
// Langues disponibles avec la mise à jour
|
||||||
$store = json_decode(file_get_contents('core/module/install/ressource/i18n/language.json'), true);
|
$store = $this->getData(['language']);
|
||||||
if (array_key_exists('languages', $store )) {
|
|
||||||
$store = $store['languages'];
|
|
||||||
}
|
|
||||||
if (array_key_exists('language', $store )) {
|
|
||||||
$store = $store['language'];
|
|
||||||
}
|
|
||||||
if ($installedUI) {
|
if ($installedUI) {
|
||||||
foreach($installedUI as $key => $value) {
|
foreach($installedUI as $key => $value) {
|
||||||
if (isset($store[$key]) && $store[$key]['version'] > $value['version']) {
|
if (isset($store[$key]) && $store[$key]['version'] > $value['version']) {
|
||||||
|
Loading…
Reference in New Issue
Block a user