[ Index ]

PHP Cross Reference of WordPress

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  $title       = __( 'Dashboard' );
  33  $parent_file = 'index.php';
  34  
  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>';
  36  
  37  $screen = get_current_screen();
  38  
  39  $screen->add_help_tab(
  40      array(
  41          'id'      => 'overview',
  42          'title'   => __( 'Overview' ),
  43          'content' => $help,
  44      )
  45  );
  46  
  47  // Help tabs.
  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>';
  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  
  52  $screen->add_help_tab(
  53      array(
  54          'id'      => 'help-navigation',
  55          'title'   => __( 'Navigation' ),
  56          'content' => $help,
  57      )
  58  );
  59  
  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>';
  61  $help .= '<p>' . __( '<strong>Screen Options</strong> &mdash; Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</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>';
  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>';
  64  
  65  $screen->add_help_tab(
  66      array(
  67          'id'      => 'help-layout',
  68          'title'   => __( 'Layout' ),
  69          'content' => $help,
  70      )
  71  );
  72  
  73  $help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
  74  
  75  if ( current_user_can( 'edit_theme_options' ) ) {
  76      $help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
  77  }
  78  
  79  if ( current_user_can( 'view_site_health_checks' ) ) {
  80      $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>';
  81  }
  82  
  83  if ( current_user_can( 'edit_posts' ) ) {
  84      $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>';
  85  }
  86  
  87  $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>';
  88  
  89  if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
  90      $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>';
  91  }
  92  
  93  $help .= '<p>' . sprintf(
  94      /* translators: %s: WordPress Planet URL. */
  95      __( '<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>.' ),
  96      __( 'https://planet.wordpress.org/' )
  97  ) . '</p>';
  98  
  99  $screen->add_help_tab(
 100      array(
 101          'id'      => 'help-content',
 102          'title'   => __( 'Content' ),
 103          'content' => $help,
 104      )
 105  );
 106  
 107  unset( $help );
 108  
 109  $screen->set_help_sidebar(
 110      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 111      '<p>' . __( '<a href="https://wordpress.org/support/article/dashboard-screen/">Documentation on Dashboard</a>' ) . '</p>' .
 112      '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
 113  );
 114  
 115  require_once ABSPATH . 'wp-admin/admin-header.php';
 116  ?>
 117  
 118  <div class="wrap">
 119      <h1><?php echo esc_html( $title ); ?></h1>
 120  
 121      <?php
 122      if ( ! empty( $_GET['admin_email_remind_later'] ) ) :
 123          /** This filter is documented in wp-login.php */
 124          $remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS );
 125          $postponed_time  = get_option( 'admin_email_lifespan' );
 126  
 127          /*
 128           * Calculate how many seconds it's been since the reminder was postponed.
 129           * This allows us to not show it if the query arg is set, but visited due to caches, bookmarks or similar.
 130           */
 131          $time_passed = time() - ( $postponed_time - $remind_interval );
 132  
 133          // Only show the dashboard notice if it's been less than a minute since the message was postponed.
 134          if ( $time_passed < MINUTE_IN_SECONDS ) :
 135              ?>
 136          <div class="notice notice-success is-dismissible">
 137              <p>
 138                  <?php
 139                  printf(
 140                      /* translators: %s: Human-readable time interval. */
 141                      __( 'The admin email verification page will reappear after %s.' ),
 142                      human_time_diff( time() + $remind_interval )
 143                  );
 144                  ?>
 145              </p>
 146          </div>
 147          <?php endif; ?>
 148      <?php endif; ?>
 149  
 150  <?php
 151  if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
 152      $classes = 'welcome-panel';
 153  
 154      $option = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
 155      // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner.
 156      $hide = ( 0 === $option || ( 2 === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) );
 157      if ( $hide ) {
 158          $classes .= ' hidden';
 159      }
 160      ?>
 161  
 162      <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
 163          <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
 164          <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>
 165          <?php
 166          /**
 167           * Add content to the welcome panel on the admin dashboard.
 168           *
 169           * To remove the default welcome panel, use remove_action():
 170           *
 171           *     remove_action( 'welcome_panel', 'wp_welcome_panel' );
 172           *
 173           * @since 3.5.0
 174           */
 175          do_action( 'welcome_panel' );
 176          ?>
 177      </div>
 178  <?php endif; ?>
 179  
 180      <div id="dashboard-widgets-wrap">
 181      <?php wp_dashboard(); ?>
 182      </div><!-- dashboard-widgets-wrap -->
 183  
 184  </div><!-- wrap -->
 185  
 186  <?php
 187  wp_print_community_events_templates();
 188  
 189  require_once ABSPATH . 'wp-admin/admin-footer.php';


Generated: Tue Jan 26 01:00:03 2021 Cross-referenced by PHPXref 0.7.1