wp/wp-admin/index.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    27 	wp_enqueue_script( 'jquery-touch-punch' );
    27 	wp_enqueue_script( 'jquery-touch-punch' );
    28 
    28 
    29 $title = __('Dashboard');
    29 $title = __('Dashboard');
    30 $parent_file = 'index.php';
    30 $parent_file = 'index.php';
    31 
    31 
    32 if ( is_user_admin() )
       
    33 	add_screen_option('layout_columns', array('max' => 4, 'default' => 1) );
       
    34 else
       
    35 	add_screen_option('layout_columns', array('max' => 4, 'default' => 2) );
       
    36 
       
    37 $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>';
    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>';
    38 
    33 
    39 // Not using chaining here, so as to be parseable by PHP4.
    34 // Not using chaining here, so as to be parseable by PHP4.
    40 $screen = get_current_screen();
    35 $screen = get_current_screen();
    41 
    36 
    45 	'content' => $help,
    40 	'content' => $help,
    46 ) );
    41 ) );
    47 
    42 
    48 // Help tabs
    43 // Help tabs
    49 
    44 
    50 $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>';
    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>';
    51 $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>';
    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>';
    52 
    47 
    53 $screen->add_help_tab( array(
    48 $screen->add_help_tab( array(
    54 	'id'      => 'help-navigation',
    49 	'id'      => 'help-navigation',
    55 	'title'   => __('Navigation'),
    50 	'title'   => __( 'Navigation' ),
    56 	'content' => $help,
    51 	'content' => $help,
    57 ) );
    52 ) );
    58 
    53 
    59 $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>';
    60 $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>';
    55 $help .= '<p>' . __( '<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>';
    61 $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> - 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>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>';
    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>';
    63 
    58 
    64 $screen->add_help_tab( array(
    59 $screen->add_help_tab( array(
    65 	'id'      => 'help-layout',
    60 	'id'      => 'help-layout',
    66 	'title'   => __('Layout'),
    61 	'title'   => __( 'Layout' ),
    67 	'content' => $help,
    62 	'content' => $help,
    68 ) );
    63 ) );
    69 
    64 
    70 $help  = '<p>' . __('The boxes on your Dashboard screen are:') . '</p>';
    65 $help  = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
    71 if ( current_user_can( 'edit_posts' ) )
    66 if ( current_user_can( 'edit_posts' ) )
    72 	$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>';
    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>';
    73 if ( current_user_can( 'moderate_comments' ) )
    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>';
    74 	$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>';
    69 if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
    75 if ( current_user_can( 'publish_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>';
    76 	$help .= '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>';
       
    77 if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
       
    78 	$help .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>';
       
    79 	$help .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>';
       
    80 }
       
    81 $help .= '<p>' . __('<strong>WordPress Blog</strong> - Latest news from the official WordPress project.') . '</p>';
       
    82 $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>';
       
    83 if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
    71 if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
    84 	$help .= '<p>' . __('<strong>Plugins</strong> - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.') . '</p>';
    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>';
       
    73 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>';
    85 if ( current_user_can( 'edit_theme_options' ) )
    75 if ( current_user_can( 'edit_theme_options' ) )
    86 	$help .= '<p>' . __('<strong>Welcome</strong> - Shows links for some of the most common tasks when setting up a new site.') . '</p>';
    76 	$help .= '<p>' . __( '<strong>Welcome</strong> - Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
    87 
    77 
    88 $screen->add_help_tab( array(
    78 $screen->add_help_tab( array(
    89 	'id'      => 'help-content',
    79 	'id'      => 'help-content',
    90 	'title'   => __('Content'),
    80 	'title'   => __( 'Content' ),
    91 	'content' => $help,
    81 	'content' => $help,
    92 ) );
    82 ) );
    93 
    83 
    94 unset( $help );
    84 unset( $help );
    95 
    85 
    96 $screen->set_help_sidebar(
    86 $screen->set_help_sidebar(
    97 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    87 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    98 	'<p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' .
    88 	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' .
    99 	'<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
    89 	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
   100 );
    90 );
   101 
    91 
   102 include (ABSPATH . 'wp-admin/admin-header.php');
    92 include( ABSPATH . 'wp-admin/admin-header.php' );
   103 
       
   104 $today = current_time('mysql', 1);
       
   105 ?>
    93 ?>
   106 
    94 
   107 <div class="wrap">
    95 <div class="wrap">
   108 <?php screen_icon(); ?>
    96 	<h2><?php echo esc_html( $title ); ?></h2>
   109 <h2><?php echo esc_html( $title ); ?></h2>
       
   110 
    97 
   111 <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
    98 <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
   112 	$classes = 'welcome-panel';
    99 	$classes = 'welcome-panel';
   113 
   100 
   114 	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
   101 	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
   115 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
   102 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
   116 	$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
   103 	$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
   117 	if ( $hide )
   104 	if ( $hide )
   118 		$classes .= ' hidden'; ?>
   105 		$classes .= ' hidden'; ?>
   119 
   106 
   120  	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
   107 	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
   121  		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
   108 		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
   122 		<a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php _e( 'Dismiss' ); ?></a>
   109 		<a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php _e( 'Dismiss' ); ?></a>
   123 		<?php
   110 		<?php
   124 		/**
   111 		/**
   125 		 * Add content to the welcome panel on the admin dashboard.
   112 		 * Add content to the welcome panel on the admin dashboard.
   126 		 *
   113 		 *
   127 		 * To remove the default welcome panel, use remove_action():
   114 		 * To remove the default welcome panel, use {@see remove_action()}:
   128 		 * <code>remove_action( 'welcome_panel', 'wp_welcome_panel' );</code>
   115 		 *
       
   116 		 *     remove_action( 'welcome_panel', 'wp_welcome_panel' );
   129 		 *
   117 		 *
   130 		 * @since 3.5.0
   118 		 * @since 3.5.0
   131 		 */
   119 		 */
   132 		do_action( 'welcome_panel' );
   120 		do_action( 'welcome_panel' );
   133 		?>
   121 		?>
   134 	</div>
   122 	</div>
   135 <?php endif; ?>
   123 <?php endif; ?>
   136 
   124 
   137 <div id="dashboard-widgets-wrap">
   125 	<div id="dashboard-widgets-wrap">
   138 
   126 	<?php wp_dashboard(); ?>
   139 <?php wp_dashboard(); ?>
   127 	</div><!-- dashboard-widgets-wrap -->
   140 
       
   141 <div class="clear"></div>
       
   142 </div><!-- dashboard-widgets-wrap -->
       
   143 
   128 
   144 </div><!-- wrap -->
   129 </div><!-- wrap -->
   145 
   130 
   146 <?php require(ABSPATH . 'wp-admin/admin-footer.php'); ?>
   131 <?php
       
   132 require( ABSPATH . 'wp-admin/admin-footer.php' );