' . "\n";
echo '' . __('Administration') . ' | ';
echo '' . __('Write Post') . ' | ';
echo '' . __('Posts') . ' (' . mw_getQty('posts') . ') | ';
echo '' . __('Comments') . ' (' . mw_getQty('comments_appr') . ') | ';
echo '' . __('Comment Moderation') . ' (' . mw_getQty('comments_awaitmod') . ') | ';
if (function_exists('akismet_init'))
echo 'Akismet Spam (' . mw_getQty('comments_spam') . ') | ';
echo '»' . __('Logout') . '';
echo ' ' . "\n";
}
/*******************************************************************************
* Function: mw_getQty
* Purpose: Determines the number of blog posts, number of comments, etc.
* Input: $type: Typ
* $int: TRUE wenn Rückgabe als Integer, FALSE wenn Rückgabe als
* String mit Punkt als Tausender-Trennzeichen, z.B. 17.365
* Output: Integer oder String, je nach number format
*******************************************************************************/
function mw_getQty($type='posts', $int=false)
{
global $wpdb;
switch ($type) {
case 'posts':
$query = " SELECT COUNT(*)
FROM $wpdb->posts
WHERE post_status = 'publish'
AND post_date < '" . current_time('mysql') . "'";
break;
case 'comments_appr':
$query = " SELECT COUNT(*)
FROM $wpdb->comments
WHERE comment_approved = '1'";
break;
case 'comments_awaitmod': // Number of comments awaiting moderation
$query = " SELECT COUNT(*)
FROM $wpdb->comments
WHERE comment_approved = '0'";
break;
case 'comments_spam': // Number of comments spam
$query = " SELECT COUNT(*)
FROM $wpdb->comments
WHERE comment_approved = 'spam'";
break;
}
$result = $wpdb->get_var($query);
if ($int === false) {
return number_format($result, 0, ',', '.');
} else {
return intval($result);
}
} // ******************** Ende Admin Menu **********************************
?>