First pass at dashboard. Hat tip: Jesuit.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt
2004-12-19 00:10:10 +00:00
parent 736b9d8bcb
commit 3f39fe4b61
4 changed files with 173 additions and 15 deletions

View File

@@ -550,4 +550,27 @@ function sanitize_email($email) {
return preg_replace('/[^a-z0-9+_.@-]/i', '', $email);
}
function human_time_diff( $from, $to = '' ) {
if ( empty($to) )
$to = time();
$diff = (int) ($to - $from);
if ($diff <= 3600) {
$mins = round($diff / 60);
$since = sprintf( __('%s mins', $mins) );
} else if (($diff <= 86400) && ($diff > 3600)) {
$hours = round($diff / 3600);
if ($hours <= 1)
$since = __('1 hour');
else
$since = sprintf( __('%s hours'), $hours );
} elseif ($diff >= 86400) {
$days = round($diff / 86400);
if ($days <= 1)
$since = __('1 day');
else
$since = sprintf( __('%s days'), $days );
}
return $since;
}
?>

View File

@@ -46,13 +46,16 @@ function the_title_rss() {
echo $title;
}
function get_the_title() {
global $post;
$output = $post->post_title;
if (!empty($post->post_password)) { // if there's a password
$output = 'Protected: ' . $output;
function get_the_title($id = 0) {
global $post, $wpdb;
$title = $post->post_title;
if ( 0 != $id )
$title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $id");
if ( !empty($post->post_password) ) { // if there's a password
$title = 'Protected: ' . $title;
}
return $output;
return $title;
}
function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {