Skip to content

Commit

Permalink
Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
Browse files Browse the repository at this point in the history
A plugin may decide not to print a menu entry via the EVENT_MENU_MAIN
event hook based on which project is currently selected. Therefore the
return value from EVENT_MENU_MAIN should be checked to make sure it
isn't null. If it is null, then don't print anything in the menu.

Signed-off-by: David Hicks <hickseydr@optusnet.com.au>
  • Loading branch information
gtz-et authored and davidhicks committed Jan 26, 2010
1 parent 8bc6b66 commit 321ac71
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions core/html_api.php
Expand Up @@ -735,7 +735,9 @@ function print_menu() {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
$t_menu_options[] = $t_callback_menu_options;
if ( !is_null( $t_callback_menu_options ) ) {
$t_menu_options[] = $t_callback_menu_options;
}
}
}
}
Expand Down Expand Up @@ -783,7 +785,9 @@ function print_menu() {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
$t_menu_options[] = $t_callback_menu_options;
if ( !is_null( $t_callback_menu_options ) ) {
$t_menu_options[] = $t_callback_menu_options;
}
}
}
}
Expand Down Expand Up @@ -908,7 +912,9 @@ function print_summary_submenu() {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
$t_menu_options[] = $t_callback_menu_options;
if ( !is_null( $t_callback_menu_options ) ) {
$t_menu_options[] = $t_callback_menu_options;
}
}
}
}
Expand Down Expand Up @@ -1004,7 +1010,9 @@ function print_manage_menu( $p_page = '' ) {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
$t_menu_options[] = $t_callback_menu_options;
if ( !is_null( $t_callback_menu_options ) ) {
$t_menu_options[] = $t_callback_menu_options;
}
}
}
}
Expand Down Expand Up @@ -1121,7 +1129,9 @@ function print_account_menu( $p_page = '' ) {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
$t_menu_options[] = $t_callback_menu_options;
if ( !is_null( $t_callback_menu_options ) ) {
$t_menu_options[] = $t_callback_menu_options;
}
}
}
}
Expand Down Expand Up @@ -1182,7 +1192,9 @@ function print_summary_menu( $p_page = '' ) {
if( is_array( $t_callback_menu_options ) ) {
$t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options );
} else {
$t_menu_options[] = $t_callback_menu_options;
if ( !is_null( $t_callback_menu_options ) ) {
$t_menu_options[] = $t_callback_menu_options;
}
}
}
}
Expand Down

0 comments on commit 321ac71

Please sign in to comment.