From 123a72d7de692c8f33f6df39d0a8a7a267fe8b0b Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 04:28:26 -0400 Subject: Convert to UNIX line endings --- inc/template.php | 144 +++++++++++++++++++++++++++---------------------------- 1 file changed, 72 insertions(+), 72 deletions(-) (limited to 'inc/template.php') diff --git a/inc/template.php b/inc/template.php index 071fa761..09e27c26 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1,72 +1,72 @@ -setPaths($config['dir']['template']); - $twig = new Twig_Environment($loader, array( - 'autoescape' => false, - 'cache' => "{$config['dir']['template']}/cache", - 'debug' => $config['debug'] - )); - $twig->addExtension(new Twig_Extensions_Extension_Tinyboard()); - $twig->addExtension(new Twig_Extensions_Extension_I18n()); -} - -function Element($templateFile, array $options) { - global $config, $debug, $twig; - - if (!$twig) - load_twig(); - - if (function_exists('create_pm_header') && ((isset($options['mod']) && $options['mod']) || isset($options['__mod'])) && !preg_match('!^mod/!', $templateFile)) { - $options['pm'] = create_pm_header(); - } - - if (isset($options['body']) && $config['debug']) { - if (isset($debug['start'])) { - $debug['time'] = '~' . round((microtime(true) - $debug['start']) * 1000, 2) . 'ms'; - unset($debug['start']); - } - $debug['included'] = get_included_files(); - $debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB'; - $options['body'] .= - '

Debug

' .
-				str_replace("\n", '
', utf8tohtml(print_r($debug, true))) . - '
'; - } - - // Read the template file - if (@file_get_contents("{$config['dir']['template']}/${templateFile}")) { - $body = $twig->render($templateFile, $options); - - if ($config['minify_html'] && preg_match('/\.html$/', $templateFile)) { - $body = trim(preg_replace("/[\t\r\n]/", '', $body)); - } - - return $body; - } else { - throw new Exception("Template file '${templateFile}' does not exist or is empty in '{$config['dir']['template']}'!"); - } -} - +setPaths($config['dir']['template']); + $twig = new Twig_Environment($loader, array( + 'autoescape' => false, + 'cache' => "{$config['dir']['template']}/cache", + 'debug' => $config['debug'] + )); + $twig->addExtension(new Twig_Extensions_Extension_Tinyboard()); + $twig->addExtension(new Twig_Extensions_Extension_I18n()); +} + +function Element($templateFile, array $options) { + global $config, $debug, $twig; + + if (!$twig) + load_twig(); + + if (function_exists('create_pm_header') && ((isset($options['mod']) && $options['mod']) || isset($options['__mod'])) && !preg_match('!^mod/!', $templateFile)) { + $options['pm'] = create_pm_header(); + } + + if (isset($options['body']) && $config['debug']) { + if (isset($debug['start'])) { + $debug['time'] = '~' . round((microtime(true) - $debug['start']) * 1000, 2) . 'ms'; + unset($debug['start']); + } + $debug['included'] = get_included_files(); + $debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB'; + $options['body'] .= + '

Debug

' .
+				str_replace("\n", '
', utf8tohtml(print_r($debug, true))) . + '
'; + } + + // Read the template file + if (@file_get_contents("{$config['dir']['template']}/${templateFile}")) { + $body = $twig->render($templateFile, $options); + + if ($config['minify_html'] && preg_match('/\.html$/', $templateFile)) { + $body = trim(preg_replace("/[\t\r\n]/", '', $body)); + } + + return $body; + } else { + throw new Exception("Template file '${templateFile}' does not exist or is empty in '{$config['dir']['template']}'!"); + } +} + -- cgit v1.3