forked from ZwiiCMS-Team/ZwiiCMS
Js include in page okay
This commit is contained in:
parent
a3fdb3bc1e
commit
aa50495555
@ -117,7 +117,8 @@ class common
|
|||||||
'showPageContent' => false,
|
'showPageContent' => false,
|
||||||
'state' => false,
|
'state' => false,
|
||||||
'style' => '',
|
'style' => '',
|
||||||
'inlineStyle' => '',
|
'inlineStyle' => [],
|
||||||
|
'inlineScript' => [],
|
||||||
'title' => null,
|
'title' => null,
|
||||||
// Null car un titre peut être vide
|
// Null car un titre peut être vide
|
||||||
// Trié par ordre d'exécution
|
// Trié par ordre d'exécution
|
||||||
@ -2290,7 +2291,10 @@ class common
|
|||||||
ob_start();
|
ob_start();
|
||||||
require 'core/core.js.php';
|
require 'core/core.js.php';
|
||||||
$coreScript = ob_get_clean();
|
$coreScript = ob_get_clean();
|
||||||
echo '<script>' . helper::minifyJs($coreScript . $this->output['script']) . '</script>';
|
if ($this->output['inlineScript']) {
|
||||||
|
$inlineScript = implode($this->output['inlineScript']);
|
||||||
|
}
|
||||||
|
echo '<script>' . helper::minifyJs( $coreScript . $this->output['script'] . htmlspecialchars_decode($inlineScript) ) . '</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2316,13 +2320,16 @@ class common
|
|||||||
// Import des styles liés à la page
|
// Import des styles liés à la page
|
||||||
if ($this->output['inlineStyle']) {
|
if ($this->output['inlineStyle']) {
|
||||||
foreach ($this->output['inlineStyle'] as $style) {
|
foreach ($this->output['inlineStyle'] as $style) {
|
||||||
echo '<style type="text/css">' . helper::minifyCss($style) . '</style>';
|
if ($style) {
|
||||||
|
echo '<style type="text/css">' . helper::minifyCss($style) . '</style>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Importe les polices de carcatères
|
* Importe les polices de caractères
|
||||||
*/
|
*/
|
||||||
public function showFonts()
|
public function showFonts()
|
||||||
{
|
{
|
||||||
@ -2986,11 +2993,19 @@ class core extends common
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Importe le CSS des barres
|
// Importe le style de la page principale
|
||||||
|
$inlineStyle[] = $this->getData(['page', $this->getUrl(0), 'css']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'css']);
|
||||||
|
// Importe le script de la page principale
|
||||||
|
$inlineScript[] = $this->getData(['page', $this->getUrl(0), 'js']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'js']);
|
||||||
|
|
||||||
|
// Importe le contenu, le CSS et le script des barres
|
||||||
$contentRight = $this->getData(['page', $this->getUrl(0), 'barRight']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$i18nContent) : '';
|
$contentRight = $this->getData(['page', $this->getUrl(0), 'barRight']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$i18nContent) : '';
|
||||||
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']);
|
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']);
|
||||||
|
$inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']);
|
||||||
$contentLeft = $this->getData(['page', $this->getUrl(0), 'barLeft']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$i18nContent) : '';
|
$contentLeft = $this->getData(['page', $this->getUrl(0), 'barLeft']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$i18nContent) : '';
|
||||||
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']);
|
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']);
|
||||||
|
$inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']);
|
||||||
|
|
||||||
|
|
||||||
// Importe la page simple sans module ou avec un module inexistant
|
// Importe la page simple sans module ou avec un module inexistant
|
||||||
if (
|
if (
|
||||||
@ -3002,12 +3017,10 @@ class core extends common
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
// Importe le CSS de la page principale
|
// Importe le CSS de la page principale
|
||||||
$pageContent = $this->getPage($this->getUrl(0), self::$i18nContent);
|
|
||||||
$inlineStyle[] = $this->getData(['page', $this->getUrl(0), 'css']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'css']);
|
|
||||||
|
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'content' => $pageContent,
|
'content' => $this->getPage($this->getUrl(0), self::$i18nContent),
|
||||||
'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']),
|
'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']),
|
||||||
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
|
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
|
||||||
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
|
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
|
||||||
@ -3016,6 +3029,7 @@ class core extends common
|
|||||||
'contentRight' => $contentRight,
|
'contentRight' => $contentRight,
|
||||||
'contentLeft' => $contentLeft,
|
'contentLeft' => $contentLeft,
|
||||||
'inlineStyle' => $inlineStyle,
|
'inlineStyle' => $inlineStyle,
|
||||||
|
'inlineScript' => $inlineScript,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3033,7 +3047,6 @@ class core extends common
|
|||||||
|
|
||||||
// Importe le CSS de la page principale
|
// Importe le CSS de la page principale
|
||||||
$pageContent = $this->getPage($this->getUrl(0), self::$i18nContent);
|
$pageContent = $this->getPage($this->getUrl(0), self::$i18nContent);
|
||||||
$inlineStyle[] = $this->getData(['page', $this->getUrl(0), 'css']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'css']);
|
|
||||||
|
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
@ -3047,6 +3060,7 @@ class core extends common
|
|||||||
'contentRight' => $contentRight,
|
'contentRight' => $contentRight,
|
||||||
'contentLeft' => $contentLeft,
|
'contentLeft' => $contentLeft,
|
||||||
'inlineStyle' => $inlineStyle,
|
'inlineStyle' => $inlineStyle,
|
||||||
|
'inlineScript' => $inlineScript,
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$moduleId = $this->getUrl(0);
|
$moduleId = $this->getUrl(0);
|
||||||
|
@ -492,8 +492,8 @@ class page extends common
|
|||||||
'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
|
'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
|
||||||
'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
|
'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
|
||||||
'extraPosition' => $this->getinput('pageEditExtraPosition', helper::FILTER_BOOLEAN),
|
'extraPosition' => $this->getinput('pageEditExtraPosition', helper::FILTER_BOOLEAN),
|
||||||
'css' => $this->getData(['page', $this->getUrl(2), 'css']),
|
'css' => $this->getData(['page', $this->getUrl(2), 'css']) == null ? '' : $this->getData(['page', $this->getUrl(2), 'css']),
|
||||||
'js' => $this->getData(['page', $this->getUrl(2), 'js']),
|
'js' => $this->getData(['page', $this->getUrl(2), 'js']) == null ? '' : $this->getData(['page', $this->getUrl(2), 'js']),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user