| 14 | *                           to the wrapper DIVtag | *                           to the wrapper DIVtag | 
| 15 | * @return  DIVtag object. | * @return  DIVtag object. | 
| 16 | */ | */ | 
| 17 | function babw_nl2br($raw_string, $class=NULL) { | function my_nl2br($raw_string, $class=NULL) { | 
| 18 |  |  | 
| 19 | $attributes = array(); | $attributes = array(); | 
| 20 | if ($class) { | if ($class) { | 
| 27 | $lines = explode( chr(13), $raw_string); | $lines = explode( chr(13), $raw_string); | 
| 28 | $index=0; | $index=0; | 
| 29 | while( $lines[$index] ) { | while( $lines[$index] ) { | 
| 30 | $div->push( $lines[$index], html_br() ); | $div->add( $lines[$index], html_br() ); | 
| 31 | $index++; | $index++; | 
| 32 | } | } | 
| 33 | return $div; | return $div; | 
| 38 |  |  | 
| 39 | $form = new FORMtag(array("name"=> "testform", | $form = new FORMtag(array("name"=> "testform", | 
| 40 | "method" => "POST", | "method" => "POST", | 
| 41 | "action" => $PHP_SELF)); | "action" => $_SERVER["PHP_SELF"])); | 
| 42 |  |  | 
| 43 |  |  | 
| 44 | $textarea = form_textarea("text", "this is a long ass test" ); | $textarea = form_textarea("text", "this is a lame test" ); | 
| 45 | $textarea->set_tag_attributes( array("cols" => "60", | $textarea->set_tag_attributes( array("cols" => "60", | 
| 46 | "rows" => "40") ); | "rows" => "40") ); | 
| 47 |  |  | 
| 48 | $form->push( html_br(), $textarea, html_br() ); | $form->add( html_br(), $textarea, html_br() ); | 
| 49 |  |  | 
| 50 | $form->push( form_submit("what", "Submit") ); | $form->add( form_submit("what", "Submit") ); | 
| 51 | $form->push( form_submit("debug", "Debug") ); | $form->add( form_submit("debug", "Debug") ); | 
| 52 |  |  | 
| 53 | $page->push( $form, html_br(), html_br() ); | $page->add( $form, html_br(), html_br() ); | 
| 54 |  |  | 
| 55 | if ($REQUEST_METHOD == "POST") { | if ($_SERVER["REQUEST_METHOD"] == "POST") { | 
| 56 | //Ok lets process the input. | //Ok lets process the input. | 
| 57 | $div = babw_nl2br( $HTTP_POST_VARS["text"] ); | $div = my_nl2br( $_POST["text"] ); | 
| 58 | $page->push( $div ); | $page->add( $div ); | 
| 59 | } | } | 
| 60 |  |  | 
| 61 | print $page->render(); | print $page->render(); |