Ejemplo n.º 1
0
function tdomf_overview_menu()
{
    global $wpdb, $wp_roles;
    // Initilise the plugin for the first time here. This gets called when you click the TDOMF button in the menu.
    // Doing it here means you can delete all the options!
    tdomf_init();
    // get feed_messages
    require_once ABSPATH . WPINC . '/rss.php';
    if (!isset($wp_roles)) {
        $wp_roles = new WP_Roles();
    }
    $roles = $wp_roles->role_objects;
    ?>
  <div class="wrap">
    <h2><?php 
    _e('Welcome to TDO Mini Forms', 'tdomf');
    ?>
</h2>

    <div id="zeitgeist">

        <?php 
    $features = tdomf_new_features();
    if ($features) {
        ?>
                <h2><?php 
        printf(__("New Features in %s for you", "tdomf"), TDOMF_VERSION);
        ?>
</h2>
                <?php 
        echo $features;
        ?>
        <?php 
    }
    ?>
    
    	  <h2><?php 
    _e('Latest Activity', 'tdomf');
    ?>
</h2>
        
    	  <h3><?php 
    _e('Log', 'tdomf');
    if (current_user_can('manage_options')) {
        ?>
<a href="admin.php?page=tdomf_show_log_menu" title="Full Log...">&raquo;</a><?php 
    }
    ?>
</h3>

    	  <p><?php 
    echo tdomf_get_log(5);
    ?>
</p>

        <?php 
    if (tdomf_is_moderation_in_use()) {
        ?>

          <?php 
        $posts = tdomf_get_unmoderated_posts(0, 10);
        if (!empty($posts)) {
            ?>
            
        	  <h3><?php 
            _e('Latest Submissions', 'tdomf');
            if (current_user_can('edit_others_posts')) {
                ?>
<a href="admin.php?page=tdomf_show_mod_posts_menu&f=0" title="<?php 
                _e("Moderate Submissions...", "tdomf");
                ?>
">&raquo;</a><?php 
            }
            ?>
</h3>

          <ul>

              
                <?php 
            foreach ($posts as $p) {
                echo tdomf_get_post_list_line($p);
            }
        }
        ?>
    	  </ul>

    	  <?php 
    }
    ?>

          <?php 
    if (get_option(TDOMF_OPTION_SPAM)) {
        ?>
              <?php 
        $spam_count = tdomf_get_spam_posts_count();
        if ($spam_count > 0) {
            ?>
                  <h3><?php 
            printf(__('There are %d spam submissions', 'tdomf'), $spam_count);
            if (current_user_can('edit_others_posts')) {
                ?>
<a href="admin.php?page=tdomf_show_mod_posts_menu&f=3" title="<?php 
                _e("Moderate Spam...", "tdomf");
                ?>
">&raquo;</a><?php 
            }
            ?>
</h3>
              <?php 
        }
        ?>
          <?php 
    }
    ?>
          
          <?php 
    $posts = tdomf_get_published_posts(0, 10);
    if (!empty($posts)) {
        ?>

    	  <h3><?php 
        _e('Latest Approved Submissions', 'tdomf');
        if (current_user_can('edit_others_posts')) {
            ?>
<a href="admin.php?page=tdomf_show_mod_posts_menu&f=1" title="Moderate Posts...">&raquo;</a><?php 
        }
        ?>
</h3>

    	  <ul>
                  
                  
              <?php 
        foreach ($posts as $p) {
            echo tdomf_get_post_list_line($p);
        }
    }
    ?>
    	  </ul>

          

    	  <h3><?php 
    _e('Stats', 'tdomf');
    ?>
</h3>

          <?php 
    $stat_sub_ever = get_option(TDOMF_STAT_SUBMITTED);
    $stat_edit_ever = get_option(TDOMF_STAT_EDITED);
    $stat_unmod = tdomf_get_unmoderated_posts_count();
    $stat_edit_unmod = tdomf_get_edits(array('state' => 'unapproved', 'count' => true, 'unique_post_ids' => true));
    $stat_sub_cur = tdomf_get_submitted_posts_count();
    $stat_edit_cur = tdomf_get_edits(array('count' => true, 'unique_post_ids' => true));
    $stat_mod = $stat_sub_cur - $stat_unmod;
    $stat_edit_mod = tdomf_get_edits(array('state' => 'approved', 'count' => true, 'unique_post_ids' => true));
    $stat_spam = get_option(TDOMF_STAT_SPAM);
    ?>

          <?php 
    if (get_option(TDOMF_OPTION_SPAM)) {
        ?>
              <p><?php 
        printf(__("You are using version %s (build %d) of the TDO Mini Forms plugin. There has been %d posts (or pages) submitted, %d edits submitted, %d posts approved and %d edits approved. %d spam submissions have been caught by Akismet", "tdomf"), TDOMF_VERSION, get_option(TDOMF_VERSION_CURRENT), $stat_sub_ever, $stat_edit_ever, $stat_mod, $stat_edit_mod, $stat_spam);
        ?>
          <?php 
    } else {
        ?>
              <p><?php 
        printf(__("You are using version %s (build %d) of the TDO Mini Forms plugin. There has been %d posts (or pages) submitted, %d edits submitted, %d posts approved and %d edits approved.", "tdomf"), TDOMF_VERSION, get_option(TDOMF_VERSION_CURRENT), $stat_sub_ever, $stat_edit_ever, $stat_mod, $stat_edit_mod);
        ?>
          <?php 
    }
    ?>
        
        <?php 
    $rss = fetch_rss('http://thedeadone.net/forum/?cat=6&feed=rss');
    if (isset($rss->items) && 0 != count($rss->items)) {
        $rss->items = array_slice($rss->items, 0, 5);
        echo "<h3>" . __('Latest Support Forum Topics', 'tdomf') . "</h3><ul>";
        foreach ($rss->items as $item) {
            ?>
                 <li><a href='<?php 
            echo wp_filter_kses($item['link']);
            ?>
'><?php 
            echo wp_specialchars($item['title']);
            ?>
</a></li>
        <?php 
        }
        echo "</ul>";
    }
    ?>
        
    </div>

    <?php 
    echo "<p>" . ($message = tdomf_get_error_messages() . "</p>");
    ?>

    <table style="margin:0px;padding:0px">
      <tr>
        <td>
          <form action="https://www.paypal.com/cgi-bin/webscr" method="post" >
          <input type="hidden" name="cmd" value="_s-xclick">
          <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" style="border:0px;" >
          <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
          <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIIWQYJKoZIhvcNAQcEoIIISjCCCEYCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBuEC47mJwumB8/XIQIyehLoyT5ueMyjGzjeTnWxYcjdY3rAgkJteuOvqnnYNG7R8x9g2NVIJYH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XBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA3MDkyNjE0MzQwM1owIwYJKoZIhvcNAQkEMRYEFClTuUrBDEQ7H6sAZIN8yB9qKifJMA0GCSqGSIb3DQEBAQUABIGAGr+klEj8FgUscdaxj/kalFxvuQnSznQDFmsPvJZfwa7Wur3EnF75m7+qvQOeFSZ56a3aXjSELI9ej1vXXz8mjZqUQYEeFLqvulKl3KVHS32KprXTj5iqp3TapPbeoSsMggxVxJ1HjmakNJm3UwhqlEIoc0qjf1wHPIIWSBJcAug=-----END PKCS7-----
">
          </form>
        </td><td>
          <?php 
    printf(__("[<a href='%s'>My Amazon Wishlist</a>]", "tdomf"), "http://www.amazon.co.uk/gp/registry/23S7OL9W6Q4JT");
    ?>
        </td>
        <td>
          <?php 
    printf(__("[<a href='%s'>Rate TDO-Mini-Forms on Wordpress.org!</a>]", "tdomf"), "http://wordpress.org/extend/plugins/tdo-mini-forms/#rate-response");
    ?>
        </td>
      </tr>
    </table>
    
    <p><?php 
    _e("Use these links to get started:", "tdomf");
    ?>
</p>

    <ul>
      <li><a href="admin.php?page=tdomf_show_options_menu"><?php 
    _e("Configure TDO Mini Forms", "tdomf");
    ?>
</a></li>
      <li><a href="admin.php?page=tdomf_show_form_menu"><?php 
    _e("Form Widgets", "tdomf");
    ?>
</a></li>
      <?php 
    if (get_option(TDOMF_OPTION_YOUR_SUBMISSIONS)) {
        ?>
          <?php 
        if (current_user_can('edit_users')) {
            ?>
                <li><a href="users.php?page=tdomf_your_submissions"><?php 
            _e("Your Submissions Page", "tdomf");
            ?>
</a></li>
          <?php 
        } else {
            ?>
                <li><a href="profile.php?page=tdomf_your_submissions"><?php 
            _e("Your Submissions Page", "tdomf");
            ?>
</a></li>
          <?php 
        }
        ?>
      <?php 
    }
    ?>
      <?php 
    if (current_user_can('manage_options')) {
        ?>
      <li><a href="<?php 
        echo TDOMF_URLPATH;
        ?>
tdomf-phpinfo.php"><?php 
        _e("phpinfo()", "tdomf");
        ?>
</a></li>
      <li><a href="admin.php?page=<?php 
        echo TDOMF_FOLDER . DIRECTORY_SEPARATOR . "admin" . DIRECTORY_SEPARATOR;
        ?>
tdomf-info.php"><?php 
        _e("tdomfinfo()", "tdomf");
        ?>
</a></li>
      <?php 
    }
    ?>
    </ul>

<p><?php 
    _e('Need help with TDO Mini Forms? Please see the <a href="http://thedeadone.net/forum">support forums on thedeadone.net</a> or the <a href="http://wordpress.org/tags/tdo-mini-forms">support forums on wordpress.org</a>.', "tdomf");
    ?>
</p>

    <h3><?php 
    _e('Welcome', 'tdomf');
    ?>
</h3>

    <p>
    <?php 
    _e("TDO Mini Forms plugin allows you to provide a form to your readers and users so that they can submit posts to your blog, even if they don't have rights to do so. You can control what type of users, such as unregistered users and subscribers, can access and use the form. Posts are submitted as draft so that you can approve them before they are published. (You can optionally turn this off so that submissions are automatically published). As of version 0.7, you can now also customise the form using widgets.", "tdomf");
    ?>
    </p>
        
    <div id="devnews">
    <h3><?php 
    _e('Latest TDO Mini Forms News!', 'tdomf');
    ?>
</h3>

    <?php 
    $rss = fetch_rss('http://thedeadone.net/tag/tdomf/feed');
    if (isset($rss->items) && 0 != count($rss->items)) {
        $rss->items = array_slice($rss->items, 0, 4);
        foreach ($rss->items as $item) {
            ?>
          <h4><a href='<?php 
            echo wp_filter_kses($item['link']);
            ?>
'><?php 
            echo wp_specialchars($item['title']);
            ?>
</a> &#8212; <?php 
            echo human_time_diff(strtotime($item['pubdate'], time()));
            ?>
</h4>
          <p><?php 
            echo '<strong>' . date("F, jS", strtotime($item['pubdate'])) . '</strong> - ' . $item['description'];
            ?>
</p>
        <?php 
        }
    } else {
        ?>
        <p><?php 
        printf(__('Newsfeed could not be loaded.  Check the <a href="%s">thedeadone.net</a> to check for updates.', 'tdomf'), 'http://thedeadone.net/index.php?tag=tdomf');
        ?>
</p>
        <?php 
    }
    ?>
    </div>
    <br style="clear: both" />
   </div>
    <?php 
}
Ejemplo n.º 2
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;
     }
 }