Ticket #24722: 24722-full.diff
File 24722-full.diff, 1.8 KB (added by , 12 years ago) |
---|
-
wp-includes/post.php
804 804 * @return array List of post statuses. 805 805 */ 806 806 function get_post_statuses() { 807 $status = array( 808 'draft' => __('Draft'), 809 'pending' => __('Pending Review'), 810 'private' => __('Private'), 811 'publish' => __('Published') 812 ); 807 global $wp_post_statuses; 808 $stati = wp_set_array_key_value_from_objects( $wp_post_statuses, 'name', 'label' ); 813 809 814 return $stat us;810 return $stati; 815 811 } 816 812 817 813 /** … … 831 827 'publish' => __('Published') 832 828 ); 833 829 834 return $stat us;830 return $stati; 835 831 } 836 832 837 833 /** -
wp-includes/functions.php
2629 2629 return $list; 2630 2630 } 2631 2631 2632 2633 2632 2634 /** 2635 * This just takes an incoming array of objects and returns an array of keys/values from the objects for what you want returned. 2636 * @param array $objects array of objects 2637 * @param string $keyindex What object property you want to be the key 2638 * @param string $valueindex What object propery you want to be the value 2639 * @return array An array set up with the key/value pairs as indicated in the params 2640 */ 2641 function wp_set_array_key_value_from_objects( $objects, $keyindex, $valueindex ) { 2642 $formedarray = array(); 2643 if ( !is_array( $objects ) ) 2644 return; 2645 2646 foreach ( $objects as $obj ) { 2647 if ( !isset( $obj->$keyindex ) ) 2648 continue; 2649 if ( !isset( $obj->$valueindex ) ) 2650 continue; 2651 2652 $formedarray[$obj->$keyindex] = $obj->$valueindex; 2653 } 2654 2655 return $formedarray; 2656 } 2657 2658 /** 2633 2659 * Filters a list of objects, based on a set of key => value arguments. 2634 2660 * 2635 2661 * @since 3.1.0