[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/ -> index.php (source)

   1  <?php
   2  /**
   3   * Dashboard Administration Screen
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** Load WordPress Bootstrap */
  10  require_once  __DIR__ . '/admin.php';
  11  
  12  /** Load WordPress dashboard API */
  13  require_once  ABSPATH . 'wp-admin/includes/dashboard.php';
  14  
  15  wp_dashboard_setup();
  16  
  17  wp_enqueue_script( 'dashboard' );
  18  
  19  if ( current_user_can( 'install_plugins' ) ) {
  20      wp_enqueue_script( 'plugin-install' );
  21      wp_enqueue_script( 'updates' );
  22  }
  23  if ( current_user_can( 'upload_files' ) ) {
  24      wp_enqueue_script( 'media-upload' );
  25  }
  26  add_thickbox();
  27  
  28  if ( wp_is_mobile() ) {
  29      wp_enqueue_script( 'jquery-touch-punch' );
  30  }
  31  
  32  // Used in the HTML title tag.
  33  $title       = __( 'Dashboard' );
  34  $parent_file = 'index.php';
  35  
  36  $help  = '<p>' . __( 'Welcome to your WordPress Dashboard!' ) . '</p>';
  37  $help .= '<p>' . __( 'The Dashboard is the first place you will come to every time you log into your site. It is where you will find all your WordPress tools. If you need help, just click the &#8220;Help&#8221; tab above the screen title.' ) . '</p>';
  38  
  39  $screen = get_current_screen();
  40  
  41  $screen->add_help_tab(
  42      array(
  43          'id'      => 'overview',
  44          'title'   => __( 'Overview' ),
  45          'content' => $help,
  46      )
  47  );
  48  
  49  // Help tabs.
  50  
  51  $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>';
  52  $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>';
  53  
  54  $screen->add_help_tab(
  55      array(
  56          'id'      => 'help-navigation',
  57          'title'   => __( 'Navigation' ),
  58          'content' => $help,
  59      )
  60  );
  61  
  62  $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>';
  63  $help .= '<p>' . __( '<strong>Screen Options</strong> &mdash; Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>';
  64  $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>';
  65  $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>';
  66  
  67  $screen->add_help_tab(
  68      array(
  69          'id'      => 'help-layout',
  70          'title'   => __( 'Layout' ),
  71          'content' => $help,
  72      )
  73  );
  74  
  75  $help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
  76  
  77  if ( current_user_can( 'edit_theme_options' ) ) {
  78      $help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
  79  }
  80  
  81  if ( current_user_can( 'view_site_health_checks' ) ) {
  82      $help .= '<p>' . __( '<strong>Site Health Status</strong> &mdash; Informs you of any potential issues that should be addressed to improve the performance or security of your website.' ) . '</p>';
  83  }
  84  
  85  if ( current_user_can( 'edit_posts' ) ) {
  86      $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>';
  87  }
  88  
  89  $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>';
  90  
  91  if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
  92      $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>';
  93  }
  94  
  95  $help .= '<p>' . sprintf(
  96      /* translators: %s: WordPress Planet URL. */
  97      __( '<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>.' ),
  98      __( 'https://planet.wordpress.org/' )
  99  ) . '</p>';
 100  
 101  $screen->add_help_tab(
 102      array(
 103          'id'      => 'help-content',
 104          'title'   => __( 'Content' ),
 105          'content' => $help,
 106      )
 107  );
 108  
 109  unset( $help );
 110  
 111  $wp_version = get_bloginfo( 'version', 'display' );
 112  /* translators: %s: WordPress version. */
 113  $wp_version_text = sprintf( __( 'Version %s' ), $wp_version );
 114  $is_dev_version  = preg_match( '/alpha|beta|RC/', $wp_version );
 115  
 116  if ( ! $is_dev_version ) {
 117      $version_url = sprintf(
 118          /* translators: %s: WordPress version. */
 119          esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ),
 120          sanitize_title( $wp_version )
 121      );
 122  
 123      $wp_version_text = sprintf(
 124          '<a href="%1$s">%2$s</a>',
 125          $version_url,
 126          $wp_version_text
 127      );
 128  }
 129  
 130  $screen->set_help_sidebar(
 131      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 132      '<p>' . __( '<a href="https://wordpress.org/documentation/article/dashboard-screen/">Documentation on Dashboard</a>' ) . '</p>' .
 133      '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' .
 134      '<p>' . $wp_version_text . '</p>'
 135  );
 136  
 137  require_once  ABSPATH . 'wp-admin/admin-header.php';
 138  ?>
 139  
 140  <div class="wrap">
 141      <h1><?php echo esc_html( $title ); ?></h1>
 142  
 143      <?php
 144      if ( ! empty( $_GET['admin_email_remind_later'] ) ) :
 145          /** This filter is documented in wp-login.php */
 146          $remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS );
 147          $postponed_time  = get_option( 'admin_email_lifespan' );
 148  
 149          /*
 150           * Calculate how many seconds it's been since the reminder was postponed.
 151           * This allows us to not show it if the query arg is set, but visited due to caches, bookmarks or similar.
 152           */
 153          $time_passed = time() - ( $postponed_time - $remind_interval );
 154  
 155          // Only show the dashboard notice if it's been less than a minute since the message was postponed.
 156          if ( $time_passed < MINUTE_IN_SECONDS ) :
 157              $message = sprintf(
 158                  /* translators: %s: Human-readable time interval. */
 159                  __( 'The admin email verification page will reappear after %s.' ),
 160                  human_time_diff( time() + $remind_interval )
 161              );
 162              wp_admin_notice(
 163                  $message,
 164                  array(
 165                      'type'        => 'success',
 166                      'dismissible' => true,
 167                  )
 168              );
 169          endif;
 170      endif;
 171      ?>
 172  
 173  <?php
 174  if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
 175      $classes = 'welcome-panel';
 176  
 177      $option = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
 178      // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner.
 179      $hide = ( 0 === $option || ( 2 === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) );
 180      if ( $hide ) {
 181          $classes .= ' hidden';
 182      }
 183      ?>
 184  
 185      <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
 186          <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
 187          <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>
 188          <?php
 189          /**
 190           * Fires when adding content to the welcome panel on the admin dashboard.
 191           *
 192           * To remove the default welcome panel, use remove_action():
 193           *
 194           *     remove_action( 'welcome_panel', 'wp_welcome_panel' );
 195           *
 196           * @since 3.5.0
 197           */
 198          do_action( 'welcome_panel' );
 199          ?>
 200      </div>
 201  <?php endif; ?>
 202  
 203      <div id="dashboard-widgets-wrap">
 204      <?php wp_dashboard(); ?>
 205      </div><!-- dashboard-widgets-wrap -->
 206  
 207  </div><!-- wrap -->
 208  
 209  <?php
 210  wp_print_community_events_templates();
 211  
 212  require_once  ABSPATH . 'wp-admin/admin-footer.php';


Generated : Mon Mar 18 08:20:01 2024 Cross-referenced by PHPXref