Browse Source

Fontes locales okay + boutons petits dans le thème

12_dev
Fred Tempez 3 months ago
parent
commit
3d4be63df8
  1. 8
      core/core.php
  2. 12
      core/module/theme/theme.php
  3. 12
      core/module/theme/view/fontAdd/fontAdd.php
  4. 12
      core/module/theme/view/fontEdit/fontEdit.php
  5. 12
      core/module/theme/view/fonts/fonts.php

8
core/core.php

@ -189,11 +189,6 @@ class common {
'font-family' => 'Arial, Helvetica, sans-serif',
'resource' => 'websafe'
],
'arial-black' => [
'name' => 'Arial Black',
'font-family' => '\'Arial Black\', Gadget, sans-serif',
'resource' => 'websafe'
],
'arvo'=> [
'name' => 'Arvo',
'font-family' => 'Arvo, sans-serif',
@ -2178,6 +2173,9 @@ class common {
if ( file_exists(self::DATA_DIR . 'fonts/fonts.html') ){
include_once(self::DATA_DIR . 'fonts/fonts.html');
}
if ( file_exists(self::DATA_DIR . 'fonts/fonts.css') ){
echo '<link rel="stylesheet" href="' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/fonts.css?' . md5_file(self::DATA_DIR .'fonts/fonts.css') . '">';
}
}
/**

12
core/module/theme/theme.php

@ -1189,12 +1189,14 @@ class theme extends common {
* Chargement des polices en ligne dans un fichier fonts.html inclus dans main.php
*/
$gf = false;
$fileContent = '<!-- Fontes locales --><link rel="stylesheet" href="' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/fonts.css" /><!-- Fontes en ligne -->';
$fileContent = '<!-- Fontes personnalisées -->';
foreach ($this->getData(['fonts', 'imported']) as $fontId => $fontValue) {
if (
( $scope === 'user' && in_array($fontId, $fontsInstalled) )
|| $scope === 'all'
) {
//Pré chargement à revoir
//$fileContent .= '<link rel="preload" href="' . $fontValue['resource'] . '" crossorigin="anonymous" as="style">';
$fileContent .= '<link href="' . $fontValue['resource'] .'" rel="stylesheet">';
// Pré connect pour api.google
$gf = strpos($fontValue['resource'], 'fonts.googleapis.com') === false ? $gf || false : $gf || true;
@ -1217,13 +1219,15 @@ class theme extends common {
|| $scope === 'all'
) {
if (file_exists(self::DATA_DIR . 'fonts/' . $fontValue['resource']) ) {
// Extension
$path_parts = pathinfo(helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontValue['resource']);
// Chargement de la police
$fileContentCss .= '@font-face {' ;
$fileContentCss .= 'font-family:"' . $fontValue['font-family'] . '";';
$fileContentCss .= 'src: local("' . $fontValue['name'] . '"), url("' . $fontValue['resource'] . '") format("woff");';
$fileContentCss .= 'font-family:"' . $fontId . '";';
$fileContentCss .= 'src: url("' . $fontValue['resource'] . '") format("' . $path_parts['extension'] . '");';
$fileContentCss .= '}' ;
// Préchargement
$fileContent = '<link rel="preload" as="font" href="' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontValue['resource'] . '" type="font/woff" crossorigin="anonymous">' . $fileContent;
//$fileContent = '<link rel="preload" href="' . self::DATA_DIR . 'fonts/' . $fontValue['resource'] . '" type="font/woff" crossorigin="anonymous" as="font">' . $fileContent;
}
}
}

12
core/module/theme/view/fontAdd/fontAdd.php

@ -1,23 +1,21 @@
<?php echo template::formOpen('fontAddForm'); ?>
<div class="row">
<div class="col2">
<div class="col1">
<?php echo template::button('fontAddBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'theme/fonts',
'ico' => 'left',
'value' => 'Retour'
'value' => template::ico('left')
]); ?>
</div>
<div class="col2">
<div class="col1">
<?php echo template::button('fontAddHelp', [
'href' => 'https://doc.zwiicms.fr/fontes#add',
'target' => '_blank',
'ico' => 'help',
'value' => 'Aide',
'value' => template::ico('help'),
'class' => 'buttonHelp'
]); ?>
</div>
<div class="col2 offset6">
<div class="col2 offset8">
<?php echo template::submit('fontAddPublish', [
'value' => 'Valider',
'uniqueSubmission' => true

12
core/module/theme/view/fontEdit/fontEdit.php

@ -1,23 +1,21 @@
<?php echo template::formOpen('fontEditForm'); ?>
<div class="row">
<div class="col2">
<div class="col1">
<?php echo template::button('fontEditBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'theme/fonts',
'ico' => 'left',
'value' => 'Retour'
'value' => template::ico('left')
]); ?>
</div>
<div class="col2">
<div class="col1">
<?php echo template::button('fontEditHelp', [
'href' => 'https://doc.zwiicms.fr/fontes#add',
'target' => '_blank',
'ico' => 'help',
'value' => 'Aide',
'value' => template::ico('help'),
'class' => 'buttonHelp'
]); ?>
</div>
<div class="col2 offset6">
<div class="col2 offset8">
<?php echo template::submit('fontEditPublish', [
'value' => 'Valider',
'uniqueSubmission' => true

12
core/module/theme/view/fonts/fonts.php

@ -1,22 +1,20 @@
<div class="row">
<div class="col2">
<div class="col1">
<?php echo template::button('themeFontBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'theme',
'ico' => 'left',
'value' => 'Retour'
'value' => template::ico('left')
]); ?>
</div>
<div class="col2">
<div class="col1">
<?php echo template::button('pageEditHelp', [
'href' => 'https://doc.zwiicms.fr/fontes',
'target' => '_blank',
'ico' => 'help',
'value' => 'Aide',
'value' => template::ico('help'),
'class' => 'buttonHelp'
]); ?>
</div>
<div class="col2 offset6">
<div class="col2 offset8">
<?php echo template::button('themeFontAdd', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/fontAdd',
'ico' => 'plus',

Loading…
Cancel
Save