<?php

$str_texte 
'';
$str_light '';

if (isset(
$_REQUEST['texte']) && is_string($_REQUEST['texte']) && strlen($_REQUEST['texte']))
{
    
$str_texte $_REQUEST['texte'];
    if (
get_magic_quotes_gpc())
    {
        
$str_texte stripslashes($str_texte);
    }

    
$str_light preg_replace('#<!--.*?-->\s*#s'''$str_texte);

    if (isset(
$_REQUEST['trim']))
    {
        
$str_light preg_replace('#^\s+|\s+$#m'''$str_light);
    }
}
/*
$mix_ = str_replace(array("\r\n", "\r"), "\n", $mix_);
$mix_ = explode("\n", $mix_);
$mix_ = array_map('rtrim', $mix_);
$mix_ = array_filter($mix_, create_function('$s', 'return strlen($s);'));
$mix_ = implode("\r\n", $mix_);
*/

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
        <title>Supprimer les commentaires HTML</title>
        <style type="text/css">
        <!--
        body *
        {
            font-family: monospace;
            font-size: 8pt;
        }

        textarea
        {
            height: 200px;
            width: 600px;
        }
        form
        {
            margin: 0;
        }
        div
        {
            margin: 0 0 5px 0;
        }
        -->
        </style>
        <script type="text/javascript">
        <!--;
            function on_load()
            {
                if (document && document.getElementById)
                {
                    var obj_input = document.getElementById('texte');
                    if (obj_input && obj_input.focus)
                    {
                        obj_input.focus();
                    }
                }
            }

        //-->
        </script>
    </head>
    <body onload="on_load();">
        <form method="post" action="">
            <div>
                <textarea id="texte" name="texte" rows="20" cols="80"><?php echo htmlspecialchars($str_texteENT_QUOTES); ?></textarea>
            </div>
            <div>
                <input type="submit" class="submit" value="Supprimer" />
                <input type="checkbox" name="trim" id="trim" <?php echo isset($_REQUEST['trim']) ? ' checked="checked"'''?> />
                <label for="trim">Trim</label>
            </div>
        </form>
<?php
if ($str_light)
{
    echo 
'<div><textarea rows="20" cols="80" onclick="this.select();">'htmlspecialchars($str_lightENT_QUOTES),'</textarea></div>';
}

echo 
'<hr />';
highlight_file(__FILE__);

?>
    </body>
</html>