<commit_before><?php
/**
 * Core
 * @package php-tool-suite
 * @subpackage core
 */



/**
 * Returns a unique hash of an object or a mixed hash value
 * @param mixed $value an object or a mixed value (string, bool, number)
 * @return string a unique hash to identify the value
 */
function object_hash($obj) {
	if (is_object($obj)) {
		return spl_object_hash($obj);
	}
	return md5(print_r($obj, true));
}

/**
 * Generates a GUID (Globally Unique Identifier)
 * @return string a unique identifier formatted like this {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
 */
function guid() {
	if( function_exists('com_create_guid') ){
		return com_create_guid();
	}else{
		plugin_require(array('random'));
		$c = strtoupper(md5(uniqid(rand(), true)));
		$uuid = '{' . substr($c, 0, 8) . '-' . substr($c, 8, 4) . '-' . substr($c,12, 4) . '-' . substr($c, 16, 4) . '-' . substr($c, 20, 12) . '}';
		return $uuid;
	}
}


function plugin_load_dir($dir) {
	plugin_require(array('fs', 'var'));

	browse_recursive($dir, function ($file) {
		plugin_load_file($file);
	}, null, var_get('plugins/disabled', array()));
}

function plugin_load_file($file) {
	if( substr($file, strlen($file) - 4) === '.php' ){
		require_once($file);
	}
}

function plugin_require($subpackages = null) {
	if( is_string($subpackages) ){
		$subpackages = array($subpackages);
	}
	if( is_array($subpackages) ){
		foreach ($subpackages as $subpackage) {
			require_once(dirname(__FILE__). '/' . $subpackage . '.inc.php');
		}
	}
}


/**
 * Returns the security state of the current connection.
 * @return boolean TRUE if a secured connection is active. FALSE otherwhise.
 */
function server_is_secure() {
	return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443);
}<commit_msg>server_is_secure is more precise<commit_after><?php
/**
 * Core
 * @package php-tool-suite
 * @subpackage core
 */



/**
 * Returns a unique hash of an object or a mixed hash value
 * @param mixed $value an object or a mixed value (string, bool, number)
 * @return string a unique hash to identify the value
 */
function object_hash($obj) {
	if (is_object($obj)) {
		return spl_object_hash($obj);
	}
	return md5(print_r($obj, true));
}

/**
 * Generates a GUID (Globally Unique Identifier)
 * @return string a unique identifier formatted like this {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
 */
function guid() {
	if( function_exists('com_create_guid') ){
		return com_create_guid();
	}else{
		plugin_require(array('random'));
		$c = strtoupper(md5(uniqid(rand(), true)));
		$uuid = '{' . substr($c, 0, 8) . '-' . substr($c, 8, 4) . '-' . substr($c,12, 4) . '-' . substr($c, 16, 4) . '-' . substr($c, 20, 12) . '}';
		return $uuid;
	}
}


function plugin_load_dir($dir) {
	plugin_require(array('fs', 'var'));

	browse_recursive($dir, function ($file) {
		plugin_load_file($file);
	}, null, var_get('plugins/disabled', array()));
}

function plugin_load_file($file) {
	if( substr($file, strlen($file) - 4) === '.php' ){
		require_once($file);
	}
}

function plugin_require($subpackages = null) {
	if( is_string($subpackages) ){
		$subpackages = array($subpackages);
	}
	if( is_array($subpackages) ){
		foreach ($subpackages as $subpackage) {
			require_once(dirname(__FILE__). '/' . $subpackage . '.inc.php');
		}
	}
}


/**
 * Returns the security state of the current connection.
 * @return boolean TRUE if a secured connection is active. FALSE otherwhise.
 */
function server_is_secure() {
	return (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443);
}
{'fraction_non_alphanumeric': 0.18525623458481777, 'fraction_numerical': 0.010961907371882707, 'mean_word_length': 4.447761194029851, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '5475856', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1241, 'n_words': 311}