Code Compressor

Code Compressor

Code Compressor is a simple code to minimalize all type of code. Code Compressor will scrap new line and redundant space, and Code Compressor can work for mant type of code. I have tried to compress php code, css code, html code and Javascript code and it work successfully. However, this Code Compressor has drawback. It will error if it found comment like “//” in php or javascript. But dont worry, I am working on this. This Code Compressor is absolutely made 100% by my self :D, so there is no plagiarism in it.

First, The HTML Code:

<h1>Code Compressor by Muhammad Hasan Septiadi</h1>
<!--This code made by Muhammad Hasan Septiadi-->
<form action="" method="post" align="center">
<textarea name="source" style="width:100%;height:300px;" id="source"></textarea>
<input type="submit" value="Minimize"/>
</form>

Second, The PHP code as the engine:

/*This code made by Muhammad Hasan Septiadi*/
if(isset($_POST['source']))
{
	echo "<fieldset><legend>Result</legend>";
	echo htmlspecialchars(trim($_POST['source']));
	echo "</fieldset>";
}

You can combine both of code into one file, that should be like:

<h1>Code Compressor by Muhammad Hasan Septiadi</h1>
<!--This code made by Muhammad Hasan Septiadi-->
<form action="" method="post" align="center">
<textarea name="source" style="width:100%;height:300px;" id="source"></textarea>
<input type="submit" value="Minimize"/>
</form>
<?php
/*This code made by Muhammad Hasan Septiadi*/
if(isset($_POST['source']))
{
	echo "<fieldset><legend>Result</legend>";
	echo htmlspecialchars(trim($_POST['source']));
	echo "</fieldset>";
}
?>

If we use the Code Compressor for our code, it should be:

<h1>Code Compressor by Muhammad Hasan Septiadi</h1> <!--This code made by Muhammad Hasan Septiadi--> <form action="" method="post" align="center"> <textarea name="source" style="width:100%;height:300px;" id="source"></textarea> <input type="submit" value="Minimize"/> </form> <?php /*This code made by Muhammad Hasan Septiadi*/ if(isset($_POST['source'])) { echo "<fieldset><legend>Result</legend>"; echo htmlspecialchars(trim($_POST['source'])); echo "</fieldset>"; } ?>

Done, we just make a really simple Code Compressor.

Good luck.

Related Posts:

Code Compressor Ver 2

http://septiadi.com/2011/03/03/code-compressor/

 

 

 

Advertisements

One response to “Code Compressor

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: