function test($_html) { $num = 10; $ob = new HTML_FormPersister(); $_time = getTime(); for ($i = 0; $i < $num; $i++) { $_result = $ob->process($_html); } $_time = (getTime() - $_time) / $num; printf("%.6fs - <tt>%s</tt><br>", $_time, htmlspecialchars($_html)); }
</optgroup> </select> <select name=sel3 size="3" bb="eaaa"> <option value=a>aaaaaaaaaaaaa <option value=b selected>bbbbbbbbbbbbb <option value=c>ccccccccccccc </select> <select name=sel4 multiple size="3"> <option value=a>aaaaaaaaaaaaa <option value=b>bbbbbbbbbbbbb <option value=c>ccccccccccccc </select> <input type="submit" value=" OK "> </form> ')); $proc = $ob->process($code); ?> <h2>Modify something, press Submit and see that all modified fields are preserved!</h2> <?php echo $proc; ?> <h2>Code before and after replacement (compare!)</h2> <table width=100% height=50% cellpadding=1 cellspacing=0 border=0> <tr> <td width="50%"> <b>Original HTML code:</b> <pre id="left" onscroll="document.all.right.scrollTop=this.scrollTop" style="margin-top:0.3em; overflow:auto; height:auto; border:1px solid black"><font size=-1><?php
/** * Static handler for ob_start(). * * Usage: * ob_start(array('HTML_FormPersister', 'ob_formpersisterhandler')); * * Of course you may not use OB handling but call process() manually * in your scripts. * * @param string $html Input HTML text. * @return processed output with all form fields modified. */ function ob_formPersisterHandler($st) { $fp = new HTML_FormPersister(); $r = $fp->process($st); return $r; }