wp/wp-admin/index.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 
     8 
     9 /** Load WordPress Bootstrap */
     9 /** Load WordPress Bootstrap */
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
    10 require_once __DIR__ . '/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 
    42 		'title'   => __( 'Overview' ),
    42 		'title'   => __( 'Overview' ),
    43 		'content' => $help,
    43 		'content' => $help,
    44 	)
    44 	)
    45 );
    45 );
    46 
    46 
    47 // Help tabs
    47 // Help tabs.
    48 
    48 
    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>';
    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>';
    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>';
    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>';
    51 
    51 
    52 $screen->add_help_tab(
    52 $screen->add_help_tab(
    81 if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
    81 if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
    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>';
    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>';
    83 }
    83 }
    84 
    84 
    85 $help .= '<p>' . sprintf(
    85 $help .= '<p>' . sprintf(
    86 	/* translators: %s: WordPress Planet URL */
    86 	/* translators: %s: WordPress Planet URL. */
    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>.' ),
    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>.' ),
    88 	__( 'https://planet.wordpress.org/' )
    88 	__( 'https://planet.wordpress.org/' )
    89 ) . '</p>';
    89 ) . '</p>';
    90 
    90 
    91 if ( current_user_can( 'edit_theme_options' ) ) {
    91 if ( current_user_can( 'edit_theme_options' ) ) {
   102 
   102 
   103 unset( $help );
   103 unset( $help );
   104 
   104 
   105 $screen->set_help_sidebar(
   105 $screen->set_help_sidebar(
   106 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   106 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   107 	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen">Documentation on Dashboard</a>' ) . '</p>' .
   107 	'<p>' . __( '<a href="https://wordpress.org/support/article/dashboard-screen/">Documentation on Dashboard</a>' ) . '</p>' .
   108 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   108 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   109 );
   109 );
   110 
   110 
   111 include( ABSPATH . 'wp-admin/admin-header.php' );
   111 require_once ABSPATH . 'wp-admin/admin-header.php';
   112 ?>
   112 ?>
   113 
   113 
   114 <div class="wrap">
   114 <div class="wrap">
   115 	<h1><?php echo esc_html( $title ); ?></h1>
   115 	<h1><?php echo esc_html( $title ); ?></h1>
   116 
   116 
       
   117 	<?php
       
   118 	if ( ! empty( $_GET['admin_email_remind_later'] ) ) :
       
   119 		/** This filter is documented in wp-login.php */
       
   120 		$remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS );
       
   121 		$postponed_time  = get_option( 'admin_email_lifespan' );
       
   122 
       
   123 		/*
       
   124 		 * Calculate how many seconds it's been since the reminder was postponed.
       
   125 		 * This allows us to not show it if the query arg is set, but visited due to caches, bookmarks or similar.
       
   126 		 */
       
   127 		$time_passed = time() - ( $postponed_time - $remind_interval );
       
   128 
       
   129 		// Only show the dashboard notice if it's been less than a minute since the message was postponed.
       
   130 		if ( $time_passed < MINUTE_IN_SECONDS ) :
       
   131 			?>
       
   132 		<div class="notice notice-success is-dismissible">
       
   133 			<p>
       
   134 				<?php
       
   135 				printf(
       
   136 					/* translators: %s: Human-readable time interval. */
       
   137 					__( 'The admin email verification page will reappear after %s.' ),
       
   138 					human_time_diff( time() + $remind_interval )
       
   139 				);
       
   140 				?>
       
   141 			</p>
       
   142 		</div>
       
   143 		<?php endif; ?>
       
   144 	<?php endif; ?>
       
   145 
   117 <?php
   146 <?php
   118 if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
   147 if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
   119 	$classes = 'welcome-panel';
   148 	$classes = 'welcome-panel';
   120 
   149 
   121 	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
   150 	$option = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
   122 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
   151 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner.
   123 	$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
   152 	$hide = ( 0 === $option || ( 2 === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) );
   124 	if ( $hide ) {
   153 	if ( $hide ) {
   125 		$classes .= ' hidden';
   154 		$classes .= ' hidden';
   126 	}
   155 	}
   127 	?>
   156 	?>
   128 
   157 
   151 </div><!-- wrap -->
   180 </div><!-- wrap -->
   152 
   181 
   153 <?php
   182 <?php
   154 wp_print_community_events_templates();
   183 wp_print_community_events_templates();
   155 
   184 
   156 require( ABSPATH . 'wp-admin/admin-footer.php' );
   185 require_once ABSPATH . 'wp-admin/admin-footer.php';