Browse | Submit New Snippet | Create Package

 

Textile Helper

Type:
Class
Category:
HTML Manipulation
License:
GNU General Public License
Language:
PHP
 
Description:
Wrapper for Textile.

See

Versions Of This Snippet::

Travis Cline
Snippet ID Download Version Date Posted Author Delete
3140.12007-05-16 00:31Travis Cline

Download a raw-text version of this code by clicking on "Download Version"

 


Latest Snippet Version: :0.1

<?php
/**
 * Textile Helper Class for CakePHP.
 * 
 * Requires classTextile.php to be within a vendor directory.
 *
 * @version 	0.1
 * @author 	tclineks
 * @see 	http://textile.thresholdstate.com/
 * @license 	http://www.opensource.org/licenses/mit-license.php The MIT License
 */

vendor('classTextile');

/**
 * Textile Helper class
 */
class TextileHelper extends AppHelper {
	
	var $textile;
	var $initialized = false;
	
	/**
	 * Creates textile object
	 */
	function init() {
		if (!$this->initialized) {
			$this->textile = new Textile();
			if (!is_a($this->textile, 'Textile')) {
				trigger_error('Textile could not be initalized');
			}
			$this->initialized = true;
		}
	}
	
	/**
	 * Wrapper for TextileThis
	 */
	function TextileThis($text, $lite='', $encode='', $noimage='', $strict='', $rel=''){
		$this->init();
		return $this->textile->TextileThis($text, $lite='', $encode='', $noimage='', $strict='', $rel='');
	}
	
	/**
	 * Wrapper for TextileRestricted
	 */
	function TextileRestricted($text, $lite=1, $noimage=1, $rel='nofollow'){
		$this->init();
		return $this->textile->TextileRestricted($text, $lite=1, $noimage=1, $rel='nofollow');
	}

}

?>
		

Submit a new version

You can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others..