Changeset 28420
- Timestamp:
- 05/15/2014 05:17:12 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r28087 r28420 1235 1235 1236 1236 $r = wp_parse_args( $args, $defaults ); 1237 extract( $r, EXTR_SKIP ); 1237 $show = $r['show']; 1238 $show_option_all = $r['show_option_all']; 1239 $show_option_none = $r['show_option_none']; 1238 1240 1239 1241 $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) ); … … 1242 1244 1243 1245 $output = ''; 1244 if ( ! empty($users) && ( empty($hide_if_only_one_author) || count($users) > 1 ) ) {1245 $name = esc_attr( $ name);1246 if ( $ multi && ! $id )1246 if ( ! empty( $users ) && ( empty( $r['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) { 1247 $name = esc_attr( $r['name'] ); 1248 if ( $r['multi'] && ! $r['id'] ) { 1247 1249 $id = ''; 1248 else1249 $id = $ id ? " id='" . esc_attr( $id) . "'" : " id='$name'";1250 1251 $output = "<select name='{$name}'{$id} class=' $class'>\n";1252 1253 if ( $show_option_all ) 1250 } else { 1251 $id = $r['id'] ? " id='" . esc_attr( $r['id'] ) . "'" : " id='$name'"; 1252 } 1253 $output = "<select name='{$name}'{$id} class='" . $r['class'] . "'>\n"; 1254 1255 if ( $show_option_all ) { 1254 1256 $output .= "\t<option value='0'>$show_option_all</option>\n"; 1257 } 1255 1258 1256 1259 if ( $show_option_none ) { 1257 $_selected = selected( -1, $ selected, false );1260 $_selected = selected( -1, $r['selected'], false ); 1258 1261 $output .= "\t<option value='-1'$_selected>$show_option_none</option>\n"; 1259 1262 } … … 1262 1265 foreach ( (array) $users as $user ) { 1263 1266 $user->ID = (int) $user->ID; 1264 $_selected = selected( $user->ID, $ selected, false );1265 if ( $_selected ) 1267 $_selected = selected( $user->ID, $r['selected'], false ); 1268 if ( $_selected ) { 1266 1269 $found_selected = true; 1267 $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')'; 1268 $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n"; 1269 } 1270 1271 if ( $include_selected && ! $found_selected && ( $selected > 0 ) ) { 1272 $user = get_userdata( $selected ); 1273 $_selected = selected( $user->ID, $selected, false ); 1274 $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')'; 1275 $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n"; 1270 } 1271 $display = ! empty( $user->$show ) ? $user->$show : '('. $user->user_login . ')'; 1272 $output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n"; 1273 } 1274 1275 if ( $r['include_selected'] && ! $found_selected && ( $r['selected'] > 0 ) ) { 1276 $user = get_userdata( $r['selected'] ); 1277 $_selected = selected( $user->ID, $r['selected'], false ); 1278 $display = ! empty( $user->$show ) ? $user->$show : '('. $user->user_login . ')'; 1279 $output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n"; 1276 1280 } 1277 1281 … … 1286 1290 * @param string $output HTML output generated by wp_dropdown_users(). 1287 1291 */ 1288 $ output= apply_filters( 'wp_dropdown_users', $output );1289 1290 if ( $ echo )1291 echo $ output;1292 1293 return $ output;1292 $html = apply_filters( 'wp_dropdown_users', $output ); 1293 1294 if ( $r['echo'] ) { 1295 echo $html; 1296 } 1297 return $html; 1294 1298 } 1295 1299
Note: See TracChangeset
for help on using the changeset viewer.