function tdomf_dashboard_status() { $published_sub_count = tdomf_get_published_posts_count(); $approved_edits_count = tdomf_get_edits(array('state' => 'approved', 'count' => true)); $scheduled_sub_count = tdomf_get_queued_posts_count(); $spam_edits_count = tdomf_get_edits(array('state' => 'spam', 'count' => true, 'unique_post_ids' => true)); $pending_edits_count = tdomf_get_edits(array('state' => 'unapproved', 'count' => true, 'unique_post_ids' => true)); $pending_sub_count = tdomf_get_unmoderated_posts_count(); $spam_sub_count = tdomf_get_spam_posts_count(); echo '<tr>'; $num = number_format_i18n($published_sub_count); $text = __ngettext('Approved Submission', 'Approved Submissions', $published_sub_count); $url = tdomf_get_mod_posts_url(array('show' => 'all')); echo '<td class="b b_approved"><a href="' . $url . '">' . $num . '</a></td>'; echo '<td class="first t posts"><a class="approved" href="' . $url . '">' . $text . '</a></td>'; $num = number_format_i18n($approved_edits_count); $text = __ngettext('Approved Contribution', 'Approved Contributions', $approved_edits_count); $url = tdomf_get_mod_posts_url(array('show' => 'approved_edits')); echo '<td class="b b_approved"><a href="' . $url . '">' . $num . '</a></td>'; echo '<td class="first t posts"><a class="approved" href="' . $url . '">' . $text . '</a></td>'; echo '</tr><tr>'; if ($scheduled_sub_count > 0) { $num = number_format_i18n($scheduled_sub_count); $text = __ngettext('Scheduled Submission', 'Scheduled Submissions', $scheduled_sub_count); $url = tdomf_get_mod_posts_url(array('show' => 'scheduled')); echo '<td class="b posts"><a href="' . $url . '">' . $num . '</a></td>'; echo '<td class="first t posts"><a href="' . $url . '">' . $text . '</a></td>'; echo '</tr><tr>'; } if (get_option(TDOMF_OPTION_SPAM) && ($spam_edits_count > 0 || $spam_sub_count > 0)) { $num = number_format_i18n($pending_sub_count); $text = __ngettext('Pending Submission', 'Pending Submissions', $pending_sub_count); $url = tdomf_get_mod_posts_url(array('show' => 'pending_submissions')); echo '<td class="b b-waiting"><a class="waiting" href="' . $url . '"><span class=\'pending-count\'>' . $num . '</span></a></td>'; echo '<td class="first t"><a class="waiting" href="' . $url . '">' . $text . '</a></td>'; $num = number_format_i18n($spam_sub_count); $text = __ngettext('Spam Submission', 'Spam Submissions', $spam_sub_count); $url = tdomf_get_mod_posts_url(array('show' => 'spam_submissions')); echo '<td class="b b-spam"><a class="waiting" href="' . $url . '"><span class=\'spam-count\'>' . $num . '</span></a></td>'; echo '<td class="last t"><a class="spam" href="' . $url . '">' . $text . '</a></td>'; echo '</tr><tr>'; $num = number_format_i18n($pending_edits_count); $text = __ngettext('Pending Contribution', 'Pending Contributions', $pending_edits_count); echo '<td class="b b-waiting"><a class="waiting" href="' . $url . '"><span class=\'pending-count\'>' . $num . '</span></a></td>'; echo '<td class="first t"><a class="waiting" href="' . $url . '">' . $text . '</a></td>'; $num = number_format_i18n($spam_edits_count); $text = __ngettext('Spam Contribution', 'Spam Contributions', $spam_edits_count); $url = tdomf_get_mod_posts_url(array('show' => 'spam_edits')); echo '<td class="b b-waiting"><a class="waiting" href="' . $url . '"><span class=\'pending-count\'>' . $num . '</span></a></td>'; echo '<td class="first t"><a class="waiting" href="' . $url . '">' . $text . '</a></td>'; } else { $num = number_format_i18n($pending_sub_count); $url = tdomf_get_mod_posts_url(array('show' => 'pending_submissions')); $text = __ngettext('Pending Submission', 'Pending Submissions', $pending_sub_count); echo '<td class="b b-waiting"><a class="waiting" href="' . $url . '"><span class=\'pending-count\'>' . $num . '</span></a></td>'; echo '<td class="first t"><a class="waiting" href="' . $url . '">' . $text . '</a></td>'; $num = number_format_i18n($pending_edits_count); $url = tdomf_get_mod_posts_url(array('show' => 'pending_edits')); $text = __ngettext('Pending Contribution', 'Pending Contributions', $pending_edits_count); echo '<td class="b b-waiting"><a class="waiting" href="' . $url . '"><span class=\'pending-count\'>' . $num . '</span></a></td>'; echo '<td class="last t"><a class="waiting" href="' . $url . '">' . $text . '</a></td>'; } echo '</tr>'; }
function tdomf_theme_widget_admin($args) { if (current_user_can('manage_options') || current_user_can('edit_others_posts')) { extract($args); $errors = tdomf_get_error_messages(); if (trim($errors) != "") { echo $before_widget; echo $before_title . __("TDOMF Errors", "tdomf") . $after_title; echo "<p>{$errors}</p>"; echo $after_widget; } $options = get_option('tdomf_theme_widget_admin'); if ($options == false) { $log = 5; $mod = 5; } else { $log = $options['log']; $mod = $options['mod']; } if ($log > 0) { echo $before_widget; echo $before_title; _e('TDOMF Log', 'tdomf'); if (current_user_can('manage_options')) { echo "<a href=\"" . get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_log_menu\" title=\"Full Log...\">»</a>"; } echo $after_title; echo '<p>' . tdomf_get_log($log) . '</p>'; echo $after_widget; } if ($mod > 0) { $posts = tdomf_get_unmoderated_posts(0, $mod); if (!empty($posts)) { echo $before_widget; echo $before_title; printf(__('Awaiting Approval (%d)', 'tdomf'), tdomf_get_unmoderated_posts_count()); if (current_user_can('edit_others_posts')) { echo "<a href=\"" . get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_mod_posts_menu&f=0\" title=\"Moderate Submissions...\">»</a>"; } echo $after_title; echo '<ul>'; foreach ($posts as $p) { echo tdomf_get_post_list_line($p); } echo '</ul>'; echo $after_widget; } } if (get_option(TDOMF_OPTION_SPAM)) { $spam_count = tdomf_get_spam_posts_count(); if ($spam_count > 0) { echo $before_widget; echo $before_title; printf(__('Spam Queue (%d)', 'tdomf'), $spam_count); if (current_user_can('edit_others_posts')) { echo '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=tdomf_show_mod_posts_menu&f=3" title="' . __("Moderate Spam...", "tdomf") . '">»</a>'; } echo $after_title; echo $after_widget; } } echo $before_widget; echo $before_title; _e('TDOMF Admin Links', 'tdomf'); echo $after_title; echo "<ul>"; if ($mod <= 0 && tdomf_is_moderation_in_use()) { echo "<li>"; printf(__("<a href=\"%s\">Moderate (%d)</a>", "tdomf"), get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_mod_posts_menu&f=0", tdomf_get_unmoderated_posts_count()); echo "</li>"; } echo "<li>"; printf(__("<a href=\"%s\">Configure</a>", "tdomf"), get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_options_menu"); echo "</li>"; echo "<li>"; printf(__("<a href=\"%s\">Manage</a>", "tdomf"), get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_manage_menu"); echo "</li>"; echo "<li>"; printf(__("<a href=\"%s\">Create Form</a>", "tdomf"), get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_form_menu"); echo "</li>"; if ($log <= 0) { echo "<li>"; printf(__("<a href=\"%s\">Log</a>", "tdomf"), get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_log_menu"); echo "</li>"; } echo "</ul>"; echo $after_widget; } }