From 433da491d1590d1b98a4fd002c40ebe1080d2a8e Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 2 Jun 2014 15:49:06 +0200 Subject: [PATCH] add frontent fallback for errorHandlerCreateDOM() js in case theme does not have js hooked {$head_link_script} Fixes #167 --- include/plugin_api.inc.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/include/plugin_api.inc.php b/include/plugin_api.inc.php index e7f16ce7..9150afb3 100644 --- a/include/plugin_api.inc.php +++ b/include/plugin_api.inc.php @@ -66,7 +66,6 @@ function serendipity_plugin_api_core_event_hook($event, &$bag, &$eventData, &$ad case 'js_backend': case 'js': - // This is frontend and backend! // Add a global available (index.tpl; admin/index.tpl; preview_iframe.tpl) redirect error string function used by errorToExceptionHandler() // hardened by admin only - better have that here, to be reachable everywhere if( $serendipity['serendipityUserlevel'] >= USERLEVEL_ADMIN ) { @@ -75,14 +74,32 @@ function errorHandlerCreateDOM(htmlStr) { var frag = document.createDocumentFragment(), temp = document.createElement('div'); temp.innerHTML = htmlStr; - while (temp.firstChild) { + while (temp.firstChild) { frag.appendChild(temp.firstChild); } return frag; } \n"; + $eHCD = true; } break; + case 'frontend_header': + // This is frontend fallback for themes without $head_link_script, desc see above + if( $serendipity['serendipityUserlevel'] >= USERLEVEL_ADMIN && !$eHCD ) { + echo " \n"; + } + break; + case 'external_plugin': switch ($eventData) { case 'admin/serendipity_editor.js':