wp/wp-admin/index.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
     8 
     8 
     9 /** Load WordPress Bootstrap */
     9 /** Load WordPress Bootstrap */
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
    11 
    11 
    12 /** Load WordPress dashboard API */
    12 /** Load WordPress dashboard API */
    13 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
    13 require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
    14 
    14 
    15 wp_dashboard_setup();
    15 wp_dashboard_setup();
    16 
    16 
    17 wp_enqueue_script( 'dashboard' );
    17 wp_enqueue_script( 'dashboard' );
    18 
    18 
    19 if ( current_user_can( 'install_plugins' ) ) {
    19 if ( current_user_can( 'install_plugins' ) ) {
    20 	wp_enqueue_script( 'plugin-install' );
    20 	wp_enqueue_script( 'plugin-install' );
    21 	wp_enqueue_script( 'updates' );
    21 	wp_enqueue_script( 'updates' );
    22 }
    22 }
    23 if ( current_user_can( 'upload_files' ) )
    23 if ( current_user_can( 'upload_files' ) ) {
    24 	wp_enqueue_script( 'media-upload' );
    24 	wp_enqueue_script( 'media-upload' );
       
    25 }
    25 add_thickbox();
    26 add_thickbox();
    26 
    27 
    27 if ( wp_is_mobile() )
    28 if ( wp_is_mobile() ) {
    28 	wp_enqueue_script( 'jquery-touch-punch' );
    29 	wp_enqueue_script( 'jquery-touch-punch' );
       
    30 }
    29 
    31 
    30 $title = __('Dashboard');
    32 $title       = __( 'Dashboard' );
    31 $parent_file = 'index.php';
    33 $parent_file = 'index.php';
    32 
    34 
    33 $help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab above the screen title.' ) . '</p>';
    35 $help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab above the screen title.' ) . '</p>';
    34 
    36 
    35 $screen = get_current_screen();
    37 $screen = get_current_screen();
    36 
    38 
    37 $screen->add_help_tab( array(
    39 $screen->add_help_tab(
    38 	'id'      => 'overview',
    40 	array(
    39 	'title'   => __( 'Overview' ),
    41 		'id'      => 'overview',
    40 	'content' => $help,
    42 		'title'   => __( 'Overview' ),
    41 ) );
    43 		'content' => $help,
       
    44 	)
       
    45 );
    42 
    46 
    43 // Help tabs
    47 // Help tabs
    44 
    48 
    45 $help  = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>';
    49 $help  = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>';
    46 $help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>';
    50 $help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>';
    47 
    51 
    48 $screen->add_help_tab( array(
    52 $screen->add_help_tab(
    49 	'id'      => 'help-navigation',
    53 	array(
    50 	'title'   => __( 'Navigation' ),
    54 		'id'      => 'help-navigation',
    51 	'content' => $help,
    55 		'title'   => __( 'Navigation' ),
    52 ) );
    56 		'content' => $help,
       
    57 	)
       
    58 );
    53 
    59 
    54 $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>';
    60 $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>';
    55 $help .= '<p>' . __( '<strong>Screen Options</strong> &mdash; Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>';
    61 $help .= '<p>' . __( '<strong>Screen Options</strong> &mdash; Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>';
    56 $help .= '<p>' . __( '<strong>Drag and Drop</strong> &mdash; 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>';
    62 $help .= '<p>' . __( '<strong>Drag and Drop</strong> &mdash; 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>';
    57 $help .= '<p>' . __( '<strong>Box Controls</strong> &mdash; Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.' ) . '</p>';
    63 $help .= '<p>' . __( '<strong>Box Controls</strong> &mdash; Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.' ) . '</p>';
    58 
    64 
    59 $screen->add_help_tab( array(
    65 $screen->add_help_tab(
    60 	'id'      => 'help-layout',
    66 	array(
    61 	'title'   => __( 'Layout' ),
    67 		'id'      => 'help-layout',
    62 	'content' => $help,
    68 		'title'   => __( 'Layout' ),
    63 ) );
    69 		'content' => $help,
       
    70 	)
       
    71 );
    64 
    72 
    65 $help  = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
    73 $help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
    66 if ( current_user_can( 'edit_posts' ) )
    74 
       
    75 if ( current_user_can( 'edit_posts' ) ) {
    67 	$help .= '<p>' . __( '<strong>At A Glance</strong> &mdash; Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
    76 	$help .= '<p>' . __( '<strong>At A Glance</strong> &mdash; Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
    68 	$help .= '<p>' . __( '<strong>Activity</strong> &mdash; Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>';
    77 }
    69 if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
    78 
    70 	$help .= '<p>' . __( "<strong>Quick Draft</strong> &mdash; Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>';
    79 $help .= '<p>' . __( '<strong>Activity</strong> &mdash; Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>';
    71 if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
    80 
    72 	$help .= '<p>' . sprintf(
    81 if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
    73 		/* translators: %s: WordPress Planet URL */
    82 	$help .= '<p>' . __( "<strong>Quick Draft</strong> &mdash; Allows you to create a new post and save it as a draft. Also displays links to the 3 most recent draft posts you've started." ) . '</p>';
    74 		__( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project, the <a href="%s">WordPress Planet</a>, and popular plugins.' ),
    83 }
    75 		__( 'https://planet.wordpress.org/' )
    84 
    76 	) . '</p>';
    85 $help .= '<p>' . sprintf(
    77 else
    86 	/* translators: %s: WordPress Planet URL */
    78 	$help .= '<p>' . sprintf(
    87 	__( '<strong>WordPress Events and News</strong> &mdash; Upcoming events near you as well as the latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ),
    79 		/* translators: %s: WordPress Planet URL */
    88 	__( 'https://planet.wordpress.org/' )
    80 		__( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ),
    89 ) . '</p>';
    81 		__( 'https://planet.wordpress.org/' )
    90 
    82 	) . '</p>';
    91 if ( current_user_can( 'edit_theme_options' ) ) {
    83 if ( current_user_can( 'edit_theme_options' ) )
       
    84 	$help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
    92 	$help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
       
    93 }
    85 
    94 
    86 $screen->add_help_tab( array(
    95 $screen->add_help_tab(
    87 	'id'      => 'help-content',
    96 	array(
    88 	'title'   => __( 'Content' ),
    97 		'id'      => 'help-content',
    89 	'content' => $help,
    98 		'title'   => __( 'Content' ),
    90 ) );
    99 		'content' => $help,
       
   100 	)
       
   101 );
    91 
   102 
    92 unset( $help );
   103 unset( $help );
    93 
   104 
    94 $screen->set_help_sidebar(
   105 $screen->set_help_sidebar(
    95 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   106 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    96 	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen">Documentation on Dashboard</a>' ) . '</p>' .
   107 	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen">Documentation on Dashboard</a>' ) . '</p>' .
    97 	'<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
   108 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    98 );
   109 );
    99 
   110 
   100 include( ABSPATH . 'wp-admin/admin-header.php' );
   111 include( ABSPATH . 'wp-admin/admin-header.php' );
   101 ?>
   112 ?>
   102 
   113 
   103 <div class="wrap">
   114 <div class="wrap">
   104 	<h1><?php echo esc_html( $title ); ?></h1>
   115 	<h1><?php echo esc_html( $title ); ?></h1>
   105 
   116 
   106 <?php if ( has_action( 'try_gutenberg_panel' ) ) :
   117 <?php
   107 	$classes = 'try-gutenberg-panel';
   118 if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
   108 
       
   109 	$option = get_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', true );
       
   110 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
       
   111 	$hide = '0' === $option || ( '2' === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) );
       
   112 	if ( $hide )
       
   113 		$classes .= ' hidden'; ?>
       
   114 
       
   115 	<div id="try-gutenberg-panel" class="<?php echo esc_attr( $classes ); ?>">
       
   116 		<?php wp_nonce_field( 'try-gutenberg-panel-nonce', 'trygutenbergpanelnonce', false ); ?>
       
   117 		<a class="try-gutenberg-panel-close" href="<?php echo esc_url( admin_url( '?try_gutenberg=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the Try Gutenberg panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>
       
   118 		<?php
       
   119 		/**
       
   120 		 * Add content to the Try Gutenberg panel on the admin dashboard.
       
   121 		 *
       
   122 		 * To remove the Try Gutenberg panel, use remove_action():
       
   123 		 *
       
   124 		 *     remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
       
   125 		 *
       
   126 		 * @since 4.9.8
       
   127 		 */
       
   128 		do_action( 'try_gutenberg_panel' );
       
   129 		?>
       
   130 	</div>
       
   131 <?php endif; ?>
       
   132 <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
       
   133 	$classes = 'welcome-panel';
   119 	$classes = 'welcome-panel';
   134 
   120 
   135 	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
   121 	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
   136 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
   122 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
   137 	$hide = '0' === $option || ( '2' === $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
   123 	$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
   138 	if ( $hide )
   124 	if ( $hide ) {
   139 		$classes .= ' hidden'; ?>
   125 		$classes .= ' hidden';
       
   126 	}
       
   127 	?>
   140 
   128 
   141 	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
   129 	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
   142 		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
   130 		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
   143 		<a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the welcome panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>
   131 		<a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the welcome panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>
   144 		<?php
   132 		<?php