2003-06-01 03:47:29 -04:00
< ? php
2007-09-03 19:32:58 -04:00
require_once ( 'admin.php' );
2006-11-18 18:12:39 -05:00
function index_js () {
?>
< script type = " text/javascript " >
2007-05-28 16:46:03 -04:00
jQuery ( function () {
jQuery ( '#incominglinks' ) . load ( 'index-extra.php?jax=incominglinks' );
jQuery ( '#devnews' ) . load ( 'index-extra.php?jax=devnews' );
2007-12-20 15:23:30 -05:00
// jQuery('#planetnews').load('index-extra.php?jax=planetnews');
2007-05-28 16:46:03 -04:00
});
2006-11-18 18:12:39 -05:00
</ script >
< ? php
}
add_action ( 'admin_head' , 'index_js' );
2007-06-01 21:01:57 -04:00
wp_enqueue_script ( 'jquery' );
2006-11-18 18:12:39 -05:00
2007-09-03 19:32:58 -04:00
$title = __ ( 'Dashboard' );
2006-11-18 02:31:29 -05:00
$parent_file = 'index.php' ;
2004-12-18 19:10:10 -05:00
require_once ( 'admin-header.php' );
2003-06-01 03:47:29 -04:00
2004-12-19 02:26:43 -05:00
$today = current_time ( 'mysql' , 1 );
2004-12-18 19:10:10 -05:00
?>
2003-06-01 03:47:29 -04:00
2004-12-18 19:10:10 -05:00
< div class = " wrap " >
2005-08-07 06:45:06 -04:00
2007-12-20 15:23:30 -05:00
< h2 >< ? php _e ( 'Dashboard' ); ?> </h2>
2005-08-07 06:45:06 -04:00
2007-12-20 15:23:30 -05:00
< div id = " rightnow " >
< h3 >< ? php _e ( 'Right Now' ); ?> <a href="post-new.php"><?php _e('Write a New Page'); ?></a> <a href="page-new.php"><?php _e('Write a New Post'); ?></a></h3>
2005-08-07 06:45:06 -04:00
2007-12-20 15:23:30 -05:00
< ? php
// I'm not sure how to internationalize this, Nikolay?
$num_posts = $wpdb -> get_var ( " SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' " );
$num_pages = $wpdb -> get_var ( " SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish' " );
$num_drafts = $wpdb -> get_var ( " SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' " );
$num_future = $wpdb -> get_var ( " SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' " );
$num_comments = $wpdb -> get_var ( " SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1' " );
$num_cats = wp_count_terms ( 'category' );
$num_tags = wp_count_terms ( 'post_tag' );
$sentence = 'You have ' ;
if ( $num_posts )
$sentence .= '<a href="edit.php">' . number_format ( $num_posts ) . ' posts</a>, ' ;
if ( $num_pages )
$sentence .= '<a href="edit-pages.php">' . number_format ( $num_pages ) . ' pages</a>, ' ;
if ( $num_drafts )
$sentence .= '<a href="edit.php?post_status=draft">' . number_format ( $num_drafts ) . ' drafts</a>, ' ;
if ( $num_future )
$sentence .= '<a href="edit.php?post_status=future">' . number_format ( $num_future ) . ' scheduled posts</a>, ' ;
// There is always a category
$sentence .= 'contained within <a href="categories.php">' . number_format ( $num_cats ) . ' categories</a> and ' . number_format ( $num_tags ) . ' tags.' ;
?>
< p >< ? php echo $sentence ; ?> </p>
< ? php
$ct = current_theme_info ();
$sidebars_widgets = wp_get_sidebars_widgets ();
$num_widgets = count ( $sidebar_widgets );
?>
< p > You use the < ? php echo $ct -> title ; ?> theme with <a href='widgets.php'><?php echo $num_widgets; ?> widgets</a>. <a href="themes.php">Change Theme</a>. You're using BetaPress TODO.</p>
< ? php do_action ( 'rightnow_end' ); ?>
< ? php do_action ( 'activity_box_end' ); ?>
</ div >
< div id = " dashboard-widgets " >
< div class = " dashboard-widget " >
< div class = " dashboard-widget-edit " >< a href = " " > See All </ a > | < a href = " " > Edit </ a ></ div >
< h3 > Recent Comments </ h3 >
2005-08-07 06:45:06 -04:00
< ? php
2005-11-28 00:45:45 -05:00
$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 " );
2006-01-16 15:07:00 -05:00
$numcomments = $wpdb -> get_var ( " SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0' " );
2005-11-28 00:45:45 -05:00
if ( $comments || $numcomments ) :
2005-08-07 06:45:06 -04:00
?>
2005-11-28 00:45:45 -05:00
< ? php if ( $numcomments ) : ?>
2007-06-11 17:05:50 -04:00
< p >< strong >< a href = " moderation.php " >< ? php echo sprintf ( __ ( 'Comments in moderation (%s) »' ), number_format_i18n ( $numcomments ) ); ?> </a></strong></p>
2005-08-07 06:45:06 -04:00
< ? php endif ; ?>
< ul >
2006-11-19 02:56:05 -05:00
< ? php
2005-08-07 06:45:06 -04:00
if ( $comments ) {
foreach ( $comments as $comment ) {
2007-06-25 13:48:35 -04:00
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>' );
2006-11-19 02:56:05 -05:00
edit_comment_link ( __ ( " Edit " ), ' <small>(' , ')</small>' );
2005-08-07 06:45:06 -04:00
echo '</li>' ;
}
}
?>
</ ul >
2006-07-04 15:24:00 -04:00
< ? php endif ; ?>
2007-12-20 15:23:30 -05:00
</ div >
2005-08-07 06:45:06 -04:00
2007-12-20 15:23:30 -05:00
< div class = " dashboard-widget " >
2004-12-18 19:10:10 -05:00
< ? php
2007-12-20 15:23:30 -05:00
$more_link = apply_filters ( 'dashboard_incoming_links_link' , 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit ( get_option ( 'home' ) ) );
2004-12-18 19:10:10 -05:00
?>
2007-12-20 15:23:30 -05:00
< div class = " dashboard-widget-edit " >< a href = " <?php echo htmlspecialchars( $more_link ); ?> " >< ? php _e ( 'See All' ); ?> </a> | <a href="">Edit</a></div>
< h3 > Incoming Links </ h3 >
< div id = " incominglinks " ></ div >
2004-12-18 19:10:10 -05:00
</ div >
2004-02-02 16:54:32 -05:00
2007-12-20 15:23:30 -05:00
< div class = " dashboard-widget " >
2004-12-18 19:10:10 -05:00
< ? php
2007-12-20 15:23:30 -05:00
$recentposts = $wpdb -> get_results ( " SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql ( 'post' ) . " AND post_date_gmt < ' $today ' ORDER BY post_date DESC LIMIT 5 " );
2006-11-19 02:56:05 -05:00
?>
2007-12-20 15:23:30 -05:00
< div class = " dashboard-widget-edit " >< a href = " <?php echo htmlspecialchars( $more_link ); ?> " >< ? php _e ( 'See All' ); ?> </a> | <a href="">Edit</a></div>
< h3 > Recent Posts </ h3 >
2004-12-18 19:10:10 -05:00
< ul >
< ? php
2007-12-20 15:23:30 -05:00
foreach ( $recentposts as $post ) {
2004-12-18 19:10:10 -05:00
if ( $post -> post_title == '' )
$post -> post_title = sprintf ( __ ( 'Post #%s' ), $post -> ID );
2007-12-20 15:23:30 -05:00
echo " <li><a href='post.php?action=edit&post= $post->ID '> " ;
the_title ();
echo '</a></li>' ;
2004-12-18 19:10:10 -05:00
}
2006-11-19 02:56:05 -05:00
?>
2004-12-18 19:10:10 -05:00
</ ul >
</ div >
2007-12-20 15:23:30 -05:00
< div class = " dashboard-widget " >
< div class = " dashboard-widget-edit " >< a href = " <?php echo htmlspecialchars( $more_link ); ?> " >< ? php _e ( 'See All' ); ?> </a> | <a href="">Edit</a> | <a href="">RSS</a></div>
< h3 >< ? php echo apply_filters ( 'dashboard_primary_title' , __ ( 'Blog' ) ); ?> </h3>
2006-12-21 18:06:18 -05:00
2007-12-20 15:23:30 -05:00
< div id = " devnews " ></ div >
2004-12-18 19:10:10 -05:00
</ div >
2007-12-20 15:23:30 -05:00
< ? php do_action ( 'dashboard_widgets' ); ?>
2004-12-18 19:10:10 -05:00
2007-12-20 15:23:30 -05:00
< p >< a href = " " > Customize this page </ a >.</ p >
2005-11-23 02:28:46 -05:00
2007-12-20 15:23:30 -05:00
</ div >
2005-02-02 05:36:59 -05:00
2006-11-18 18:12:39 -05:00
< div id = " planetnews " ></ div >
2005-02-02 05:36:59 -05:00
< div style = " clear: both " >& nbsp ;
2004-12-18 19:10:10 -05:00
< br clear = " all " />
</ div >
2005-02-02 05:36:59 -05:00
</ div >
2004-12-18 21:30:40 -05:00
2004-12-18 19:10:10 -05:00
< ? php
require ( './admin-footer.php' );
2005-12-12 17:48:30 -05:00
?>