# HG changeset patch # User Dan # Date 1208224793 14400 # Node ID 6be4b47aa247892d1e340f31841f2466d8097ca1 # Parent 698a8f04957c1a1defb360b28d50251c44018b8d Added template_compile_subst hook diff -r 698a8f04957c -r 6be4b47aa247 includes/template.php --- a/includes/template.php Sat Apr 12 17:57:58 2008 -0400 +++ b/includes/template.php Mon Apr 14 21:59:53 2008 -0400 @@ -1933,15 +1933,12 @@ $keywords = implode('|', $keywords); // Matches - // 1 2 3 4 56 7 8 - $regexp = '/()(.*)(()(.*))?()/isU'; + // 1 2 3 4 56 7 8 9 + $regexp = '/()(.*)(()(.*))?()/isU'; /* The way this works is: match all blocks using the standard form with a different keyword in the block each time, and replace them with appropriate PHP logic. Plugin-extensible now. :-) - - The while-loop is to bypass what is apparently a PCRE bug. It's hackish but it works. Properly written plugins should only need - to compile templates (using this method) once for each time the template file is changed. */ profiler_log("[template] compiler matchout start"); @@ -2018,6 +2015,16 @@ // System messages $text = preg_replace('//is', '\' . $template->tplWikiFormat($paths->sysMsg(\'\\1\')) . \'', $text); + // only do this if the plugins API is loaded + if ( is_object(@$plugins) ) + { + $code = $plugins->setHook('template_compile_subst'); + foreach ( $code as $cmd ) + { + eval($cmd); + } + } + // Template variables $text = preg_replace('/\{([A-z0-9_-]+?)\}/is', '\' . $this->tpl_strings[\'\\1\'] . \'', $text);