get_plugin_page_hook give back null, if there is no active hook:
function get_plugin_page_hook( $plugin_page, $parent_page ) {
$hook = get_plugin_page_hookname( $plugin_page, $parent_page );
if ( has_action($hook) )
return $hook;
else
return null;
}
In admin.php akismet calls this like:
if ( function_exists( 'get_plugin_page_hook' ) )
$hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' );
else
$hook = 'dashboard_page_akismet-stats-display';
This is wrong, because the function will give back null and the scripts will be loaded on every page.
Better solution could be check for null or the following code:
if ( function_exists( 'get_plugin_page_hookname' ) )
$hook = get_plugin_page_hookname( 'akismet-stats-display', 'index.php' );
else
$hook = 'dashboard_page_akismet-stats-display';