wp/wp-admin/index.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    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 if ( current_user_can( 'edit_theme_options' ) )
    18 
    19 	wp_enqueue_script( 'customize-loader' );
    19 if ( current_user_can( 'install_plugins' ) ) {
    20 if ( current_user_can( 'install_plugins' ) )
       
    21 	wp_enqueue_script( 'plugin-install' );
    20 	wp_enqueue_script( 'plugin-install' );
       
    21 	wp_enqueue_script( 'updates' );
       
    22 }
    22 if ( current_user_can( 'upload_files' ) )
    23 if ( current_user_can( 'upload_files' ) )
    23 	wp_enqueue_script( 'media-upload' );
    24 	wp_enqueue_script( 'media-upload' );
    24 add_thickbox();
    25 add_thickbox();
    25 
    26 
    26 if ( wp_is_mobile() )
    27 if ( wp_is_mobile() )
    27 	wp_enqueue_script( 'jquery-touch-punch' );
    28 	wp_enqueue_script( 'jquery-touch-punch' );
    28 
    29 
    29 $title = __('Dashboard');
    30 $title = __('Dashboard');
    30 $parent_file = 'index.php';
    31 $parent_file = 'index.php';
    31 
    32 
    32 $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 in the upper corner.' ) . '</p>';
    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>';
    33 
    34 
    34 // Not using chaining here, so as to be parseable by PHP4.
       
    35 $screen = get_current_screen();
    35 $screen = get_current_screen();
    36 
    36 
    37 $screen->add_help_tab( array(
    37 $screen->add_help_tab( array(
    38 	'id'      => 'overview',
    38 	'id'      => 'overview',
    39 	'title'   => __( 'Overview' ),
    39 	'title'   => __( 'Overview' ),
    50 	'title'   => __( 'Navigation' ),
    50 	'title'   => __( 'Navigation' ),
    51 	'content' => $help,
    51 	'content' => $help,
    52 ) );
    52 ) );
    53 
    53 
    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>';
    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>';
    55 $help .= '<p>' . __( '<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>';
    55 $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> - 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>';
    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>';
    57 $help .= '<p>' . __( '<strong>Box Controls</strong> - 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>';
    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>';
    58 
    58 
    59 $screen->add_help_tab( array(
    59 $screen->add_help_tab( array(
    60 	'id'      => 'help-layout',
    60 	'id'      => 'help-layout',
    61 	'title'   => __( 'Layout' ),
    61 	'title'   => __( 'Layout' ),
    62 	'content' => $help,
    62 	'content' => $help,
    63 ) );
    63 ) );
    64 
    64 
    65 $help  = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
    65 $help  = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
    66 if ( current_user_can( 'edit_posts' ) )
    66 if ( current_user_can( 'edit_posts' ) )
    67 	$help .= '<p>' . __( '<strong>At A Glance</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
    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>';
    68 	$help .= '<p>' . __( '<strong>Activity</strong> - Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</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>';
    69 if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
    69 if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
    70 	$help .= '<p>' . __( "<strong>Quick Draft</strong> - 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>';
    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>';
    71 if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
    71 if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
    72 	$help .= '<p>' . __( '<strong>WordPress News</strong> - Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>, and popular and recent plugins.' ) . '</p>';
    72 	$help .= '<p>' . sprintf(
       
    73 		/* translators: %s: WordPress Planet URL */
       
    74 		__( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project, the <a href="%s">WordPress Planet</a>, and popular plugins.' ),
       
    75 		__( 'https://planet.wordpress.org/' )
       
    76 	) . '</p>';
    73 else
    77 else
    74 	$help .= '<p>' . __( '<strong>WordPress News</strong> - Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>.' ) . '</p>';
    78 	$help .= '<p>' . sprintf(
       
    79 		/* translators: %s: WordPress Planet URL */
       
    80 		__( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ),
       
    81 		__( 'https://planet.wordpress.org/' )
       
    82 	) . '</p>';
    75 if ( current_user_can( 'edit_theme_options' ) )
    83 if ( current_user_can( 'edit_theme_options' ) )
    76 	$help .= '<p>' . __( '<strong>Welcome</strong> - Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
    84 	$help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
    77 
    85 
    78 $screen->add_help_tab( array(
    86 $screen->add_help_tab( array(
    79 	'id'      => 'help-content',
    87 	'id'      => 'help-content',
    80 	'title'   => __( 'Content' ),
    88 	'title'   => __( 'Content' ),
    81 	'content' => $help,
    89 	'content' => $help,
    83 
    91 
    84 unset( $help );
    92 unset( $help );
    85 
    93 
    86 $screen->set_help_sidebar(
    94 $screen->set_help_sidebar(
    87 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    95 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    88 	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' .
    96 	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen">Documentation on Dashboard</a>' ) . '</p>' .
    89 	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
    97 	'<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
    90 );
    98 );
    91 
    99 
    92 include( ABSPATH . 'wp-admin/admin-header.php' );
   100 include( ABSPATH . 'wp-admin/admin-header.php' );
    93 ?>
   101 ?>
    94 
   102 
    95 <div class="wrap">
   103 <div class="wrap">
    96 	<h2><?php echo esc_html( $title ); ?></h2>
   104 	<h1><?php echo esc_html( $title ); ?></h1>
    97 
   105 
       
   106 <?php if ( has_action( 'try_gutenberg_panel' ) ) :
       
   107 	$classes = 'try-gutenberg-panel';
       
   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; ?>
    98 <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
   132 <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
    99 	$classes = 'welcome-panel';
   133 	$classes = 'welcome-panel';
   100 
   134 
   101 	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
   135 	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
   102 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
   136 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
   103 	$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
   137 	$hide = '0' === $option || ( '2' === $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
   104 	if ( $hide )
   138 	if ( $hide )
   105 		$classes .= ' hidden'; ?>
   139 		$classes .= ' hidden'; ?>
   106 
   140 
   107 	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
   141 	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
   108 		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
   142 		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
   109 		<a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php _e( 'Dismiss' ); ?></a>
   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>
   110 		<?php
   144 		<?php
   111 		/**
   145 		/**
   112 		 * Add content to the welcome panel on the admin dashboard.
   146 		 * Add content to the welcome panel on the admin dashboard.
   113 		 *
   147 		 *
   114 		 * To remove the default welcome panel, use {@see remove_action()}:
   148 		 * To remove the default welcome panel, use remove_action():
   115 		 *
   149 		 *
   116 		 *     remove_action( 'welcome_panel', 'wp_welcome_panel' );
   150 		 *     remove_action( 'welcome_panel', 'wp_welcome_panel' );
   117 		 *
   151 		 *
   118 		 * @since 3.5.0
   152 		 * @since 3.5.0
   119 		 */
   153 		 */
   127 	</div><!-- dashboard-widgets-wrap -->
   161 	</div><!-- dashboard-widgets-wrap -->
   128 
   162 
   129 </div><!-- wrap -->
   163 </div><!-- wrap -->
   130 
   164 
   131 <?php
   165 <?php
       
   166 wp_print_community_events_templates();
       
   167 
   132 require( ABSPATH . 'wp-admin/admin-footer.php' );
   168 require( ABSPATH . 'wp-admin/admin-footer.php' );