Use comments_open() and pings_open() in packaged themes. Props coffee2code. fixes #9556

git-svn-id: http://svn.automattic.com/wordpress/trunk@10978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-17 05:30:09 +00:00
parent c64513ba22
commit a1aeb4a1f2
7 changed files with 47 additions and 38 deletions

View File

@ -249,21 +249,19 @@ function print_plugins_table($plugins, $context = '') {
<table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table"> <table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
<thead> <thead>
<tr> <tr>
<th scope="col" class="check-column"><input type="checkbox" /></th> <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Plugin'); ?></th> <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th>
<th scope="col" class="num"><?php _e('Version'); ?></th> <th scope="col" class="manage-column num"><?php _e('Version'); ?></th>
<th scope="col"><?php _e('Description'); ?></th> <th scope="col" class="manage-column"><?php _e('Description'); ?></th>
<th scope="col" class="action-links"><?php _e('Action'); ?></th>
</tr> </tr>
</thead> </thead>
<tfoot> <tfoot>
<tr> <tr>
<th scope="col" class="check-column"><input type="checkbox" /></th> <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Plugin'); ?></th> <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th>
<th scope="col" class="num"><?php _e('Version'); ?></th> <th scope="col" class="manage-column num"><?php _e('Version'); ?></th>
<th scope="col"><?php _e('Description'); ?></th> <th scope="col" class="manage-column"><?php _e('Description'); ?></th>
<th scope="col" class="action-links"><?php _e('Action'); ?></th>
</tr> </tr>
</tfoot> </tfoot>
@ -276,28 +274,35 @@ function print_plugins_table($plugins, $context = '') {
</tr>'; </tr>';
} }
foreach ( (array)$plugins as $plugin_file => $plugin_data) { foreach ( (array)$plugins as $plugin_file => $plugin_data) {
$action_links = array(); $actions = array();
if ( 'active' == $context ) if ( 'active' == $context )
$action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>'; $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
else //Inactive or Recently deactivated else //Inactive or Recently deactivated
$action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>'; $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
$action_links[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>'; $actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
$action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, $plugin_data, $context ); $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
$action_links = apply_filters( "plugin_action_links_$plugin_file", $action_links, $plugin_file, $plugin_data, $context ); $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
$action_count = count($actions);
echo " echo "
<tr class='$context'> <tr class='$context'>
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th> <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th>
<td class='name'>{$plugin_data['Title']}</td> <td class='plugin-title'><strong>{$plugin_data['Title']}</strong>";
$i = 0;
echo '<div class="row-actions">';
foreach ( $actions as $action => $link ) {
++$i;
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
echo "<span class='$action'>$link$sep</span>";
}
echo '</div>';
echo "</td>
<td class='vers'>{$plugin_data['Version']}</td> <td class='vers'>{$plugin_data['Version']}</td>
<td class='desc'><p>{$plugin_data['Description']}</p></td> <td class='desc'><p>{$plugin_data['Description']}</p>";
<td class='togl action-links'>";
if ( !empty($action_links) )
echo implode(' | ', $action_links);
echo '</td> echo '</td>
</tr>'; </tr>';
do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context ); do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );

View File

@ -1981,15 +1981,19 @@ p.search-box {
/* Edit posts */ /* Edit posts */
td.post-title strong { td.post-title strong, td.plugin-title strong {
display: block; display: block;
margin-bottom: .2em; margin-bottom: .2em;
} }
td.post-title p { td.post-title p, td.plugin-title p {
margin: 6px 0; margin: 6px 0;
} }
td.plugin-title {
white-space: nowrap;
}
/* Global classes */ /* Global classes */
.wp-hidden-children .wp-hidden-child, .wp-hidden-children .wp-hidden-child,

View File

@ -30,7 +30,7 @@ while( have_posts()) : the_post();
<p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><?php _e("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post."); ?></a></p> <p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><?php _e("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post."); ?></a></p>
<?php if ('open' == $post->ping_status) { ?> <?php if ( pings_open() ) { ?>
<p><?php _e("The <abbr title=\"Universal Resource Locator\">URL</abbr> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p> <p><?php _e("The <abbr title=\"Universal Resource Locator\">URL</abbr> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p>
<?php } ?> <?php } ?>
@ -58,7 +58,7 @@ if ( post_password_required($commentstatus) ) { // and it doesn't match the coo
<p><?php _e("No comments yet."); ?></p> <p><?php _e("No comments yet."); ?></p>
<?php } ?> <?php } ?>
<?php if ('open' == $commentstatus->comment_status) { ?> <?php if ( comments_open($commentstatus) ) { ?>
<h2><?php _e("Leave a comment"); ?></h2> <h2><?php _e("Leave a comment"); ?></h2>
<p><?php _e("Line and paragraph breaks automatic, e-mail address never displayed, <acronym title=\"Hypertext Markup Language\">HTML</acronym> allowed:"); ?> <code><?php echo allowed_tags(); ?></code></p> <p><?php _e("Line and paragraph breaks automatic, e-mail address never displayed, <acronym title=\"Hypertext Markup Language\">HTML</acronym> allowed:"); ?> <code><?php echo allowed_tags(); ?></code></p>

View File

@ -29,7 +29,7 @@ while ( have_posts() ) : the_post();
<p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p> <p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p>
<?php if ('open' == $post->ping_status) { ?> <?php if ( pings_open() ) { ?>
<p>The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em><?php trackback_url() ?></em></p> <p>The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em><?php trackback_url() ?></em></p>
<?php } ?> <?php } ?>
@ -57,7 +57,7 @@ if ( post_password_required($post) ) { // and it doesn't match the cookie
<p>No comments yet.</p> <p>No comments yet.</p>
<?php } ?> <?php } ?>
<?php if ('open' == $post->comment_status) { ?> <?php if ( comments_open() ) { ?>
<h2>Leave a comment</h2> <h2>Leave a comment</h2>
<p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p> <p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p>

View File

@ -35,7 +35,7 @@
</div> </div>
<?php else : // this is displayed if there are no comments so far ?> <?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?> <?php if ( comments_open() ) : ?>
<!-- If comments are open, but there are no comments. --> <!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?> <?php else : // comments are closed ?>
@ -46,7 +46,7 @@
<?php endif; ?> <?php endif; ?>
<?php if ('open' == $post->comment_status) : ?> <?php if ( comments_open() ) : ?>
<div id="respond"> <div id="respond">

View File

@ -32,19 +32,19 @@ get_header();
<?php the_taxonomies(); ?> <?php the_taxonomies(); ?>
You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed. You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { <?php if ( comments_open() && pings_open() ) {
// Both Comments and Pings are open ?> // Both Comments and Pings are open ?>
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site. You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { <?php } elseif ( !comments_open() && pings_open() ) {
// Only Pings are Open ?> // Only Pings are Open ?>
Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site. Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { <?php } elseif ( comments_open() && !pings_open() ) {
// Comments are open, Pings are not ?> // Comments are open, Pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed. You can skip to the end and leave a response. Pinging is currently not allowed.
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { <?php } elseif ( !comments_open() && !pings_open() ) {
// Neither Comments, nor Pings are open ?> // Neither Comments, nor Pings are open ?>
Both comments and pings are currently closed. Both comments and pings are currently closed.

View File

@ -36,19 +36,19 @@ get_header();
and is filed under <?php the_category(', ') ?>. and is filed under <?php the_category(', ') ?>.
You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed. You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { <?php if ( comments_open() && pings_open() ) {
// Both Comments and Pings are open ?> // Both Comments and Pings are open ?>
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site. You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { <?php } elseif ( !comments_open() && pings_open() ) {
// Only Pings are Open ?> // Only Pings are Open ?>
Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site. Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { <?php } elseif ( comments_open() && !pings_open() ) {
// Comments are open, Pings are not ?> // Comments are open, Pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed. You can skip to the end and leave a response. Pinging is currently not allowed.
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { <?php } elseif ( !comments_open() && !pings_open() ) {
// Neither Comments, nor Pings are open ?> // Neither Comments, nor Pings are open ?>
Both comments and pings are currently closed. Both comments and pings are currently closed.