Script inline
This commit is contained in:
parent
0bf76c3778
commit
df88e5a195
|
@ -68,7 +68,8 @@ class helper
|
|||
/**
|
||||
* Fonction pour assurer la traduction des messages
|
||||
*/
|
||||
public static function googleTranslate($to, $text){
|
||||
public static function googleTranslate($to, $text)
|
||||
{
|
||||
if (!file_exists('site/i18n/' . $to . '.json')) {
|
||||
file_put_contents('site/i18n/' . $to . '.json', json_encode([]));
|
||||
}
|
||||
|
@ -447,11 +448,13 @@ class helper
|
|||
break;
|
||||
case self::FILTER_ID:
|
||||
$text = mb_strtolower($text, 'UTF-8');
|
||||
$text = strip_tags(str_replace(
|
||||
$text = strip_tags(
|
||||
str_replace(
|
||||
explode(',', 'á,à,â,ä,ã,å,ç,é,è,ê,ë,í,ì,î,ï,ñ,ó,ò,ô,ö,õ,ú,ù,û,ü,ý,ÿ,\',", '),
|
||||
explode(',', 'a,a,a,a,a,a,c,e,e,e,e,i,i,i,i,n,o,o,o,o,o,u,u,u,u,y,y,-,-,-'),
|
||||
$text
|
||||
));
|
||||
)
|
||||
);
|
||||
$text = preg_replace('/([^a-z0-9-])/', '', $text);
|
||||
// Supprime les emoji
|
||||
$text = preg_replace('/[[:^print:]]/', '', $text);
|
||||
|
@ -539,6 +542,10 @@ class helper
|
|||
$css = preg_replace(['(( )+{)', '({( )+)'], '{', $css);
|
||||
$css = preg_replace(['(( )+})', '(}( )+)', '(;( )*})'], '}', $css);
|
||||
$css = preg_replace(['(;( )+)', '(( )+;)'], ';', $css);
|
||||
// Convertir les codes entités
|
||||
$css = htmlspecialchars_decode($css);
|
||||
// Supprime les balises HTML
|
||||
$css = strip_tags($css);
|
||||
// Retourne le css minifié
|
||||
return $css;
|
||||
}
|
||||
|
@ -555,6 +562,8 @@ class helper
|
|||
// Supprime les tabulations, espaces, nouvelles lignes, etc...
|
||||
$js = str_replace(["\r\n", "\r", "\t", "\n", ' ', ' ', ' '], '', $js);
|
||||
$js = preg_replace(['(( )+\))', '(\)( )+)'], ')', $js);
|
||||
// Convertir les codes entités
|
||||
$js = htmlspecialchars_decode($js);
|
||||
// Retourne le js minifié
|
||||
return $js;
|
||||
}
|
||||
|
|
|
@ -1043,7 +1043,8 @@ class layout extends common
|
|||
if ($this->core->output['inlineScript']) {
|
||||
$inlineScript = implode($this->core->output['inlineScript']);
|
||||
}
|
||||
echo '<script defer>' . helper::minifyJs($coreScript . $this->core->output['script'] . htmlspecialchars_decode($inlineScript)) . '</script>';
|
||||
echo '<script defer>' . helper::minifyJs( $coreScript) . '</script>';
|
||||
echo '<script defer>' . helper::minifyJs( $inlineScript) . '</script>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1070,7 +1071,7 @@ class layout extends common
|
|||
if ($this->core->output['inlineStyle']) {
|
||||
foreach ($this->core->output['inlineStyle'] as $style) {
|
||||
if ($style) {
|
||||
echo '<style type="text/css">' . helper::minifyCss(htmlspecialchars_decode($style)) . '</style>';
|
||||
echo '<style type="text/css">' . helper::minifyCss($style) . '</style>';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue