1
0

serendipity_editor.js.tpl without core

To have this in the plugin api didn't look right. the fallback to default works this time, so this should be alright.
This commit is contained in:
onli
2014-03-23 23:53:55 +01:00
parent 0d54063c5e
commit 7bf373248b
3 changed files with 13 additions and 12 deletions

@ -278,9 +278,9 @@ function serendipity_getTemplateFile($file, $key = 'serendipityHTTPPath') {
if (file_exists($serendipity['serendipityPath'] . $templateFile)) {
return $serendipity[$key] . $templateFile;
}
if (file_exists($serendipity['serendipityPath'] . $templateFile . ".tpl") && IS_installed) {
# catch .js.tpl files served via the template-plugin-api
if (file_exists($serendipity['serendipityPath'] . $templateFile . ".tpl") && $serendipity['template'] . '/' == $directory && IS_installed) {
# catch .js.tpl files served via the template-plugin-api, but only if that template is active as well, so config.inc.php is laoded
# this won't work in the installer
return $serendipity['baseURL'] . 'index.php?/plugin/' . $file;
}

@ -57,15 +57,6 @@ function serendipity_plugin_api_core_event_hook($event, &$bag, &$eventData, &$ad
global $serendipity;
switch($event) {
case 'external_plugin':
switch ($eventData) {
case 'admin/serendipity_editor.js':
header('Content-Type: application/javascript');
$data = array('token_url' => serendipity_setFormToken("url"));
echo serendipity_smarty_show('admin/serendipity_editor.js.tpl', $data);
break;
}
break;
case 'js':
// This is frontend and backend!

@ -108,6 +108,16 @@ serendipity_loadGlobalThemeOptions($template_config, $template_loaded_config, $t
function serendipity_plugin_api_pre_event_hook($event, &$bag, &$eventData, &$addData) {
// Check what Event is coming in, only react to those we want.
switch($event) {
case 'external_plugin':
switch ($eventData) {
case 'admin/serendipity_editor.js':
header('Content-Type: application/javascript');
$data = array('token_url' => serendipity_setFormToken("url"));
echo serendipity_smarty_show('admin/serendipity_editor.js.tpl', $data);
break;
}
break;
case 'js':
// always add newlines to the end of last element, in case of other plugins using this hook and
// always start at line Col 1, to populate the (virtual) serendipity.js file