prefix . $this->name ) ) { $this->value = $v; } if ( isset( $_POST[$this->prefix . $this->name] ) ) { $this->value = $_POST[$this->prefix . $this->name]; update_option( $this->prefix . $this->name , $this->value ); } } } /** * my_text_box - extends the base form control class to create a text box. * */ class my_text_box extends my_form_control { //php 4 constructor function my_text_box( $name , $description ) { $this->name = $name; $this->description = $description; $this->get_value(); } function display() { echo '
'; echo ''; echo ''; echo '
'; } } /** * my_text_area - extends the base form control class to create a textarea. * */ class my_text_area extends my_form_control { //php 4 constructor function my_text_area ( $name , $description ) { $this->name = $name; $this->description = $description; $this->get_value(); } function display() { echo ''; echo ''; echo ''; echo '
'; } } /** * my_plugin - The actual plugin class * * Creates an admin page that includes two text boxes and a text area * */ class my_plugin { //PHP 4 style constructor function my_plugin(){ add_action( 'admin_menu' , array(&$this , 'add_admin_menu') ); } function add_admin_menu(){ add_options_page('My Plugin Options', 'My Plugin Options', 9, basename(__FILE__), array(&$this, 'admin_page')); } function admin_page(){ $option1 = new my_text_box( 'Option_1' , 'First Option'); $option2 = new my_text_area( 'Option_2' , 'Second Option'); $option3 = new my_text_box( 'Option_3' , 'Third Option'); ?>