diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-02-21 12:59:22 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-02-21 12:59:22 +0000 |
| commit | 433d32693df5a6957c577fde7383c2d8174fc06e (patch) | |
| tree | 908a0ea48cde229c7aba6d6bb5aee1229c624a04 /wp-inst/wp-admin/admin-functions.php | |
| parent | 0d11319eaf16b05640c9393ef1be7a3d9c1cd4e9 (diff) | |
| download | wordpress-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.php | 34 |
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('— ', $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('— ', $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&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> - <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the "%s" page.\\n"OK" to delete, "Cancel" 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&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> + <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=delete&post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the "%s" page.\\n"OK" to delete, "Cancel" 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); } } |
