web/wp-admin/index.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    15 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
    15 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
    16 
    16 
    17 wp_dashboard_setup();
    17 wp_dashboard_setup();
    18 
    18 
    19 wp_enqueue_script( 'dashboard' );
    19 wp_enqueue_script( 'dashboard' );
    20 wp_enqueue_script( 'plugin-install' );
    20 if ( current_user_can( 'edit_theme_options' ) )
    21 wp_enqueue_script( 'media-upload' );
    21 	wp_enqueue_script( 'customize-loader' );
       
    22 if ( current_user_can( 'install_plugins' ) )
       
    23 	wp_enqueue_script( 'plugin-install' );
       
    24 if ( current_user_can( 'upload_files' ) )
       
    25 	wp_enqueue_script( 'media-upload' );
    22 add_thickbox();
    26 add_thickbox();
    23 
    27 
    24 if ( wp_is_mobile() )
    28 if ( wp_is_mobile() )
    25 	wp_enqueue_script( 'jquery-touch-punch' );
    29 	wp_enqueue_script( 'jquery-touch-punch' );
    26 
    30 
    55 ) );
    59 ) );
    56 
    60 
    57 $help  = '<p>' . __('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.') . '</p>';
    61 $help  = '<p>' . __('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.') . '</p>';
    58 $help .= '<p>' . __('<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show, and how many columns to display.') . '</p>';
    62 $help .= '<p>' . __('<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show, and how many columns to display.') . '</p>';
    59 $help .= '<p>' . __('<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.') . '</p>';
    63 $help .= '<p>' . __('<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.') . '</p>';
    60 $help .= '<p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. In addition, some box have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.') . '</p>';
    64 $help .= '<p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. In addition, some boxes have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.') . '</p>';
    61 
    65 
    62 $screen->add_help_tab( array(
    66 $screen->add_help_tab( array(
    63 	'id'      => 'help-layout',
    67 	'id'      => 'help-layout',
    64 	'title'   => __('Layout'),
    68 	'title'   => __('Layout'),
    65 	'content' => $help,
    69 	'content' => $help,
    70 	$help .= '<p>' . __('<strong>Right Now</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.') . '</p>';
    74 	$help .= '<p>' . __('<strong>Right Now</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.') . '</p>';
    71 if ( current_user_can( 'moderate_comments' ) )
    75 if ( current_user_can( 'moderate_comments' ) )
    72 	$help .= '<p>' . __('<strong>Recent Comments</strong> - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '</p>';
    76 	$help .= '<p>' . __('<strong>Recent Comments</strong> - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '</p>';
    73 if ( current_user_can( 'publish_posts' ) )
    77 if ( current_user_can( 'publish_posts' ) )
    74 	$help .= '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>';
    78 	$help .= '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>';
    75 if ( current_user_can( 'edit_posts' ) ) {
    79 if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
    76 	$help .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>';
    80 	$help .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>';
    77 	$help .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>';
    81 	$help .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>';
    78 }
    82 }
    79 $help .= '<p>' . __('<strong>WordPress Blog</strong> - Latest news from the official WordPress project.') . '</p>';
    83 $help .= '<p>' . __('<strong>WordPress Blog</strong> - Latest news from the official WordPress project.') . '</p>';
    80 $help .= '<p>' . __('<strong>Other WordPress News</strong> - Shows the <a href="http://planet.wordpress.org" target="_blank">WordPress Planet</a> feed. You can configure it to show a different feed of your choosing.') . '</p>';
    84 $help .= '<p>' . __('<strong>Other WordPress News</strong> - Shows the <a href="http://planet.wordpress.org" target="_blank">WordPress Planet</a> feed. You can configure it to show a different feed of your choosing.') . '</p>';
   104 
   108 
   105 <div class="wrap">
   109 <div class="wrap">
   106 <?php screen_icon(); ?>
   110 <?php screen_icon(); ?>
   107 <h2><?php echo esc_html( $title ); ?></h2>
   111 <h2><?php echo esc_html( $title ); ?></h2>
   108 
   112 
   109 <?php wp_welcome_panel(); ?>
   113 <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
       
   114 	$classes = 'welcome-panel';
       
   115 
       
   116 	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
       
   117 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
       
   118 	$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
       
   119 	if ( $hide )
       
   120 		$classes .= ' hidden'; ?>
       
   121 
       
   122  	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
       
   123  		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
       
   124 		<a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php _e( 'Dismiss' ); ?></a>
       
   125 		<?php do_action( 'welcome_panel' ); ?>
       
   126 	</div>
       
   127 <?php endif; ?>
   110 
   128 
   111 <div id="dashboard-widgets-wrap">
   129 <div id="dashboard-widgets-wrap">
   112 
   130 
   113 <?php wp_dashboard(); ?>
   131 <?php wp_dashboard(); ?>
   114 
   132