Add $hook_suffix as js var, fixes #10008

git-svn-id: http://svn.automattic.com/wordpress/trunk@11508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-06-03 07:06:45 +00:00
parent c1df9fe122
commit e4e96c17b2
1 changed files with 10 additions and 11 deletions

View File

@ -27,13 +27,21 @@ wp_admin_css( 'css/colors' );
wp_admin_css( 'css/ie' );
wp_enqueue_script('utils');
$hook_suffix = '';
if ( isset($page_hook) )
$hook_suffix = "$page_hook";
else if ( isset($plugin_page) )
$hook_suffix = "$plugin_page";
else if ( isset($pagenow) )
$hook_suffix = "$pagenow";
$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
?>
<script type="text/javascript">
//<![CDATA[
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
var pagenow = '<?php echo substr($pagenow, 0, -4); ?>';
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', adminpage = '<?php echo $admin_body_class; ?>';
//]]>
</script>
<?php
@ -43,14 +51,6 @@ if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new
wp_enqueue_script('quicktags');
}
$hook_suffix = '';
if ( isset($page_hook) )
$hook_suffix = "$page_hook";
else if ( isset($plugin_page) )
$hook_suffix = "$plugin_page";
else if ( isset($pagenow) )
$hook_suffix = "$pagenow";
do_action('admin_enqueue_scripts', $hook_suffix);
do_action("admin_print_styles-$hook_suffix");
do_action('admin_print_styles');
@ -59,7 +59,6 @@ do_action('admin_print_scripts');
do_action("admin_head-$hook_suffix");
do_action('admin_head');
$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
if ( get_user_setting('mfold') == 'f' ) {
$admin_body_class .= ' folded';
}