<commit_before><?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
  header("location: index.php");
  exit;
}

function smarty_prefilter_log_tpl($source, $smarty)
{
	global $prefs;
	if ($prefs['log_tpl'] != 'y') {
		return $source;
	}

	$current_file = $smarty->_current_file;

	// Refrain from logging for some templates
	if (
			strpos($smarty->template_resource, 'eval:') === 0 || 	// Evaluated templates 
			preg_match('/^<!DOCTYPE /', $source) || // templates that generate a DOCTYPE, which must be output first
			strpos($current_file, '/mail/') !== false // email tpls
			) {
		return $source;
	}
	return '<!-- TPL: ' . $current_file . ' -->' . $source . '<!-- /TPL: ' . $current_file . ' -->';
}<commit_msg>[FIX] Template logging if "DOCTYPE" is not fully uppercase<commit_after><?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
  header("location: index.php");
  exit;
}

function smarty_prefilter_log_tpl($source, $smarty)
{
	global $prefs;
	if ($prefs['log_tpl'] != 'y') {
		return $source;
	}

	$current_file = $smarty->_current_file;

	// Refrain from logging for some templates
	if (
			strpos($smarty->template_resource, 'eval:') === 0 || 	// Evaluated templates 
			preg_match('/^<!DOCTYPE /i', $source) || // templates that generate a DOCTYPE, which must be output first
			strpos($current_file, '/mail/') !== false // email tpls
			) {
		return $source;
	}
	return '<!-- TPL: ' . $current_file . ' -->' . $source . '<!-- /TPL: ' . $current_file . ' -->';
}
{'fraction_non_alphanumeric': 0.1590909090909091, 'fraction_numerical': 0.008181818181818182, 'mean_word_length': 3.594989561586639, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7470915', 'n_tokens_mistral': 769, 'n_tokens_neox': 708, 'n_words': 227}