get_tab( false ) ) { ABDWPSM_Settings_Manager::die_with_message( 'Cannot add an options group to multiple tabs!' ); } // Options groups need certain information to be valid. Make sure that it does. if( !$Options_group_object->get_db_option_name() ) { ABDWPSM_Settings_Manager::die_with_message( 'Cannot add options group to tab! You must specify a value for the db_option_name property!' ); return; } if( !$Options_group_object->get_id() ) { ABDWPSM_Settings_Manager::die_with_message( 'Cannot add options group to tab! You must specify a value for the id property!' ); return; } // Update options group to point to this tab $Options_group_object->set_tab_reference( $this->get_url_slug() ); // IP uniqueness check if( !$skip_ip_check ) { $Options_group_object->ip_uniqueness_check(); } $this->my_options_groups[] = $Options_group_object; ABDWPSM_Settings_Manager::$options_groups[] = $Options_group_object; } /** * Returns the committed ABDWPSM_Tab object with the specified url slug. * @param {string} $url_slug The URL slug value in the tab you wish to get. * @return {object} The committed instance of the ABDWPSM_Tab class. * with the given URL slug. * @return {null} If no tab with url slug is found, null is returned. */ public static function get_tab_by_url_slug( $url_slug ) { foreach ( ABDWPSM_Settings_Manager::$tabs as $tab ) { if( $tab->get_url_slug() == $url_slug ) { return $tab; } } return null; } /** * Outputs the content of this tab to the page. */ public function display_tab_contents( $page_identifier ) { echo '
' . print_r( $tab_options_array, true ) . '' ); return; } // Merge together the two arrays with the passed array taking precedence $toa = $tab_options_array + $defaults; $this->set_display_name( $toa['display_name'] ); $this->set_display_description( $toa['display_description'] ); $this->set_url_slug( $toa['url_slug'] ); // Add to the page if( !empty( $toa['page'] ) ) { $this->add_to_page( $toa['page'] ); } // Add the options groups $this->my_options_groups = array(); if( is_array( $toa['options_group_object_array'] ) ) { foreach( $toa['options_group_object_array'] as $OG ) { $this->add_options_group( $OG, true ); } } } // end __construct public function get_options_groups() { return $this->my_options_groups; } public function get_display_name() { return $this->my_display_name; } public function get_display_description() { return $this->my_display_description; } public function get_url_slug() { return $this->my_url_slug; } public function get_page() { return $this->my_page; } public function set_display_name( $tab_name ) { // Display name must be a string. if( !is_string( $tab_name ) ) { // Die a terrible death ABDWPSM_Settings_Manager::die_with_message('Expected string parameter. Got:
' . print_r( $tab_name, true ) . ''); } // We don't want any HTML here, so convert special chars, then set // the variable. $this->my_display_name = htmlspecialchars( $tab_name ); } /** * @param {string} $tab_description HTML or plain text description to display * at the top of the tab. */ public function set_display_description( $tab_description ) { // Description must be a string. if( !is_string( $tab_description ) ) { // Die a terrible death ABDWPSM_Settings_Manager::die_with_message('Expected string parameter. Got:
' . print_r( $tab_description, true ) . ''); } $this->my_display_description = $tab_description; } public function set_url_slug( $url_slug ) { // URL slug must be a string. if( !is_string( $url_slug ) ) { // Die a terrible death ABDWPSM_Settings_Manager::die_with_message('Expected string parameter. Got:
' . print_r( $url_slug, true ) . ''); } $this->my_url_slug = $url_slug; // Uniqueness check (dies with a message if it fails) $this->ip_uniqueness_check(); } public function set_page( $page_slug ) { // URL slug must be a string. if( !is_string( $page_slug ) ) { // Die a terrible death ABDWPSM_Settings_Manager::die_with_message('Expected string parameter. Got:
' . print_r( $page_slug, true ) . ''); } $this->my_page = $page_slug; // Uniqueness check (dies with a message if it fails) $this->ip_uniqueness_check(); } } // end class } // end if( !class_exists( ...