### Eclipse Workspace Patch 1.0
#P wordpress
|
|
|
474 | 474 | * @return WP_User |
475 | 475 | */ |
476 | 476 | function WP_User( $id, $name = '' ) { |
477 | | |
478 | | if ( empty( $id ) && empty( $name ) ) |
| 477 | |
| 478 | // parse input |
| 479 | $id = null; |
| 480 | $name = null; |
| 481 | if ( 2 != ( $num = func_num_args() ) && $num != 1 ) |
479 | 482 | return; |
480 | | |
481 | | if ( ! is_numeric( $id ) ) { |
482 | | $name = $id; |
483 | | $id = 0; |
| 483 | |
| 484 | $param = func_get_args(); |
| 485 | |
| 486 | if ( 2 == $num ) { |
| 487 | $name = $param[1]; |
| 488 | } else { |
| 489 | $is_id = is_scalar($param[0]) ? (string)$id === (string)(int)$id : false; |
| 490 | $is_id && $id = $param[0] || $name = $param[0]; |
484 | 491 | } |
485 | | |
486 | | if ( ! empty( $id ) ) |
| 492 | |
| 493 | // process input |
| 494 | if ( isset( $id ) ) { |
487 | 495 | $this->data = get_userdata( $id ); |
488 | | else |
| 496 | } elseif ( isset( $name ) ) { |
489 | 497 | $this->data = get_userdatabylogin( $name ); |
490 | | |
| 498 | } else { |
| 499 | return; |
| 500 | } |
| 501 | |
491 | 502 | if ( empty( $this->data->ID ) ) |
492 | 503 | return; |
493 | 504 | |