public static function guessExtension($file_path, $reference_name = null, $default = 'bin') {
		if (!$reference_name) {
			$reference_name = basename($file_path);
		}

		if ($extension = pathinfo($reference_name, PATHINFO_EXTENSION) and static::hasExtension($extension)) {
			return strtolower($extension);
		}

		$mime_type = static::getMagicType($file_path);
		if ($mime_type and $extension = static::getExtensionForType($mime_type)) {
			return $extension;
		}

		return $default;
	}