function wpjam_admin_init() { global $plugin_page, $current_tab; if (!isset($current_tab)) { $current_tab = isset($_GET['tab']) ? $_GET['tab'] : ''; } if ($plugin_page && wpjam_get_admin_page($plugin_page)) { $function_prefix = str_replace('-', '_', $plugin_page); if (function_exists($function_prefix . '_tabs')) { add_filter($plugin_page . '_tabs', $function_prefix . '_tabs', 1); } if (function_exists($function_prefix . '_fields')) { add_filter($plugin_page . '_fields', $function_prefix . '_fields', 1); } if (function_exists($function_prefix . '_page_load')) { add_action($plugin_page . '_page_load', $function_prefix . '_page_load', 1); } } }
public function display($args = array()) { global $plugin_page, $current_tab; if ($wpjam_page = wpjam_get_admin_page($plugin_page)) { $builtin_parent_pages = wpjam_get_builtin_parent_pages(); $parent_slug = isset($wpjam_page['parent_slug']) ? $wpjam_page['parent_slug'] : ''; if ($parent_slug && isset($builtin_parent_pages[$parent_slug])) { $form_url = $builtin_parent_pages[$parent_slug]; } else { $form_url = 'admin.php'; } $form_url = is_network_admin() ? network_admin_url($form_url) : admin_url($form_url); } extract(wp_parse_args($args, array('search' => true))); wpjam_admin_errors(); $this->views(); ?> <form action="<?php echo $form_url; ?> " method="get"> <input type="hidden" id="page" name="page" value="<?php echo $plugin_page; ?> "> <?php if (isset($current_tab)) { ?> <input type="hidden" id="tab" name="tab" value="<?php echo $current_tab; ?> "> <?php } ?> <?php do_action('wpjam_list_table_hidden_fields', $plugin_page); ?> <?php if ($search && $this->_pagination_args || isset($_GET['s'])) { $this->search_box('搜索', $this->_args['singular']); } ?> <?php parent::display(); ?> </form> <?php }