Location: PHPKode > scripts > Forms generation and validation > forms-generation-and-validation/plugins/prefilter.form.php
<?php

/*
 * prefilter.form.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/plugins/prefilter.form.php,v 1.5 2006/11/19 18:19:07 mlemos Exp $
 *
 */

function smarty_prefilter_form($tpl_source, &$smarty)
{
	$ql=preg_quote($l=$smarty->left_delimiter, '/');
	$qr=preg_quote($r=$smarty->right_delimiter, '/');
	$qd=preg_quote('/', '/');
	$search=array(
		'/'.$ql.'input\s+name=("[^"]+"|\'[^\']+\'|\S+)'.$qr.'/i',
		'/'.$ql.'hiddeninput\s+name=("[^"]+"|\'[^\']+\'|\S+)'.$qr.'/i',
		'/'.$ql.'label\s+for=("[^"]+"|\'[^\']+\'|\S+)'.$qr.'/i',
		'/('.$ql.'(include|include_php|if|else|elseif|'.$qd.'if|foreach|foreachelse|'.$qd.'foreach|section'.$qd.'section).*'.$qr.')/i'
	);
	$replace=array(
		$l.'/capture'.$r.$l.'insert name="formaddinputpart" input=\\1 data=$smarty.capture.formdata'.$r.$l.'capture name="formdata"'.$r,
		$l.'/capture'.$r.$l.'insert name="formaddinputhiddenpart" input=\\1 data=$smarty.capture.formdata'.$r.$l.'capture name="formdata"'.$r,
		$l.'/capture'.$r.$l.'insert name="formaddlabelpart" for=\\1 data=$smarty.capture.formdata'.$r.$l.'capture name="formdata"'.$r,
		$l.'/capture'.$r.$l.'insert name="formadddatapart" data=$smarty.capture.formdata'.$r.'\\1'.$l.'capture name="formdata"'.$r
	);
	return($l.'capture name="formdata"'.$r.preg_replace($search,$replace,$tpl_source).$l.'/capture'.$r.$l.'insert name="formadddatapart" data=$smarty.capture.formdata'.$r);
}

?>
Return current item: Forms generation and validation