Changeset 12927 for trunk/wp-admin/includes/template.php
- Timestamp:
- 02/02/2010 05:37:03 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/template.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r12859 r12927 1129 1129 $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list'; 1130 1130 // @todo use capability_type 1131 $can_publish = current_user_can( "publish_{$screen->post_type}s");1131 $can_publish = current_user_can($post_type_object->publish_cap); 1132 1132 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); 1133 1133 … … 1336 1336 </label> 1337 1337 1338 <?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( 'edit_others_posts') ) : ?>1338 <?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->edit_others_cap ) ) : ?> 1339 1339 1340 1340 <?php if ( $bulk ) : ?> … … 1358 1358 <?php endif; // $bulk ?> 1359 1359 1360 <?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_ posts' ) ?>1360 <?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_cap' ) ?> 1361 1361 1362 1362 </div> … … 1405 1405 */ 1406 1406 function get_inline_data($post) { 1407 1408 if ( ! current_user_can( 'edit_' . $post->post_type, $post->ID) )1407 $post_type_object = get_post_type_object($post->post_type); 1408 if ( ! current_user_can($post_type_object->edit_cap, $post->ID) ) 1409 1409 return; 1410 1410 … … 1427 1427 <div class="post_password">' . esc_html( $post->post_password ) . '</div>'; 1428 1428 1429 if ( $post_type_object->hierarchical ) 1430 echo '<div class="post_parent">' . $post->post_parent . '</div>'; 1431 1429 1432 if ( $post->post_type == 'page' ) 1430 echo ' 1431 <div class="post_parent">' . $post->post_parent . '</div> 1432 <div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div> 1433 <div class="menu_order">' . $post->menu_order . '</div>'; 1433 echo '<div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>'; 1434 1435 if ( $post_type_object->hierarchical ) 1436 echo '<div class="menu_order">' . $post->menu_order . '</div>'; 1437 1438 if ( is_object_in_taxonomy($post->post_type, 'post_tag') ) 1439 echo '<div class="tags_input">' . esc_html( str_replace( ',', ', ', get_tags_to_edit($post->ID) ) ) . '</div>'; 1440 1441 if ( is_object_in_taxonomy($post->post_type, 'post_tag') ) 1442 echo '<div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>'; 1434 1443 1435 1444 if ( $post->post_type == 'post' ) 1436 echo ' 1437 <div class="tags_input">' . esc_html( str_replace( ',', ', ', get_tags_to_edit($post->ID) ) ) . '</div> 1438 <div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div> 1439 <div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>'; 1445 echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>'; 1440 1446 1441 1447 echo '</div>'; … … 1496 1502 $edit_link = get_edit_post_link( $post->ID ); 1497 1503 $title = _draft_or_post_title(); 1504 $post_type_object = get_post_type_object($post->post_type); 1498 1505 ?> 1499 1506 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top"> … … 1514 1521 case 'cb': 1515 1522 ?> 1516 <th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>1523 <th scope="row" class="check-column"><?php if ( current_user_can( $post_type_object->edit_cap, $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th> 1517 1524 <?php 1518 1525 break; … … 1557 1564 $attributes = 'class="post-title column-title"' . $style; 1558 1565 ?> 1559 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>1566 <td <?php echo $attributes ?>><strong><?php if ( current_user_can($post_type_object->edit_cap, $post->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong> 1560 1567 <?php 1561 1568 if ( 'excerpt' == $mode ) … … 1563 1570 1564 1571 $actions = array(); 1565 if ( current_user_can( 'edit_post', $post->ID) && 'trash' != $post->post_status ) {1572 if ( current_user_can($post_type_object->edit_cap, $post->ID) && 'trash' != $post->post_status ) { 1566 1573 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; 1567 1574 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick Edit') . '</a>'; 1568 1575 } 1569 if ( current_user_can( 'delete_post', $post->ID) ) {1576 if ( current_user_can($post_type_object->delete_cap, $post->ID) ) { 1570 1577 if ( 'trash' == $post->post_status ) 1571 1578 $actions['untrash'] = "<a title='" . esc_attr(__('Restore this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>"; … … 1576 1583 } 1577 1584 if ( in_array($post->post_status, array('pending', 'draft')) ) { 1578 if ( current_user_can( 'edit_post', $post->ID) )1585 if ( current_user_can($post_type_object->edit_cap, $post->ID) ) 1579 1586 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 1580 1587 } elseif ( 'trash' != $post->post_status ) { … … 1659 1666 case 'control_edit': 1660 1667 ?> 1661 <td><?php if ( current_user_can( 'edit_post', $post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . "</a>"; } ?></td>1668 <td><?php if ( current_user_can($post_type_object->edit_cap, $post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . "</a>"; } ?></td> 1662 1669 <?php 1663 1670 break; … … 1665 1672 case 'control_delete': 1666 1673 ?> 1667 <td><?php if ( current_user_can( 'delete_post', $post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td>1674 <td><?php if ( current_user_can($post_type_object->delete_cap, $post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td> 1668 1675 <?php 1669 1676 break; … … 1726 1733 $title = _draft_or_post_title(); 1727 1734 $post_type = $page->post_type; 1735 $post_type_object = get_post_type_object($post_type); 1728 1736 ?> 1729 1737 <tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit"> 1730 1738 <?php 1731 1739 1732 foreach ( $posts_columns as $column_name=>$column_display_name) {1740 foreach ( $posts_columns as $column_name => $column_display_name ) { 1733 1741 $class = "class=\"$column_name column-$column_name\""; 1734 1742 … … 1781 1789 $edit_link = get_edit_post_link( $page->ID ); 1782 1790 ?> 1783 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_page', $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong>1791 <td <?php echo $attributes ?>><strong><?php if ( current_user_can($post_type_object->edit_cap, $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong> 1784 1792 <?php 1785 1793 $actions = array(); 1786 if ( current_user_can( 'edit_page', $page->ID) && $post->post_status != 'trash' ) {1794 if ( current_user_can($post_type_object->edit_cap, $page->ID) && $post->post_status != 'trash' ) { 1787 1795 $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; 1788 1796 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 1789 1797 } 1790 if ( current_user_can( 'delete_page', $page->ID) ) {1798 if ( current_user_can($post_type_object->delete_cap, $page->ID) ) { 1791 1799 if ( $post->post_status == 'trash' ) 1792 1800 $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("post.php?post_type=$post_type&action=untrash&post=$page->ID", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>"; … … 1797 1805 } 1798 1806 if ( in_array($post->post_status, array('pending', 'draft')) ) { 1799 if ( current_user_can( 'edit_page', $page->ID) )1807 if ( current_user_can($post_type_object->edit_cap, $page->ID) ) 1800 1808 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 1801 1809 } elseif ( $post->post_status != 'trash' ) { … … 2215 2223 $post = get_post($comment->comment_post_ID); 2216 2224 $the_comment_status = wp_get_comment_status($comment->comment_ID); 2217 $user_can = current_user_can('edit_post', $post->ID); 2225 $post_type_object = get_post_type_object($post->post_type); 2226 $user_can = current_user_can($post_type_object->edit_cap, $post->ID); 2218 2227 2219 2228 $author_url = get_comment_author_url();
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)