set_options(); // Set the current options $this->set_defaults(); // Set the default options $this->set_select_options(); // Set the options available for each select } /** * Return the current options set for the plugin, grabbed from the 'wp_options' DB table */ private function set_options(){ $this->current = get_option('admin_bar_button'); } /** * Get the value of an option, checking first for a saved setting and then taking the default * * @param required string $option The option to get a value of * @param boolean $check_default Whether or not to check for the default value (if one is not set) * @return mixed The value for the selected option */ public function get($option, $check_default = true){ if(isset($this->current[$option])) : $option = $this->current[$option]; elseif($check_default) : $option = $this->get_default($option); else : $option = ''; endif; return $option; } /** * Return the default values, used if a value has not been set */ private function set_defaults(){ /** * Check for valid values from depricated settings * * @since 4.0 * @removal 5.0 */ $dep_button_text = $this->get('text', false); $dep_bar_show_time = $this->get('show_time', false); $this->defaults = array( 'button_text' => (!empty($dep_button_text)) ? $dep_button_text : __('Show Admin Bar', $this->plugin_text_domain), 'button_position' => 'top-left', 'button_activate' => 'both', 'bar_reserve_space' => 0, 'bar_auto_hide' => 1, 'bar_show_time' => (!empty($dep_bar_show_time)) ? $dep_bar_show_time : 5000, 'show_hide_button' => 1, 'show_wordpress_menu' => 1, 'admin_bar_colour' => '#23282D', 'admin_bar_colour_hover' => '#32373C', 'text_colour' => '#9EA3A8', 'text_colour_hover' => '#00B9EB', 'animate' => 1, 'animate_duration' => 1000, 'animate_direction' => 'leftright' ); } /** * Get the default value of an option * * @param required string $option The option to get a value of * @return mixed The value for the selected option */ public function get_default($option){ return (isset($this->defaults[$option])) ? $this->defaults[$option] : ''; } /** * Set the options that are available for each of the element * * @param required string $option The option to get a