Interested in the source code of the HTML entities converter tool? Here it goes:
Interested in the source code of the HTML entities converter tool? Here it goes:
<html>
<head>
<title>HTML entities converter</title>
<meta name="description" content="Convert Program code to HTML displayable text" />
<meta name="keywords" content="Convert Program Code to Text" />
<meta name="Robots" content="INDEX, FOLLOW" />
<meta name="Author" content="unkown" />
</head>
<body>
<h1>HTML entities converter</h1>
<?php
if (!empty($_POST['text'])){
$_POST['text'] = stripslashes($_POST['text']);
echo '<div style="border: solid 1px orange; padding: 20px; margin: 20px">';
switch (@$_POST['quote_style']) {
case 'quotes':
$quote_style = ENT_QUOTES;
break;
case 'noquotes':
$quote_style = ENT_NOQUOTES;
break;
case 'compat':
default:
$quote_style = ENT_COMPAT;
break;
}
echo '<pre>';
echo htmlentities(htmlentities($_POST['text'], $quote_style), ENT_QUOTES);
echo '</pre>';
echo '</div>';
}
if (!isset($_POST['text'])) {
$_POST['text'] = "<quote>Paste your code in this box</quote>.
\nSelect Options, \"Click Convert HTML entities!\"\nPS, I did not write this code";
}
?>
<form action="htmlentities.php" method="post">
<textarea onClick="this.select()" name="text" style="width: 400px; height: 200px"><?php echo @$_POST['text']; ?></textarea>
<br />
<fieldset title="Conversion options" style="width: 400px; border: solid 1px #dddddd">
<legend>Conversion options</legend>
<input type="radio" name="quote_style" value="compat" id="radio_compat" <?php echo (@$_POST['quote_style']=='compat' || !isset($_POST['quote_style'])) ? 'checked="checked" ' : ''; ?>/>
<label for="radio_compat">Convert double quotes, but NOT single quotes (default)</label>
<br />
<input type="radio" name="quote_style" value="quotes" id="radio_quotes" <?php echo (@$_POST['quote_style']=='quotes') ? 'checked="checked" ' : ''; ?>/>
<label for="radio_quotes">Convert double quotes AND single quotes</label>
<br />
<input type="radio" name="quote_style" value="noquotes" id="radio_noquotes" <?php echo (@$_POST['quote_style']=='noquotes') ? 'checked="checked" ' : ''; ?>/>
<label for="radio_noquotes">Don't convert any quotes</label>
</fieldset>
<br />
<input type="submit" value="Convert HTML entities!" />
</form>
<hr />
Interested in the source code of the <strong>HTML entities converter</strong> tool? Here it goes:
<br />
<?php highlight_file('htmlentities.php'); ?>
</body>
</html>