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 " >
2007-12-21 17:24:04 -05:00
< h3 >< ? php _e ( 'Right Now' ); ?> <a href="post-new.php"><?php _e('Write a New Post'); ?></a> <a href="page-new.php"><?php _e('Write a New Page'); ?></a></h3>
2005-08-07 06:45:06 -04:00
2007-12-20 15:23:30 -05:00
< ? php
$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' );
2007-12-20 17:36:00 -05:00
$post_type_texts = array ();
2007-12-20 15:23:30 -05:00
2007-12-20 17:36:00 -05:00
if ( $num_posts ) {
$post_type_texts [] = '<a href="edit.php">' . sprintf ( __ngettext ( '%d post' , '%d posts' , $num_posts ), number_format_i18n ( $num_posts ) ) . '</a>' ;
}
if ( $num_pages ) {
$post_type_texts [] = '<a href="edit-pages.php">' . sprintf ( __ngettext ( '%d page' , '%d pages' , $num_pages ), number_format_i18n ( $num_pages ) ) . '</a>' ;
}
if ( $num_drafts ) {
$post_type_texts [] = '<a href="edit.php?post_status=draft">' . sprintf ( __ngettext ( '%d draft' , '%d drafts' , $num_drafts ), number_format_i18n ( $num_drafts ) ) . '</a>' ;
}
if ( $num_future ) {
$post_type_texts [] = '<a href="edit.php?post_status=future">' . sprintf ( __ngettext ( '%d scheduled post' , '%d scheduled posts' , $num_future ), number_format_i18n ( $num_future ) ) . '</a>' ;
}
2007-12-20 15:23:30 -05:00
2007-12-20 17:36:00 -05:00
$cats_text = '<a href="categories.php">' . sprintf ( __ngettext ( '%d category' , '%d categories' , $num_cats ), number_format_i18n ( $num_cats ) ) . '</a>' ;
$tags_text = sprintf ( __ngettext ( '%d tag' , '%d tags' , $num_tags ), number_format_i18n ( $num_tags ) );
2007-12-20 15:23:30 -05:00
2007-12-20 17:36:00 -05:00
$post_type_text = implode ( ', ' , $post_type_texts );
2007-12-20 15:23:30 -05:00
// There is always a category
2007-12-20 17:36:00 -05:00
$sentence = sprintf ( __ ( 'You have %1$s, contained within %2$s and %3$s.' ), $post_type_text , $cats_text , $tags_text );
2007-12-20 15:23:30 -05:00
?>
< p >< ? php echo $sentence ; ?> </p>
< ? php
$ct = current_theme_info ();
$sidebars_widgets = wp_get_sidebars_widgets ();
2007-12-20 17:36:00 -05:00
$num_widgets = array_reduce ( $sidebars_widgets , create_function ( '$prev, $curr' , 'return $prev+count($curr);' ) );
$widgets_text = sprintf ( __ngettext ( '%d widget' , '%d widgets' , $num_widgets ), $num_widgets );
2007-12-20 15:23:30 -05:00
?>
2007-12-20 17:36:00 -05:00
< p >< ? php printf ( __ ( 'You are using %1$s theme with %2$s.' ), $ct -> title , $widgets_text ); ?> <a href="themes.php"><?php _e('Change Theme'); ?></a>. You're using BetaPress TODO.</p>
< p >
2007-12-20 15:23:30 -05:00
< ? php do_action ( 'rightnow_end' ); ?>
< ? php do_action ( 'activity_box_end' ); ?>
</ div >
< div id = " dashboard-widgets " >
< div class = " dashboard-widget " >
2007-12-20 17:36:00 -05:00
< div class = " dashboard-widget-edit " >< a href = " " >< ? php _e ( 'See All' ); ?> </a> | <a href=""><?php _e('Edit'); ?></a></div>
2007-12-20 15:23:30 -05:00
< 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 17:36:00 -05:00
< div class = " dashboard-widget-edit " >< a href = " <?php echo htmlspecialchars( $more_link ); ?> " >< ? php _e ( 'See All' ); ?> </a> | <a href=""><?php _e('Edit'); ?></a></div>
< h3 >< ? php _e ( 'Incoming Links' ); ?> </h3>
2007-12-20 15:23:30 -05:00
< 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 17:36:00 -05:00
< div class = " dashboard-widget-edit " >< a href = " <?php echo htmlspecialchars( $more_link ); ?> " >< ? php _e ( 'See All' ); ?> </a> | <a href=""><?php _e('Edit'); ?></a></div>
2007-12-20 15:23:30 -05:00
< 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 " >
2007-12-20 17:36:00 -05:00
< div class = " dashboard-widget-edit " >< a href = " <?php echo htmlspecialchars( $more_link ); ?> " >< ? php _e ( 'See All' ); ?> </a> | <a href=""><?php _e('Edit'); ?></a> | <a href=""><?php _e('RSS'); ?></a></div>
2007-12-20 15:23:30 -05:00
< 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 17:36:00 -05:00
< p >< a href = " " >< ? php _e ( '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
?>