setup(); } /** * Setup the module. * * @since 5.5.4 */ protected function setup() { $this->initialize(); $this->setup_hooks(); } /** * Setup hooks. * * @since 5.5.4 */ protected function setup_hooks() { add_action( $this->menu_action, array( $this, 'add_menu' ) ); add_action( "bd_admin_footer_for_{$this->page_slug}", array( $this, 'modify_admin_footer' ) ); add_filter( 'bd_action_nonce_check', array( $this, 'nonce_check' ), 10, 2 ); add_filter( 'bd_admin_help_tabs', array( $this, 'render_help_tab' ), 10, 2 ); } /** * Add menu. * * @since 5.5.4 */ public function add_menu() { $this->screen = add_submenu_page( Bulk_Delete::POSTS_PAGE_SLUG, $this->label['page_title'], $this->label['menu_title'], $this->capability, $this->page_slug, array( $this, 'render_page' ) ); } /** * Check for nonce before executing the action. * * @since 5.5.4 * * @param bool $result The current result. * @param string $action Action name. */ public function nonce_check( $result, $action ) { if ( in_array( $action, $this->actions ) ) { if ( check_admin_referer( "bd-{$this->page_slug}", "bd-{$this->page_slug}-nonce" ) ) { return true; } } return $result; } /** * Modify help tabs for the current page. * * @since 5.5.4 * * @param array $help_tabs Current list of help tabs. * @param string $screen Current screen name. * * @return array Modified list of help tabs. */ public function render_help_tab( $help_tabs, $screen ) { if ( $this->screen == $screen ) { $help_tabs = $this->add_help_tab( $help_tabs ); } return $help_tabs; } /** * Add help tabs. * Help tabs can be added by overriding this function in the child class. * * @since 5.5.4 * * @param array $help_tabs Current list of help tabs. * * @return array List of help tabs. */ protected function add_help_tab( $help_tabs ) { return $help_tabs; } /** * Render the page. * * @since 5.5.4 */ public function render_page() { ?>

label['page_title'];?>

render_nonce_fields(); ?>
render_header(); ?>
render_body(); ?>
render_footer(); } /** * Print nonce fields. * * @since 5.5.4 */ protected function render_nonce_fields() { wp_nonce_field( "bd-{$this->page_slug}", "bd-{$this->page_slug}-nonce" ); } /** * Render header for the page. * * If sidebar is enabled, then it is rendered as well. * * @since 5.5.4 */ protected function render_header() { ?>

messages['warning_message']; ?>

page_slug}" ); } /** * Modify admin footer in Bulk Delete plugin pages. */ public function modify_admin_footer() { add_filter( 'admin_footer_text', 'bd_add_rating_link' ); } /** * Getter for screen. * * @return string Current value of screen */ public function get_screen() { return $this->screen; } /** * Getter for page_slug. * * @return string Current value of page_slug */ public function get_page_slug() { return $this->page_slug; } } ?>