Changeset 30214 for trunk/src/wp-includes/class-wp-customize-manager.php
- Timestamp:
- 11/03/2014 09:34:44 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-manager.php
r30105 r30214 857 857 */ 858 858 public function render_control_templates() { 859 foreach ( $this->registered_control_types as $control_type ) {859 foreach ( $this->registered_control_types as $control_type ) { 860 860 $control = new $control_type( $this, 'temp', array() ); 861 861 $control->print_template(); … … 863 863 } 864 864 865 /** 866 * Helper function to compare two objects by priority .867 * 868 * @since 3.4.0 869 * 870 * @param object$a Object A.871 * @param object$b Object B.865 /** 866 * Helper function to compare two objects by priority, ensuring sort stability via instance_number. 867 * 868 * @since 3.4.0 869 * 870 * @param {WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control} $a Object A. 871 * @param {WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control} $b Object B. 872 872 * @return int 873 873 */ 874 874 protected final function _cmp_priority( $a, $b ) { 875 $ap = $a->priority; 876 $bp = $b->priority; 877 878 if ( $ap == $bp ) 879 return 0; 880 return ( $ap > $bp ) ? 1 : -1; 875 if ( $a->priority === $b->priority ) { 876 return $a->instance_number - $a->instance_number; 877 } else { 878 return $a->priority - $b->priority; 879 } 881 880 } 882 881 … … 892 891 public function prepare_controls() { 893 892 894 $this->controls = array_reverse( $this->controls );895 893 $controls = array(); 894 uasort( $this->controls, array( $this, '_cmp_priority' ) ); 896 895 897 896 foreach ( $this->controls as $id => $control ) { … … 906 905 907 906 // Prepare sections. 908 // Reversing makes uasort sort by time added when conflicts occur.909 $this->sections = array_reverse( $this->sections );910 907 uasort( $this->sections, array( $this, '_cmp_priority' ) ); 911 908 $sections = array(); … … 931 928 932 929 // Prepare panels. 933 // Reversing makes uasort sort by time added when conflicts occur.934 $this->panels = array_reverse( $this->panels );935 930 uasort( $this->panels, array( $this, '_cmp_priority' ) ); 936 931 $panels = array();
Note: See TracChangeset
for help on using the changeset viewer.