diff --git wp-admin/includes/template.php wp-admin/includes/template.php
index d8d82a0..6187b8d 100644
|
|
function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advan |
870 | 870 | } |
871 | 871 | |
872 | 872 | /** |
873 | | * Meta-Box template function |
| 873 | * Meta-Box template function for multiple styles |
| 874 | * |
| 875 | * @param string|object $screen Screen identifier |
| 876 | * @param string $context box context |
| 877 | * @param mixed $object gets passed to the box callback function as first parameter |
| 878 | * @return int number of meta_boxes |
| 879 | */ |
| 880 | function do_meta_boxes( $screen, $context, $object ) { |
| 881 | |
| 882 | $style = apply_filters( 'meta_boxes_style', 'boxes', $screen, $context, $object ); |
| 883 | |
| 884 | switch ( $style ) { |
| 885 | |
| 886 | case 'boxes': |
| 887 | $i = render_meta_boxes( $screen, $context, $object ); |
| 888 | break; |
| 889 | |
| 890 | case 'accordion': |
| 891 | $i = do_accordion_sections( $screen, $context, $object ); |
| 892 | break; |
| 893 | |
| 894 | default: |
| 895 | $i = apply_filters( 'render_meta_boxes_' . $style, 0, $screen, $context, $object ); |
| 896 | |
| 897 | } |
| 898 | |
| 899 | return $i; |
| 900 | } |
| 901 | |
| 902 | /** |
| 903 | * Meta-Box template function for the standard style |
874 | 904 | * |
875 | 905 | * @since 2.5.0 |
876 | 906 | * |
… |
… |
function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advan |
879 | 909 | * @param mixed $object gets passed to the box callback function as first parameter |
880 | 910 | * @return int number of meta_boxes |
881 | 911 | */ |
882 | | function do_meta_boxes( $screen, $context, $object ) { |
| 912 | function render_meta_boxes( $screen, $context, $object ) { |
883 | 913 | global $wp_meta_boxes; |
884 | 914 | static $already_sorted = false; |
885 | 915 | |
… |
… |
function do_meta_boxes( $screen, $context, $object ) { |
892 | 922 | |
893 | 923 | $hidden = get_hidden_meta_boxes( $screen ); |
894 | 924 | |
895 | | printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context)); |
| 925 | printf( '<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars( $context ) ); |
896 | 926 | |
897 | 927 | $i = 0; |
898 | 928 | do { |
899 | 929 | // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose |
900 | | if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) { |
| 930 | if ( ! $already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) { |
901 | 931 | foreach ( $sorted as $box_context => $ids ) { |
902 | | foreach ( explode(',', $ids ) as $id ) { |
| 932 | foreach ( explode( ',', $ids ) as $id ) { |
903 | 933 | if ( $id && 'dashboard_browser_nag' !== $id ) |
904 | 934 | add_meta_box( $id, null, null, $screen, $box_context, 'sorted' ); |
905 | 935 | } |
… |
… |
function do_meta_boxes( $screen, $context, $object ) { |
907 | 937 | } |
908 | 938 | $already_sorted = true; |
909 | 939 | |
910 | | if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) ) |
| 940 | if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) |
911 | 941 | break; |
912 | 942 | |
913 | | foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) { |
914 | | if ( isset($wp_meta_boxes[$page][$context][$priority]) ) { |
| 943 | foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) { |
| 944 | if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { |
915 | 945 | foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) { |
916 | 946 | if ( false == $box || ! $box['title'] ) |
917 | 947 | continue; |
918 | | $i++; |
919 | | $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : ''; |
920 | | echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n"; |
| 948 | $i ++; |
| 949 | $hidden_class = in_array( $box['id'], $hidden ) ? ' hide-if-js' : ''; |
| 950 | echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n"; |
921 | 951 | if ( 'dashboard_browser_nag' != $box['id'] ) |
922 | | echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>'; |
| 952 | echo '<div class="handlediv" title="' . esc_attr__( 'Click to toggle' ) . '"><br /></div>'; |
923 | 953 | echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n"; |
924 | 954 | echo '<div class="inside">' . "\n"; |
925 | | call_user_func($box['callback'], $object, $box); |
| 955 | call_user_func( $box['callback'], $object, $box ); |
926 | 956 | echo "</div>\n"; |
927 | 957 | echo "</div>\n"; |
928 | 958 | } |
929 | 959 | } |
930 | 960 | } |
931 | | } while(0); |
| 961 | } while ( 0 ); |
932 | 962 | |
933 | 963 | echo "</div>"; |
934 | 964 | |
935 | 965 | return $i; |
936 | | |
937 | 966 | } |
938 | 967 | |
939 | 968 | /** |