From 8d899be4415dd02ec996f012cd42b8ea04fb84a7 Mon Sep 17 00:00:00 2001 From: Ben Huson Date: Tue, 26 Jun 2012 10:44:40 +0100 Subject: [PATCH 1/2] Fix deprecated add_contextual_help() warning in WordPress 3.4. --- wp-db-backup.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/wp-db-backup.php b/wp-db-backup.php index a0bc3ec..d6d1247 100755 --- a/wp-db-backup.php +++ b/wp-db-backup.php @@ -616,12 +616,30 @@ function admin_load() { } function admin_menu() { + global $_page_hook; $_page_hook = add_management_page(__('Backup','wp-db-backup'), __('Backup','wp-db-backup'), 'import', $this->basename, array(&$this, 'backup_menu')); add_action('load-' . $_page_hook, array(&$this, 'admin_load')); - if ( function_exists('add_contextual_help') ) { + add_action( 'load-' . $_page_hook, array( &$this, 'add_help_tab' ) ); + } + + function add_help_tab() { + global $_page_hook; + $screen = get_current_screen(); + + if ( $screen->id != $_page_hook ) + return; + + if ( function_exists( 'add_contextual_help' ) && ! method_exists( $screen, 'add_help_tab' ) ) { $text = $this->help_menu(); - add_contextual_help($_page_hook, $text); + add_contextual_help( $_page_hook, $text ); } + + // @todo Check if $screen->id is current page + $screen->add_help_tab( array( + 'id' => 'wp_db_backup_help_tab', + 'title' => __( 'Overview' ), + 'content' => '

' . $this->help_menu() . '

' + ) ); } function fragment_menu() { From 3eaa84a8f7c07b3b2963e348fd78ef6deb7edb66 Mon Sep 17 00:00:00 2001 From: Ben Huson Date: Mon, 10 Sep 2012 13:12:37 +0100 Subject: [PATCH 2/2] Fix 'undefined' warning in core upgrade page. --- wp-db-backup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-db-backup.php b/wp-db-backup.php index d6d1247..6b7630c 100755 --- a/wp-db-backup.php +++ b/wp-db-backup.php @@ -219,7 +219,7 @@ function set_page_url() { * Add a link to back up your database when doing a core upgrade */ function update_notice_action() { - if ( 'upgrade-core' == $_REQUEST['action'] ) : + if ( isset( $_REQUEST['action'] ) || 'upgrade-core' == $_REQUEST['action'] ) : ob_start(array(&$this, 'update_notice')); add_action('admin_footer', create_function('', 'ob_end_flush();')); endif;