| 681 | | // Args prefixed with an underscore are reserved for internal use. |
| 682 | | $defaults = array( |
| 683 | | 'label' => false, |
| 684 | | 'label_count' => false, |
| 685 | | 'exclude_from_search' => null, |
| 686 | | '_builtin' => false, |
| 687 | | 'public' => null, |
| 688 | | 'internal' => null, |
| 689 | | 'protected' => null, |
| 690 | | 'private' => null, |
| 691 | | 'publicly_queryable' => null, |
| 692 | | 'show_in_admin_status_list' => null, |
| 693 | | 'show_in_admin_all_list' => null, |
| 694 | | ); |
| 695 | | $args = wp_parse_args($args, $defaults); |
| 696 | | $args = (object) $args; |
| | 681 | $post_status_object = new WP_Post_Status( $post_status, $args ); |
| 701 | | // Set various defaults. |
| 702 | | if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private ) |
| 703 | | $args->internal = true; |
| 704 | | |
| 705 | | if ( null === $args->public ) |
| 706 | | $args->public = false; |
| 707 | | |
| 708 | | if ( null === $args->private ) |
| 709 | | $args->private = false; |
| 710 | | |
| 711 | | if ( null === $args->protected ) |
| 712 | | $args->protected = false; |
| 713 | | |
| 714 | | if ( null === $args->internal ) |
| 715 | | $args->internal = false; |
| 716 | | |
| 717 | | if ( null === $args->publicly_queryable ) |
| 718 | | $args->publicly_queryable = $args->public; |
| 719 | | |
| 720 | | if ( null === $args->exclude_from_search ) |
| 721 | | $args->exclude_from_search = $args->internal; |
| 722 | | |
| 723 | | if ( null === $args->show_in_admin_all_list ) |
| 724 | | $args->show_in_admin_all_list = !$args->internal; |
| 725 | | |
| 726 | | if ( null === $args->show_in_admin_status_list ) |
| 727 | | $args->show_in_admin_status_list = !$args->internal; |
| 728 | | |
| 729 | | if ( false === $args->label ) |
| 730 | | $args->label = $post_status; |
| 731 | | |
| 732 | | if ( false === $args->label_count ) |
| 733 | | $args->label_count = array( $args->label, $args->label ); |
| 734 | | |
| 735 | | $wp_post_statuses[$post_status] = $args; |
| 736 | | |
| 737 | | return $args; |
| | 685 | return $post_status_object; |