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:
@ -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
|
||||
|
Reference in New Issue
Block a user