<?PHP
/** @file
 *
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.plugin.plugin');



class plgContentTDIT extends JPlugin
{

public function onContentPrepare($ctx,&$rw, &$parms, $pg=0 ) {

	if ( !preg_match("#{tdit}(.*?){/tdit}#s", $rw->text) ) {
	 	return(true);
	}



	$xpr="#{tdit}(.*?){/tdit}#s";
	if (preg_match_all($xpr, $rw->text, $matches, PREG_PATTERN_ORDER) > 0) {
	$cnt=0;
	foreach ($matches[0] as $match) {
		$html="";
		$action = preg_replace("/{.+?}/", "", $match);


	require_once('tdit/tdit_functions.php');
	$html=tdit($action);

		$rw->text=preg_replace($xpr,$html,$rw->text,1);
	}
	return true;
	}

	}
}

?>