Location: PHPKode > scripts > Highlighter > highlighter/doc.html
<h1>Highlighter PHP class - v1.0</h1>
<h2>Waht the class does - Main features</h2>
<p>
	<ul>
		<li>Adds customizable tags to a code block</li>
		<li>Highlights PHP code</li>
		<li>Links each function to its corresponfing page on php.net</li>
	</ul>
</p>

<h2>Functions in the class</h2>
<h3>highlight</h3>
<p>
	<code>
		function highlight($text)
		<br /><br />
		@param string $text  the code to highlight<br />
	 	@return string the code, highlighted<br />
	</code>
	<br />
	Highlights the code and links functions to their page on php.net
</p>

<h3>add_tags</h3>
<p>
	<code>
		function add_tags($text, $ype = "code", $div = 0)
		<br /><br />
		@param string $text  the code to parse<br />
      @param string $type the code tag to add<br />
	   @param bool   $div switch beetwen divs and "pure-tags"<br />
	   @return string the new text, tagged!<br />
	</code>
	<br />
	Actually executes the query and return the result
</p>

<h3>check_be_tags</h3>
<p>
	<code>
		function check_be_tags($code)
		<br /><br />
	   @param string $code the code<br />	  
	   @return bool returns TRUE if tags are present, else FALSE<br />
	</code>
	<br />
	Checks if the begin and end tags are present in the code block
</p>

<h3>add_be_tags</h3>
<p>
	<code>
		function add_be_tags($code)
		<br /><br />
	   @param string $code the code<br />	  
	   @return string the code with tags<br />
	</code>
	<br />
	Adds the begin and end tags to a code block
</p>

<h2>Examples of use</h2>
<h3>Example #1</h3>
<p>
	The following code will add the "box" tag to the text and highligh it using php's default colors. Then it will link all the functions to their page on the php manual
	<br /><br />	
	<code>
	include_once('highligher.php');<br /><br />

	$highlight = new Highlighter;<br />
	$code = $highlight->add_tags($code, "box");<br />
	$code = $highlight->highlight($code);<br /><br />

	echo $code;
	</code>
</p>

<h3>Example #2</h3>
<p>
	If the code passed to the method was
	<br /><br />
	<code>
		$code = "Hello World!";<br />
		add_tags($code, "boxed", 1);
	</code>
	<br /><br />
	The returned code would be (in HTML)
	<br /><br />
	<code>
		<div class="boxed">Hello World!</div>
	</code>
</p>

<h3>Example #3</h3>
<p>
	If the code passed to the method was
	<br /><br />
	<code>
		$code = "Hello World!";<br />
		add_tags($code, "boxed-class", 0);
	</code>
	<br /><br />
	The returning text would be (in HTML)
	<br /><br />
	<code>
		<boxed-class>Hello World!</boxed-class>
	</code>

<h2>Changelog</h2>
<p>
	No changes made since now.
</p>

<h2>License</h2>
<p>
	Copyright (C)2007 Giulio Bai <hide@address.com>
</p>

<p>
	<blockquote>
		This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 as published by the Free Software Foundation.
		<br /><br />
		This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
		<br /><br />
		You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</blockquote>
</p>

<p>
	A copy of the full license can be found in the <a href="http://www.gnu.org/licenses/gpl.html">official GNU's site</a>
</p>

<h2>Notes</h2>
<p>
	<h3>Links</h3>
	<ul>
		<li><a href="http://hewle.com">http://hewle.com</a> - My site :)</li>
		<li><a href="http://www.phpclasses.org">http://www.phpclasses.org</a> - Lots and lots of PHP classes</li>
		<li><a href="http://www.php.net">http://www.php.net</a> - PHP official site</li>
	</ul>
	
	<h3>Plase share it!</h3>
	<p>
		If you found this program useful, share it! Maybe it can help also other people!<br />
		Don't be scared, it's free, editable, redistributable.<br />
		So... share, Share, SHARE!	
	</p>
	
	<h3>Contacts</h3>
	<p>
		If you want to know more about this program, you can contact me at <a href="mailto:hide@address.com">hide@address.com</a>.<br />
		Wht do you think about this program? Is it useful? How can be improved?	
	</p>
</p>
Return current item: Highlighter