create();
$View->right_now();
$View->recent_comments();
$View->recent_drafts();
//do_action('activity_box_end');
include dirname(__FILE__) . '/admin-footer.php';
exit();
/* ==================================================
* KtaiAdmin_Dashboard class
================================================== */
class KtaiAdmin_Dashboard {
private $base;
private $admin;
private $accesskey;
// ==================================================
public function __construct($base, $accesskey) {
$this->base = $base;
$this->admin = $base->admin;
$this->accesskey = absint($accesskey);
}
// ==================================================
public function create() {
$links = array();
if (current_user_can('edit_posts')) {
$links[] = '' . __('Add New Post') . '';
}
if (current_user_can('edit_pages')) {
$links[] = '' . __('Add New Page') . '';
}
if ($links) {
echo '
[' . implode(' | ', $links) . ']
' . "\n";
}
return;
}
// ==================================================
public function right_now() { ?>
';
// Posts
echo '';
$format = __('Posts: %link', 'ktai_style');
$num = number_format_i18n($num_posts->publish);
if ( current_user_can('edit_posts') && $num_posts->publish > 0) {
ks_ordered_link($this->accesskey, 10, 'edit.php', $num, $format);
} else {
ks_ordered_link(-1, 10, NULL, $num, $format);
}
$this->accesskey++;
echo '';
// Pages
echo '';
$format = __('Pages: %link', 'ktai_style');
$num = number_format_i18n($num_pages->publish);
if ( current_user_can('edit_pages') && $num_pages->publish > 0) {
ks_ordered_link($this->accesskey, 10, 'edit-pages.php', $num, $format);
} else {
ks_ordered_link(-1, 10, NULL, $num, $format);
}
$this->accesskey++;
echo '';
// Categories
echo '';
$format = __('Categories: %link', 'ktai_style');
$num = number_format_i18n($num_cats);
/* if ( current_user_can('manage_categories') && $num_cats > 0) {
ks_ordered_link($this->accesskey++, 10, 'categories.php', $num, $format);
} else {
*/
ks_ordered_link(-1, 10, NULL, $num, $format);
// }
$this->accesskey++;
echo '';
// Tags
echo '';
$format = __('Tags: %link', 'ktai_style');
$num = number_format_i18n($num_tags);
/* if ( current_user_can('manage_categories') && $num_tags > 0) {
ks_ordered_link($this->accesskey++, 10, 'edit-tags.php', $num, $format);
} else {
*/
ks_ordered_link(-1, 10, NULL, $num, $format);
// }
$this->accesskey++;
echo '' . "\n";
// Total Comments
echo '';
$format = __('Comments: %link', 'ktai_style');
$total_comments = isset($num_comm->total_comments) ? $num_comm->total_comments : intval($num_comm->approved + $num_comm->moderated + $num_comm->spam);
$num = number_format_i18n($total_comments);
if ( current_user_can('moderate_comments') && $total_comments > 0 && $this->base->admin_available_wp_upper() ) {
ks_ordered_link($this->accesskey, 10, 'edit-comments.php', $num, $format);
} else {
ks_ordered_link(-1, 10, NULL, $num, $format);
}
$this->accesskey++;
echo '';
// Approved Comments
$string = sprintf(__('Approved', 'ktai_style'), 'green');
$num = number_format_i18n($num_comm->approved);
/* if ( current_user_can('moderate_comments') && $num_comm->approved > 0) {
$num = '' . $num . '';
}
*/
echo '- ' . sprintf(_c('%1$s: %2$s|comments count', 'ktai_style'), $string, $num) . '
' . "\n";
// Pending Comments
$string = sprintf(__('Pending', 'ktai_style'), '#ff9900');
$num = number_format_i18n($num_comm->moderated);
if ( current_user_can('moderate_comments') && $num_comm->moderated > 0 && $this->base->admin_available_wp_upper() ) {
$num = '' . $num . '';
}
echo '- ' . sprintf(_c('%1$s: %2$s|comments count', 'ktai_style'), $string, $num) . '
' . "\n";
// Spam Comments
$string = sprintf(__('Spam', 'ktai_style'), 'red');
$num = number_format_i18n($num_comm->spam);
if ( current_user_can('moderate_comments') && $num_comm->spam > 0 && $this->base->admin_available_wp_upper() ) {
$num = '' . $num . '';
}
echo '- ' . sprintf(_c('%1$s: %2$s|comments count', 'ktai_style'), $string, $num) . '
' . "\n";
return;
}
// ==================================================
public function recent_drafts($drafts = false) { ?>
'post',
'what_to_show' => 'posts',
'post_status' => 'draft',
'author' => $GLOBALS['current_user']->ID,
'posts_per_page' => 5,
'orderby' => 'modified',
'order' => 'DESC'
) );
$drafts =& $drafts_query->posts;
}
if ( $drafts && is_array($drafts) ) {
global $Ktai_Style;
echo '';
foreach ( $drafts as $draft ) {
$url = get_edit_post_link($draft->ID, 'url');
$title = $this->admin->draft_or_post_title( $draft->ID );
echo '- ';
ks_ordered_link($this->accesskey++, 10, $url, $title);
_ks_timestamp(get_the_time('U', $draft));
echo '
';
if ($the_content = ks_cut_html(strip_tags($draft->post_content), KTAI_DRAFT_LENGTH) ) {
echo '- ' . $the_content . '
';
}
}
?>
get_results($wpdb->prepare("SELECT * FROM `$wpdb->comments` ORDER BY comment_date_gmt DESC LIMIT %d, 50", $start)) ) {
foreach ( $possible as $comment ) {
if ( count( $comments ) >= 5 ) {
break;
} elseif (in_array($comment->comment_approved, $allowed_states)) {
$comments[] = $comment;
}
}
$start = $start + 50;
}
if ($comments) { ?>
recent_comments_row($comment, $this->accesskey);
} ?>
comment_post_ID );
$edit_url = sprintf('comment.php?action=editcomment&c=%d', $comment->comment_ID);
$reply_url = sprintf('comment-reply.php?replytocom=%d', $comment->comment_ID);
if ( !$comment->comment_type || 'comment' == $comment->comment_type ) :
$desc = sprintf(__('From %s on %%link', 'ktai_style'), get_comment_author());
else :
switch ( $comment->comment_type ) :
case 'pingback' :
$type = __( 'Pingback' );
break;
case 'trackback' :
$type = __( 'Trackback' );
break;
default :
$type = ucwords( $comment->comment_type );
endswitch;
$desc = sprintf(__('%s on %%link', 'ktai_style'), wp_specialchars($type));
endif; ?>
accesskey++, 9, NULL, $comment_post_title, $desc); ?>
comment_post_ID)) { ?>
[
|
]