[ Index ]

WordPress Source Cross Reference

title

Body

[close]

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

   1  <?php
   2  require_once ('admin.php'); 
   3  $title = __('Dashboard'); 
   4  require_once ('admin-header.php');
   5  require_once (ABSPATH . WPINC . '/rss.php');
   6  
   7  $today = current_time('mysql', 1);
   8  ?>
   9  
  10  <div class="wrap">
  11  
  12  <h2><?php _e('Dashboard'); ?></h2>
  13  
  14  <div id="zeitgeist">
  15  <h2><?php _e('Latest Activity'); ?></h2>
  16  
  17  <?php
  18  $rss = @fetch_rss('http://feeds.technorati.com/cosmos/rss/?url='. trailingslashit(get_option('home')) .'&partner=wordpress');
  19  if ( isset($rss->items) && 0 != count($rss->items) ) {
  20  ?>
  21  <div id="incominglinks">
  22  <h3><?php _e('Incoming Links'); ?> <cite><a href="http://www.technorati.com/search/<?php echo trailingslashit(get_option('home')); ?>?partner=wordpress"><?php _e('More &raquo;'); ?></a></cite></h3>
  23  <ul>
  24  <?php
  25  $rss->items = array_slice($rss->items, 0, 10);
  26  foreach ($rss->items as $item ) {
  27  ?>
  28      <li><a href="<?php echo wp_filter_kses($item['link']); ?>"><?php echo wp_specialchars($item['title']); ?></a></li>
  29  <?php } ?>
  30  </ul>
  31  </div>
  32  <?php } ?>
  33  
  34  <?php
  35  $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 5");
  36  $numcomments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
  37  
  38  if ( $comments || $numcomments ) :
  39  ?>
  40  <div>
  41  <h3><?php _e('Comments'); ?> <a href="edit-comments.php" title="<?php _e('More comments...'); ?>">&raquo;</a></h3>
  42  
  43  <?php if ( $numcomments ) : ?>
  44  <p><strong><a href="moderation.php"><?php echo sprintf(__('Comments in moderation (%s)'), number_format($numcomments) ); ?> &raquo;</a></strong></p>
  45  <?php endif; ?>
  46  
  47  <ul>
  48  <?php 
  49  if ( $comments ) {
  50  foreach ($comments as $comment) {
  51      echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
  52      edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 
  53      echo '</li>';
  54  }
  55  }
  56  ?>
  57  </ul>
  58  </div>
  59  <?php endif; ?>
  60  
  61  <?php
  62  if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
  63  ?>
  64  <div>
  65  <h3><?php _e('Posts'); ?> <a href="edit.php" title="<?php _e('More posts...'); ?>">&raquo;</a></h3>
  66  <ul>
  67  <?php
  68  foreach ($recentposts as $post) {
  69      if ($post->post_title == '')
  70          $post->post_title = sprintf(__('Post #%s'), $post->ID);
  71      echo "<li><a href='post.php?action=edit&amp;post=$post->ID'>";
  72      the_title();
  73      echo '</a></li>';
  74  }
  75  ?>
  76  </ul>
  77  </div>
  78  <?php endif; ?>
  79  
  80  <?php
  81  if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC") ) :
  82  ?> 
  83  <div>
  84  <h3><?php _e('Scheduled Entries:') ?></h3>
  85  <ul>
  86  <?php
  87  foreach ($scheduled as $post) {
  88      if ($post->post_title == '')
  89          $post->post_title = sprintf(__('Post #%s'), $post->ID);
  90      echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&amp;post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') ))  . "</li>";
  91  }
  92  ?> 
  93  </ul>
  94  </div>
  95  <?php endif; ?>
  96  
  97  <div>
  98  <h3><?php _e('Blog Stats'); ?></h3>
  99  <?php
 100  $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
 101  if (0 < $numposts) $numposts = number_format($numposts); 
 102  
 103  $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
 104  if (0 < $numcomms) $numcomms = number_format($numcomms);
 105  
 106  $numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
 107  if (0 < $numcats) $numcats = number_format($numcats);
 108  ?>
 109  <p><?php printf(__('There are currently %1$s <a href="%2$s" title="Posts">posts</a> and %3$s <a href="%4$s" title="Comments">comments</a>, contained within %5$s <a href="%6$s" title="categories">categories</a>.'), $numposts, 'edit.php',  $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>
 110  </div>
 111  
 112  <?php do_action('activity_box_end'); ?>
 113  </div>
 114  
 115  <h3><?php _e('Welcome to WordPress'); ?></h3>
 116  
 117  <p><?php _e('Use these links to get started:'); ?></p>
 118  
 119  <ul>
 120  <li><a href="post-new.php"><?php _e('Write a post'); ?></a></li>
 121  <li><a href="profile.php"><?php _e('Update your profile or change your password'); ?></a></li>
 122  <li><a href="link-add.php"><?php _e('Add a bookmark to your blogroll'); ?></a></li>
 123  <li><a href="themes.php"><?php _e('Change your site&#8217;s look or theme'); ?></a></li>
 124  </ul>
 125  
 126  <p><?php _e("Below is the latest news from the official WordPress development blog, click on a title to read the full entry. If you need help with WordPress please see our <a href='http://codex.wordpress.org/'>great documentation</a> or if that doesn't help visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p>
 127  <?php
 128  $rss = @fetch_rss('http://wordpress.org/development/feed/');
 129  if ( isset($rss->items) && 0 != count($rss->items) ) {
 130  ?>
 131  <h3><?php _e('WordPress Development Blog'); ?></h3>
 132  <?php
 133  $rss->items = array_slice($rss->items, 0, 3);
 134  foreach ($rss->items as $item ) {
 135  ?>
 136  <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> &#8212; <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4>
 137  <p><?php echo $item['description']; ?></p>
 138  <?php
 139      }
 140  }
 141  ?>
 142  
 143  
 144  <?php
 145  $rss = @fetch_rss('http://planet.wordpress.org/feed/');
 146  if ( isset($rss->items) && 0 != count($rss->items) ) {
 147  ?>
 148  <div id="planetnews">
 149  <h3><?php _e('Other WordPress News'); ?> <a href="http://planet.wordpress.org/"><?php _e('more'); ?> &raquo;</a></h3>
 150  <ul>
 151  <?php
 152  $rss->items = array_slice($rss->items, 0, 20);
 153  foreach ($rss->items as $item ) {
 154  ?>
 155  <li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li>
 156  <?php
 157      }
 158  ?>
 159  </ul>
 160  </div>
 161  <?php
 162  }
 163  ?>
 164  <div style="clear: both">&nbsp;
 165  <br clear="all" />
 166  </div>
 167  </div>
 168  
 169  <?php
 170  require ('./admin-footer.php');
 171  ?>

Your comment here...

Name: Location:
Comments:


List: Classes | Functions | Variables | Constants | Tables

Generated: Sat Jul 15 11:57:04 2006 Courtesy of Taragana