post_parent dropdown fixes. get_pages() cache fix to eliminate duplicate queries.

git-svn-id: http://svn.automattic.com/wordpress/trunk@10070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-12-05 19:19:24 +00:00
parent b13f38f6e3
commit ae7bb0d440
4 changed files with 6 additions and 6 deletions

View File

@ -1050,8 +1050,8 @@ function inline_edit_row( $type ) {
$dropdown_args = array('selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0); $dropdown_args = array('selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0);
if ( $bulk ) if ( $bulk )
$dropdown_args['show_option_no_change'] = __('- No Change -'); $dropdown_args['show_option_no_change'] = __('- No Change -');
wp_dropdown_pages($dropdown_args);
?> ?>
<?php wp_dropdown_pages($dropdown_args); ?>
</label> </label>
<?php if ( !$bulk ) : ?> <?php if ( !$bulk ) : ?>

View File

@ -1233,7 +1233,7 @@ class Walker_PageDropdown extends Walker {
function start_el(&$output, $page, $depth, $args) { function start_el(&$output, $page, $depth, $args) {
$pad = str_repeat('&nbsp;', $depth * 3); $pad = str_repeat('&nbsp;', $depth * 3);
$output .= "\t<option value=\"$page->ID\""; $output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
if ( $page->ID == $args['selected'] ) if ( $page->ID == $args['selected'] )
$output .= ' selected="selected"'; $output .= ' selected="selected"';
$output .= '>'; $output .= '>';

View File

@ -565,11 +565,11 @@ function wp_dropdown_pages($args = '') {
$output = ''; $output = '';
if ( ! empty($pages) ) { if ( ! empty($pages) ) {
$output = "<select name='$name' id='$name'>\n"; $output = "<select name=\"$name\" id=\"$name\">\n";
if ( $show_option_no_change ) if ( $show_option_no_change )
$output .= "\t<option value='-1'>$show_option_no_change</option>"; $output .= "\t<option value=\"-1\">$show_option_no_change</option>";
if ( $show_option_none ) if ( $show_option_none )
$output .= "\t<option value='$option_none_value'>$show_option_none</option>\n"; $output .= "\t<option value=\"$option_none_value\">$show_option_none</option>\n";
$output .= walk_page_dropdown_tree($pages, $depth, $r); $output .= walk_page_dropdown_tree($pages, $depth, $r);
$output .= "</select>\n"; $output .= "</select>\n";
} }

View File

@ -2065,7 +2065,7 @@ function &get_pages($args = '') {
$r = wp_parse_args( $args, $defaults ); $r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP ); extract( $r, EXTR_SKIP );
$key = md5( serialize( $r ) ); $key = md5( serialize( compact(array_keys($defaults)) ) );
if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) { if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) {
if ( isset( $cache[ $key ] ) ) { if ( isset( $cache[ $key ] ) ) {
$pages = apply_filters('get_pages', $cache[ $key ], $r ); $pages = apply_filters('get_pages', $cache[ $key ], $r );