setup_menu_tabs(); $this->render_page($title); } /** * Render the menu page * * @param string $title - the page title * * @return void */ protected function render_page($title) { $current_tab = $this->get_current_tab(); ?>

render_tabs($current_tab); ?>
menu_tabs[$current_tab]['render_callback']); ?>
'; foreach ($this->menu_tabs as $tab_key => $tab_info) { $active = $current_tab == $tab_key ? 'nav-tab-active' : ''; echo '' . esc_html($tab_info['title']) . ''; } echo ''; } /** * Get valid current tab slug. * * @return string - current valid tab slug or empty string */ protected function get_current_tab() { if (is_array($this->menu_tabs) && !empty($this->menu_tabs)) { $tab_keys = array_keys($this->menu_tabs); if (empty($_GET['tab'])) { return $tab_keys[0]; } else { $current_tab = sanitize_text_field($_GET['tab']); return in_array($current_tab, $tab_keys) ? $current_tab : $tab_keys[0]; } } else { return ''; } } /** * This function checks to see if there is a display condition for the tab and if so runs it otherwise it returns true to display the tab * * @param array $tab_info - the tab information array contains keys like title, render_callback and display_condition_callback * * @return boolean - true if the tab should be displayed or false to hide it */ protected function should_display_tab($tab_info) { if (!empty($tab_info['display_condition_callback']) && is_callable($tab_info['display_condition_callback'])) { return call_user_func($tab_info['display_condition_callback']); } elseif (!empty($tab_info['display_condition_callback']) && !is_callable($tab_info['display_condition_callback'])) { error_log("Callback function set but not callable (coding error)"); return false; } else { return true; } } /** * Shows postbox for settings menu * * @param string $id css ID for postbox * @param string $title title of the postbox section * @param string $content the content of the postbox **/ protected function postbox_toggle($id, $title, $content) { //Always send string with translation markers in it ?>

'; _e('Settings successfully updated.','all-in-one-wp-security-and-firewall'); echo '

'; } /** * Renders record(s) successfully deleted message at top of page. * * @return Void */ public static function show_msg_record_deleted_st() { AIOWPSecurity_Admin_Menu::show_msg_updated_st(__('Successfully deleted the selected record(s).', 'all-in-one-wp-security-and-firewall')); } /** * Renders record(s) unsuccessfully deleted message at top of page. * * @return Void */ public static function show_msg_record_not_deleted_st() { AIOWPSecurity_Admin_Menu::show_msg_error_st(__('Failed to delete the selected record(s).', 'all-in-one-wp-security-and-firewall')); } public function show_msg_updated($msg) { echo '

'; echo $msg; echo '

'; } public static function show_msg_updated_st($msg) { echo '

'; echo wp_kses_post($msg); echo '

'; } public function show_msg_error($error_msg) { echo '

'; echo wp_kses_post($error_msg); echo '

'; } public static function show_msg_error_st($error_msg) { echo '

'; echo wp_kses_post($error_msg); echo '

'; } protected function start_buffer() { ob_start(); } protected function end_buffer_and_collect() { $output = ob_get_contents(); ob_end_clean(); return $output; } }