From 0dfdb3af4eca41379233e9365318f51aee5ac401 Mon Sep 17 00:00:00 2001 From: onli Date: Sat, 15 Jun 2013 16:16:04 +0200 Subject: [PATCH] Add plugin-hook js --- index.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.php b/index.php index 3791af0f..465155f8 100644 --- a/index.php +++ b/index.php @@ -548,6 +548,22 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range $css_mode = $matches[1]; include(S9Y_INCLUDE_PATH . 'serendipity.css.php'); exit; +} elseif (preg_match(PAT_JS, $uri, $matches)) { + $serendipity['view'] = 'js'; + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { + header('Cache-Control: no-cache'); + } else { + header('Cache-Control:'); + header('Pragma:'); + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time()+3600)); + } + + header('Content-type: application/javascript; charset=' . LANG_CHARSET); + + $out = ""; + serendipity_plugin_api::hook_event('js', $out); + echo $out; + exit; } else if (preg_match(PAT_COMMENTS, $uri, $matches)) { $serendipity['view'] = 'comments'; $_args = serendipity_getUriArguments($uri, true); // Need to also match "." character