/** * Display the Licenses tab * @return void */ function ckpn_display_licenses() { $licenses_page_options = ckpn_get_licenses(); if (isset($_POST['action'])) { foreach ($licenses_page_options as $license) { $license_key = $_POST[$license]; update_option($license, $license_key); } printf('<div class="updated settings-error"> <p> %s </p> </div>', __('Licenses Saved.', CKPN_CORE_TEXT_DOMAIN)); } ?> <form method="post" action="<?php admin_url('options-general.php?page=pushover-notifications&tab=licenses'); ?> "> <?php wp_nonce_field('ckpn-update-licenses'); ?> <table class="form-table"> <?php do_action('ckpn_notification_licenses_page'); ?> <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="<?php echo implode(',', $licenses_page_options); ?> " /> <?php settings_fields('ckpn-update-licenses'); ?> </table> <input type="submit" class="button-primary" value="<?php _e('Save Licenses', CKPN_CORE_TEXT_DOMAIN); ?> " /> </form> <?php }
/** * Determines what tab is being displayed, and executes the display of that tab * @return void * @access public */ public function determine_tab() { $settings = ckpn_get_options(); ?> <div id="icon-options-general" class="icon32"></div><h2><?php _e('Pushover Notifications for WordPress', CKPN_CORE_TEXT_DOMAIN); ?> </h2> <?php $current = !isset($_GET['tab']) ? 'general' : $_GET['tab']; $default_tabs = array('general' => __('Settings', CKPN_CORE_TEXT_DOMAIN), 'logs' => __('Logs', CKPN_CORE_TEXT_DOMAIN), 'sysinfo' => __('System Info', CKPN_CORE_TEXT_DOMAIN)); // If multiple keys is enabled, show the tab if ($settings['multiple_keys']) { $default_tabs = array_slice($default_tabs, 0, 1, true) + array('additional_keys' => __('Additional Keys', CKPN_CORE_TEXT_DOMAIN)) + array_slice($default_tabs, 1, count($default_tabs) - 1, true); } // If any extensions have hooked into the licenses settings, show the tab $licenses = ckpn_get_licenses(); if (!empty($licenses)) { $default_tabs['licenses'] = __('Licenses', CKPN_CORE_TEXT_DOMAIN); } // Add the Exetensions listing Last $default_tabs['extensions'] = __('Get Extensions', CKPN_CORE_TEXT_DOMAIN); $tabs = apply_filters('ckpn_settings_tabs', $default_tabs); ?> <h2 class="nav-tab-wrapper"><?php foreach ($tabs as $tab => $name) { $class = $tab == $current ? ' nav-tab-active' : ''; echo "<a class='nav-tab{$class}' href='?page=pushover-notifications&tab={$tab}'>{$name}</a>"; } ?> </h2> <div class="wrap"> <?php if (!isset($_GET['tab']) || $_GET['tab'] == 'general') { ckpn_admin_page(); } else { // Extension Devs - Your function that shows the tab content needs to be prefaced with 'ckpn_display_' in order to work here. $tab_function = 'ckpn_display_' . $_GET['tab']; $tab_function(); } ?> </div> <?php }