Archived
Move serendipiy_editor.js.tpl convertion into core
http://board.s9y.org/viewtopic.php?f=11&t=19927
This commit is contained in:
@@ -288,9 +288,8 @@ function serendipity_getTemplateFile($file, $key = 'serendipityHTTPPath') {
|
||||
return $serendipity[$key] . $templateFile;
|
||||
}
|
||||
|
||||
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 loaded
|
||||
# this won't work in the installer
|
||||
if (file_exists($serendipity['serendipityPath'] . $templateFile . ".tpl")) {
|
||||
# catch *.tpl files, used by the backend for serendipity_editor.js.tpl
|
||||
return $serendipity['baseURL'] . 'index.php?/plugin/' . $file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,6 +625,21 @@ function serendipity_smarty_getFile($params, &$smarty) {
|
||||
return serendipity_getTemplateFile($params['file']);
|
||||
}
|
||||
|
||||
function serendipity_smarty_getConfigVar($params, &$smarty) {
|
||||
if ( !isset($params['key']) ) {
|
||||
trigger_error("Smarty Error: " . __FUNCTION__ .": missing 'key' parameter", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
return serendipity_get_config_var($params['key']);
|
||||
}
|
||||
|
||||
function serendipity_smarty_setFormToken($params, &$smarty) {
|
||||
if ( isset($params['type']) ) {
|
||||
return serendipity_setFormToken($params['type']);
|
||||
}
|
||||
return serendipity_setFormToken();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Smarty Function: Picks a specified key from an array and returns it
|
||||
@@ -938,6 +953,8 @@ function serendipity_smarty_init($vars = array()) {
|
||||
$serendipity['smarty']->registerPlugin('function', 'pickKey', 'serendipity_smarty_pickKey');
|
||||
$serendipity['smarty']->registerPlugin('function', 'serendipity_showCommentForm', 'serendipity_smarty_showCommentForm');
|
||||
$serendipity['smarty']->registerPlugin('function', 'serendipity_getImageSize', 'serendipity_smarty_getImageSize');
|
||||
$serendipity['smarty']->registerPlugin('function', 'serendipity_getConfigVar', 'serendipity_smarty_getConfigVar');
|
||||
$serendipity['smarty']->registerPlugin('function', 'serendipity_setFormToken', 'serendipity_smarty_setFormToken');
|
||||
|
||||
$serendipity['smarty']->registerFilter('pre', 'serendipity_replaceSmartyVars');
|
||||
|
||||
|
||||
@@ -75,6 +75,17 @@ function errorHandlerCreateDOM(htmlStr) {
|
||||
} \n";
|
||||
}
|
||||
break;
|
||||
|
||||
case 'external_plugin':
|
||||
switch ($eventData) {
|
||||
case 'admin/serendipity_editor.js':
|
||||
header('Content-Type: application/javascript');
|
||||
global $serendipity;
|
||||
|
||||
echo serendipity_smarty_show('admin/serendipity_editor.js.tpl');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
return true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user