'; /** @brief The default suffix of the displayed tab name. @details The tab inherits this value upon creation. @since 20130503 @var $tab_heading_suffix **/ public $tab_heading_suffix = ''; /** @brief The default prefix of the displayed tab name. @details The tab inherits this value upon creation. @since 20130503 @var $tab_name_prefix **/ public $tab_name_prefix = ''; /** @brief The default suffix of the displayed tab name. @details The tab inherits this value upon creation. @since 20130503 @var $tab_name_suffix **/ public $tab_name_suffix = ''; /** @brief Collection of \\plainview\\sdk_eightb_sold_alerts\\wordpress\\tabs\\tab objects. @since 20130503 @var $tabs **/ public $tabs; /** @brief The HTML element tag. @since 2015-07-07 19:29:43 **/ public $tag = 'ul'; /** @brief Array of _GET keys to preserve when creating tab links. @since 20130503 @var $valid_get_keys **/ public $valid_get_keys = array( 'page' ); public function __construct( $base ) { $this->base = $base; $this->tabs = new \plainview\sdk_eightb_sold_alerts\collections\Collection(); $this->_construct(); } /** @brief Overridable constructor for the subclasses. @since 2015-12-27 12:42:15 **/ public function _construct() { } public function __toString() { return $this->render(); } /** @brief Return how many tabs are registered. @return int The count of tabs registered. @since 20130809 **/ public function count() { return count( $this->tabs ); } /** @brief Create a tab. @since 2015-12-27 12:48:51 **/ public abstract function create_tab(); /** @brief Sets the current tab. @param string $id ID of tab to make the default. @return tabs Object chaining. @since 20130503 **/ public function default_tab( $id ) { $this->default_tab = $id; return $this; } /** @brief Sets the _GET array. @param array $get The new _GET array from which to get the current tab. @return tabs Object chaining. @since 20130530 **/ public function get( $get ) { $this->get = $get; return $this; } /** @brief Is the _GET tab key equal to this value? @param string $value Value to check @return bool True if the get key is equal to the value. @since 20131006 **/ public function get_is( $value ) { if ( $this->get === null ) $get = $_GET; else $get = $this->get; if ( ! isset( $get[ $this->get_key ] ) ) return false; return ( $get[ $this->get_key ] == $value ); } /** @brief Sets the get key. @param string $get_key New key for the _GET array. @return tabs Object chaining. @since 20130530 **/ public function get_key( $get_key ) { $this->get_key = $get_key; return $this; } /** @brief Return the separator between tabs, if any. @since 2015-12-27 13:11:01 **/ public function get_separator() { return ''; } /** @brief Return the tabs. @details Although the tabs can be displayed using __toString, this method allows for finding and catching exceptions, which isn't allowed in __toString. @return string The tabs as a string. @since 20130503 **/ public function render() { if ( $this->get === null ) $this->get = $_GET; $get = $this->get; // Conv $get_key = $this->get_key; // Conv // No tabs? Do nothing. if ( count( $this->tabs ) < 1 ) return ''; // Check that the default exists. if ( ! $this->tabs->has( $this->default_tab ) ) $this->default_tab = key( $this->tabs->to_array() ); // Select the default tab if none is selected. if ( ! isset( $get[ $get_key ] ) ) $get[ $get_key ] = $this->default_tab; $selected = $get[ $get_key ]; $r = '