From: Mischa POSLAWSKY Date: Mon, 7 Dec 2020 14:23:49 +0000 (+0100) Subject: head: load edit script before body X-Git-Tag: v5.0~35 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/88503d06a82643f27d3df1422b07a05a6e1fdeee?ds=sidebyside head: load edit script before body Introduce $Page->head for html head output. Allows editor setup before running other javascript. --- diff --git a/head.inc.php b/head.inc.php index 4082b92..9ff6495 100644 --- a/head.inc.php +++ b/head.inc.php @@ -15,5 +15,6 @@ +head)) print $Page->head; ?> diff --git a/page.inc.php b/page.inc.php index 8eba91b..17e7c80 100644 --- a/page.inc.php +++ b/page.inc.php @@ -1,4 +1,15 @@ admin("edit {$Page->link}")) { + $ckesrc = '/lib/ckeditor'; # local install + if (!file_exists(DOCROOT . $ckesrc)) { + $ckesrc = '//cdn.ckeditor.com/4.15.1/full-all'; # remote fallback + } + ob_start(); + printf("\n", "$ckesrc/ckeditor.js"); + print ''."\n"; + $Page->head = ob_get_clean(); +} + include_once 'head.inc.php'; print "
\n"; @@ -43,17 +54,6 @@ register_shutdown_function(function () { print '
'; @include 'footer.inc.html'; print "
\n"; - - global $User, $Page; - if ($User and $User->admin("edit {$Page->link}")) { - $ckesrc = '/lib/ckeditor'; # local install - if (!file_exists(DOCROOT . $ckesrc)) { - $ckesrc = '//cdn.ckeditor.com/4.15.1/full-all'; # remote fallback - } - printf("\n", "$ckesrc/ckeditor.js"); - print ''."\n"; - } - print "\n"; });