diff --git a/include/admin/tpl/comments.inc.tpl b/include/admin/tpl/comments.inc.tpl index cd172ef5..d7934def 100644 --- a/include/admin/tpl/comments.inc.tpl +++ b/include/admin/tpl/comments.inc.tpl @@ -10,7 +10,7 @@ var view_full = '{$CONST.VIEW_FULL}'; var view_hide = '{$CONST.HIDE}'; - +

{$CONST.COMMENTS}

diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php index 04bab5d0..b02288fb 100644 --- a/include/functions_config.inc.php +++ b/include/functions_config.inc.php @@ -282,6 +282,11 @@ function serendipity_getTemplateFile($file, $key = 'serendipityHTTPPath') { if (file_exists($serendipity['serendipityPath'] . $templateFile)) { return $serendipity[$key] . $templateFile; } + + if (file_exists($serendipity['serendipityPath'] . $templateFile . ".tpl")) { + # catch .js.tpl files served via the template-plugin-api + return $serendipity['baseURL'] . 'index.php?/plugin/' . $file; + } } if (preg_match('@\.(tpl|css|php)@i', $file) && !stristr($file, 'plugin')) { @@ -2246,4 +2251,14 @@ function serendipity_passwordhash($cleartext_password) { } } +//function serendipity_registerHandler($handler, $link) { + //global $serendipity; +// + //if ( ! is_array($serendipity["handler"])) { + //$serendipity["handler"] = array(); + //} + //$serendipity["handler"][$link] = $handler; + // +//} + /* vim: set sts=4 ts=4 expandtab : */ diff --git a/index.php b/index.php index 11248581..6509b5e2 100644 --- a/index.php +++ b/index.php @@ -363,6 +363,15 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range print $data; exit; +} else if (preg_match(PAT_PLUGIN, $uri, $matches)) { + $serendipity['view'] = 'plugin'; + include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php'); + + #echo $serendipity["handler"]["test.js"]; + serendipity_plugin_api::hook_event('external_plugin', $matches[2]); + if (!defined('NO_EXIT')) { + exit; + } } else if (preg_match(PAT_ADMIN, $uri)) { $serendipity['view'] = 'admin'; $base = $serendipity['baseURL']; @@ -398,15 +407,6 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range } include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php'); -} else if (preg_match(PAT_PLUGIN, $uri, $matches)) { - $serendipity['view'] = 'plugin'; - include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php'); - - #echo $serendipity["handler"]["test.js"]; - serendipity_plugin_api::hook_event('external_plugin', $matches[2]); - if (!defined('NO_EXIT')) { - exit; - } } else if ($is_multicat || preg_match(PAT_PERMALINK_CATEGORIES, $uri, $matches)) { $serendipity['view'] = 'categories'; diff --git a/templates/2k11/serendipity_editor.js.tpl b/templates/2k11/admin/serendipity_editor.js.tpl similarity index 100% rename from templates/2k11/serendipity_editor.js.tpl rename to templates/2k11/admin/serendipity_editor.js.tpl diff --git a/templates/2k11/config.inc.php b/templates/2k11/config.inc.php index a13ac4c0..0545e152 100644 --- a/templates/2k11/config.inc.php +++ b/templates/2k11/config.inc.php @@ -103,9 +103,10 @@ function serendipity_plugin_api_pre_event_hook($event, &$bag, &$eventData, &$add // Check what Event is coming in, only react to those we want. switch($event) { case 'external_plugin': + echo $eventData; switch ($eventData) { - case 'serendipity_editor.js': - smarty_show('serendipity_editor.js.tpl'); + case 'admin/serendipity_editor.js': + serendipity_smarty_show('admin/serendipity_editor.js.tpl'); break; } return true; @@ -113,31 +114,5 @@ function serendipity_plugin_api_pre_event_hook($event, &$bag, &$eventData, &$add } } -/* Render a smarty-template - * $template: path to the template-file - * $data: map with the variables to assign - * */ -function smarty_show($template, $data = null) { - global $serendipity; - - if (!is_object($serendipity['smarty'])) { - serendipity_smarty_init(); - } - - $serendipity['smarty']->assign($data); - - $tfile = serendipity_getTemplateFile($template, 'serendipityPath'); - - if ($tfile == $template) { - $tfile = dirname(__FILE__) . "/$template"; - } - $inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY]; - $serendipity['smarty']->security_settings[INCLUDE_ANY] = true; - $content = $serendipity['smarty']->fetch('file:'. $tfile); - $serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion; - - echo $content; -} - //echo "registering link to js-handler"; //serendipity_registerHandler(dirname(__FILE__). '/test.php', 'test.js'); \ No newline at end of file diff --git a/serendipity_editor.js b/templates/default/admin/serendipity_editor.js similarity index 100% rename from serendipity_editor.js rename to templates/default/admin/serendipity_editor.js