function admin_settings_add($args = array())
 {
     $defaults = array('id' => 'default_field', 'title' => 'Default Field', 'desc' => '', 'default' => '', 'placeholder' => '', 'type' => 'text', 'section' => '', 'choices' => array(), 'class' => '', 'tab' => '', 'update_url' => '');
     extract(wp_parse_args($args, $defaults));
     $field_args = array('type' => $type, 'id' => $id, 'desc' => $desc, 'default' => $default, 'placeholder' => $placeholder, 'choices' => $choices, 'label_for' => $id, 'class' => $class, 'update_url' => $update_url);
     if (count($this->_settings) == 0) {
         //only do this once
         register_setting($this->plugin_slug, $this->plugin_slug, array(&$this, 'admin_settings_validate'));
     }
     $this->_settings[] = $args;
     $section_id = WPPBUtils::to_key($section);
     //check we have the tab
     if (!empty($tab)) {
         $tab_id = WPPBUtils::to_key($tab);
         //add the tab
         $this->admin_settings_add_tab($tab_id, WPPBUtils::to_title($tab));
         //add the section
         $section_id = $this->admin_settings_add_section_to_tab($tab_id, $section_id, WPPBUtils::to_title($section));
     } else {
         //just add the section
         $this->admin_settings_add_section($section_id, WPPBUtils::to_title($section));
     }
     //add the setting!
     add_settings_field($id, $title, array(&$this, 'admin_settings_render'), $this->plugin_slug, $section_id, $field_args);
 }
 function admin_settings_add($args = array())
 {
     $defaults = array('id' => 'default_field', 'title' => 'Default Field', 'desc' => '', 'std' => '', 'type' => 'text', 'section' => '', 'choices' => array(), 'class' => '', 'tab' => '');
     extract(wp_parse_args($args, $defaults));
     $field_args = array('type' => $type, 'id' => $id, 'desc' => $desc, 'std' => $std, 'choices' => $choices, 'label_for' => $id, 'class' => $class);
     if (count($this->_settings) == 0) {
         //only do this once
         register_setting($this->_plugin_name, $this->_plugin_name, array(&$this, 'admin_settings_validate'));
     }
     $this->_settings[] = $args;
     $section_id = WPPBUtils::to_key($section);
     //check we have the tab
     if (!empty($tab)) {
         $tab_id = WPPBUtils::to_key($tab);
         if (!array_key_exists($tab_id, $this->_settings_tabs)) {
             //no such tab exists, so create one please
             $this->admin_settings_add_tab(array('id' => WPPBUtils::to_key($tab), 'title' => WPPBUtils::to_title($tab)));
         }
         $section_id = $tab . '-' . $section_id;
         //add the section to the tab
         $this->_settings_tabs[$tab_id]['sections'][] = $section_id;
     }
     //check we have the section
     if (!array_key_exists($section_id, $this->_settings_sections)) {
         //no such section exists, so create one please
         $this->admin_settings_add_section(array('id' => $section_id, 'title' => WPPBUtils::to_title($section)));
     }
     add_settings_field($id, $title, array(&$this, 'admin_settings_render'), $this->_plugin_name, $section_id, $field_args);
 }