summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-admin/admin-functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-02-21 12:59:22 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-02-21 12:59:22 +0000
commit433d32693df5a6957c577fde7383c2d8174fc06e (patch)
tree908a0ea48cde229c7aba6d6bb5aee1229c624a04 /wp-inst/wp-admin/admin-functions.php
parent0d11319eaf16b05640c9393ef1be7a3d9c1cd4e9 (diff)
downloadwordpress-mu-433d32693df5a6957c577fde7383c2d8174fc06e.tar.gz
wordpress-mu-433d32693df5a6957c577fde7383c2d8174fc06e.tar.xz
wordpress-mu-433d32693df5a6957c577fde7383c2d8174fc06e.zip
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@532 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-admin/admin-functions.php')
-rw-r--r--wp-inst/wp-admin/admin-functions.php34
1 files changed, 17 insertions, 17 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php
index 81ffe2d..aabf77e 100644
--- a/wp-inst/wp-admin/admin-functions.php
+++ b/wp-inst/wp-admin/admin-functions.php
@@ -643,19 +643,24 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
}
}
-function page_rows($parent = 0, $level = 0, $pages = 0) {
+function page_rows($parent = 0, $level = 0, $pages = 0, $hierarchy = true) {
global $wpdb, $class, $post;
+
if (!$pages)
$pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' ORDER BY menu_order");
- if ($pages) {
- foreach ($pages as $post) {
- start_wp();
- if ($post->post_parent == $parent) {
- $post->post_title = wp_specialchars($post->post_title);
- $pad = str_repeat('&#8212; ', $level);
- $id = $post->ID;
- $class = ('alternate' == $class) ? '' : 'alternate';
+ if (! $pages)
+ return false;
+
+ foreach ($pages as $post) {
+ setup_postdata($post);
+ if ( $hierarchy && ($post->post_parent != $parent) )
+ continue;
+
+ $post->post_title = wp_specialchars($post->post_title);
+ $pad = str_repeat('&#8212; ', $level);
+ $id = $post->ID;
+ $class = ('alternate' == $class) ? '' : 'alternate';
?>
<tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
<th scope="row"><?php echo $post->ID; ?></th>
@@ -665,17 +670,12 @@ function page_rows($parent = 0, $level = 0, $pages = 0) {
<td><?php the_author() ?></td>
<td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td>
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
- <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
- <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td>
+ <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
+ <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td>
</tr>
<?php
-
- page_rows($id, $level +1, $pages);
- }
- }
- } else {
- return false;
+ if ( $hierarchy) page_rows($id, $level + 1, $pages);
}
}