';
- echo $lang->get('user_msg_elev_timed_out', array( 'login_link' => $login_link ));
- echo '
';
+ $header .= '';
+ $header .= $lang->get('user_msg_elev_timed_out', array( 'login_link' => $login_link ));
+ $header .= '
';
}
if ( $this->site_disabled && $session->user_level >= USER_LEVEL_ADMIN && ( $paths->page != $paths->nslist['Special'] . 'Administration' ) )
{
$admin_link = makeUrlNS('Special', 'Administration', 'module=' . $paths->nslist['Admin'] . 'GeneralConfig', true);
- echo '' . $lang->get('page_sitedisabled_admin_msg_title') . '
+ $header .= '
' . $lang->get('page_sitedisabled_admin_msg_title') . '
' . $lang->get('page_sitedisabled_admin_msg_body', array('admin_link' => $admin_link)) . '
';
}
}
-
- function footer($simple = false)
- {
- echo $this->getFooter($simple);
- }
-
- function getHeader()
- {
- $headers_sent = true;
- if(!defined('ENANO_HEADERS_SENT'))
- define('ENANO_HEADERS_SENT', '');
- if(!$this->no_headers) return $this->process_template('header.tpl');
- }
function getFooter($simple = false)
{
global $db, $session, $paths, $template, $plugins; // Common objects
@@ -1644,21 +1643,30 @@
/**
* Post-processor for template code. Basically what this does is it localizes {lang:foo} blocks.
* @param string Mostly-processed TPL code
+ * @param bool Post-eval switch. If true, does not escape code.
* @return string
*/
- function compile_template_text_post($text)
+ function compile_template_text_post($text, $post_eval = false)
{
+ global $db, $session, $paths, $template, $plugins; // Common objects
global $lang;
+
+ // Language strings
preg_match_all('/\{lang:([a-z0-9]+_[a-z0-9_]+)\}/', $text, $matches);
foreach ( $matches[1] as $i => $string_id )
{
$string = $lang->get($string_id);
- $string = str_replace('\\', '\\\\', $string);
- $string = str_replace('\'', '\\\'', $string);
+ if ( !$post_eval )
+ {
+ $string = str_replace('\\', '\\\\', $string);
+ $string = str_replace('\'', '\\\'', $string);
+ }
$text = str_replace_once($matches[0][$i], $string, $text);
}
- preg_match_all('/\{url:([A-z0-9]+):([\w\.\/:;\(\)@\[\]_=-]+)(?::([^\s\}]+))?(?:\|(escape))?\}/', $text, $matches);
+
+ // URLs
+ preg_match_all('/\{url:([A-z0-9]+):([^\s\}]+?)(?:;([^\s\}]+?))?(?:\|(escape))?\}/i', $text, $matches);
foreach ( $matches[1] as $i => $string_id )
{
$namespace =& $matches[1][$i];
@@ -1672,11 +1680,47 @@
$result = makeUrlNS($namespace, $page_id, $params, $escape);
+ if ( !$post_eval )
+ {
+ $result = str_replace('\\', '\\\\', $result);
+ $result = str_replace('\'', '\\\'', $result);
+ }
+
$text = str_replace_once($matches[0][$i], $result, $text);
}
+
+ $code = $plugins->setHook('compie_template_text_post');
+ foreach ( $code as $cmd )
+ {
+ eval($cmd);
+ }
+
return $text;
}
+ /**
+ * Returns the output of a theme hook
+ * @param string Hook name
+ * @return string
+ */
+
+ function get_theme_hook($hook)
+ {
+ global $db, $session, $paths, $template, $plugins; // Common objects
+ global $lang;
+
+ ob_start();
+ $code = $plugins->setHook($hook);
+ foreach ( $code as $cmd )
+ {
+ eval($cmd);
+ }
+ $out = ob_get_contents();
+ ob_end_clean();
+
+ return $out;
+ }
+
// n00bish comments removed from here. 2008-03-13 @ 12:02AM when I had nothing else to do.
/**
@@ -2601,6 +2645,9 @@
// System messages
$text = preg_replace('//is', '\' . $template->tplWikiFormat($paths->sysMsg(\'\\1\')) . \'', $text);
+ // Hooks
+ $text = preg_replace('//', '\' . $this->get_theme_hook(\'\\1\') . \'', $text);
+
// only do this if the plugins API is loaded
if ( is_object(@$plugins) )
{
diff -r e9ee4e246f96 -r ecc764c10138 index.php
--- a/index.php Sat Mar 21 14:54:53 2009 -0400
+++ b/index.php Sat Mar 21 14:55:34 2009 -0400
@@ -575,40 +575,24 @@
break;
}
- //
- // Optimize HTML by replacing newlines with spaces (excludes
,