<?php
/*
Simple:Press Forum
html to raw parser
$LastChangedDate: 2009-05-27 19:17:51 +0100 (Wed, 27 May 2009) $
$Rev: 1954 $
*/

if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
	die('Access Denied');
}

function sf_Html2Raw($text)
{
	$text = trim($text);

	$text = str_replace ("\n\n", "\n", $text);

	$text = str_replace ('<div class="sfcode">', "<code>", $text);
	$text = str_replace ('</div>', "</code>", $text);

	# BBCode [code]
	if (!function_exists('rawescape')) {
		function rawescape($s) {
			global $text;
			return '<code>'.htmlspecialchars_decode($s[1]).'</code>';
		}
	}
	$text = preg_replace_callback('/\<code\>(.*?)\<\/code\>/ms', "rawescape", $text);

	return $text;
}

?>