Пример #1
0
function tdomf_add_menus()
{
    $unmod_count = tdomf_get_unmoderated_posts_count();
    $unmod_count += tdomf_get_edits(array('state' => 'unapproved', 'count' => true, 'unique_post_ids' => true));
    /*if(tdomf_wp25() && $unmod_count > 0) {
          add_menu_page(__('TDO Mini Forms', 'tdomf'), sprintf(__("TDO Mini Forms <span id='awaiting-mod' class='count-%d'><span class='comment-count'>%d</span></span>", 'tdomf'), $unmod_count, $unmod_count), 'edit_others_posts', TDOMF_FOLDER, 'tdomf_overview_menu');
      } else {*/
    add_menu_page(__('TDO Mini Forms', 'tdomf'), __('TDO Mini Forms', 'tdomf'), 'edit_others_posts', TDOMF_FOLDER, 'tdomf_overview_menu');
    /*}*/
    // Options
    add_submenu_page(TDOMF_FOLDER, __('Plugin Options', 'tdomf'), __('Plugin Options', 'tdomf'), 'manage_options', 'tdomf_show_options_menu', 'tdomf_show_options_menu');
    //
    // Form Options
    add_submenu_page(TDOMF_FOLDER, __('Form Options', 'tdomf'), __('Form Options', 'tdomf'), 'manage_options', 'tdomf_show_form_options_menu', 'tdomf_show_form_options_menu');
    //
    // Form Widgets
    add_submenu_page(TDOMF_FOLDER, __('Form Creator', 'tdomf'), __('Form Creator', 'tdomf'), 'manage_options', 'tdomf_show_form_menu', 'tdomf_show_form_menu');
    //
    // Form Hacker
    add_submenu_page(TDOMF_FOLDER, __('Form Hacker', 'tdomf'), __('Form Hacker', 'tdomf'), 'manage_options', 'tdomf_show_form_hacker', 'tdomf_show_form_hacker');
    //
    // Form Export
    add_submenu_page(TDOMF_FOLDER, __('Form Export', 'tdomf'), __('Form Export', 'tdomf'), 'manage_options', 'tdomf_show_form_export_menu', 'tdomf_show_form_export_menu');
    /*//
      // Form Options
      add_submenu_page( TDOMF_FOLDER , __('Form Options', 'tdomf'), __('Forms', 'tdomf'), 'manage_options', 'tdomf_show_form_options_menu', 'tdomf_show_form_options_menu');
      //
      // Form Widgets
      add_submenu_page( 'admin.php' , __('Form Creator', 'tdomf'), __('Form Creator', 'tdomf'), 'manage_options', 'tdomf_show_form_menu', 'tdomf_show_form_menu');
      //
      // Form Hacker
      add_submenu_page( 'admin.php' , __('Form Hacker', 'tdomf'), __('Form Hacker', 'tdomf'), 'manage_options', 'tdomf_show_form_hacker', 'tdomf_show_form_hacker');
      //
      // Form Export
      add_submenu_page( 'admin.php' , __('Form Export', 'tdomf'), __('Form Export', 'tdomf'), 'manage_options', 'tdomf_show_form_export_menu', 'tdomf_show_form_export_menu');*/
    //
    // Moderation Queue
    if (tdomf_is_moderation_in_use()) {
        add_submenu_page(TDOMF_FOLDER, __('Moderation', 'tdomf'), sprintf(__('Moderation (%d)', 'tdomf'), $unmod_count), 'edit_others_posts', 'tdomf_show_mod_posts_menu', 'tdomf_show_mod_posts_menu');
    } else {
        add_submenu_page(TDOMF_FOLDER, __('Moderation', 'tdomf'), __('Moderation', 'tdomf'), 'edit_others_posts', 'tdomf_show_mod_posts_menu', 'tdomf_show_mod_posts_menu');
    }
    //
    // Manage Submitters
    add_submenu_page(TDOMF_FOLDER, __('Users and IPs', 'tdomf'), __('Users and IPs', 'tdomf'), 'edit_others_posts', 'tdomf_show_manage_menu', 'tdomf_show_manage_menu');
    //
    // Log
    add_submenu_page(TDOMF_FOLDER, __('Log', 'tdomf'), __('Log', 'tdomf'), 'manage_options', 'tdomf_show_log_menu', 'tdomf_show_log_menu');
    //
    // Uninstall
    add_submenu_page(TDOMF_FOLDER, __('Uninstall', 'tdomf'), __('Uninstall', 'tdomf'), 'manage_options', 'tdomf_show_uninstall_menu', 'tdomf_show_uninstall_menu');
    //
    // Your submissions
    if (get_option(TDOMF_OPTION_YOUR_SUBMISSIONS)) {
        add_submenu_page('profile.php', 'Your Submissions', 'Your Submissions', 0, 'tdomf_your_submissions', 'tdomf_show_your_submissions_menu');
    }
    // Restoring old behaviour that Wordpress 2.8 took away for this page
    //
    add_submenu_page('admin.php', __('Revisions', 'tdomf'), __('Revisions', 'tdomf'), 'manage_options', TDOMF_FOLDER . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'tdomf-revision.php');
}
Пример #2
0
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>';
}
Пример #3
0
 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...\">&raquo;</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...\">&raquo;</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") . '">&raquo;</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;
     }
 }