Ticket #5924: move_func.diff

File move_func.diff, 2.7 kB (added by jhodgdon, 10 months ago)

patch that moves the add_meta_box function from wp-admin/includes/template.php to wp-includes/plugin.php

  • E:/EclipseWorkWeb/WordPressDev/wp-includes/plugin.php

    old new  
    593593                return $function[0].$function[1]; 
    594594} 
    595595 
     596 
     597/** 
     598 * add_meta_box() - Add a meta box to an edit form 
     599 * 
     600 * @since 2.5 
     601 * 
     602 * @param string $id String for use in the 'id' attribute of tags. 
     603 * @param string $title Title of the meta box 
     604 * @param string $callback Function that fills the box with the desired content.  The function should echo its output. 
     605 * @param string $page The type of edit page on which to show the box (post, page, link) 
     606 * @param string $context The context within the page where the boxes should show ('normal', 'advanced') 
     607 */ 
     608function add_meta_box($id, $title, $callback, $page, $context = 'advanced') { 
     609        global $wp_meta_boxes; 
     610 
     611        if  ( !isset($wp_meta_boxes) ) 
     612                $wp_meta_boxes = array(); 
     613        if ( !isset($wp_meta_boxes[$page]) ) 
     614                $wp_meta_boxes[$page] = array(); 
     615        if ( !isset($wp_meta_boxes[$page][$context]) ) 
     616                $wp_meta_boxes[$page][$context] = array(); 
     617 
     618        $wp_meta_boxes[$page][$context][] = array('id' => $id, 'title' => $title, 'callback' => $callback); 
     619} 
     620 
    596621?> 
  • E:/EclipseWorkWeb/WordPressDev/wp-admin/includes/template.php

    old new  
    952952                echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />'; 
    953953} 
    954954 
    955 /** 
    956  * add_meta_box() - Add a meta box to an edit form 
    957  * 
    958  * @since 2.5 
    959  * 
    960  * @param string $id String for use in the 'id' attribute of tags. 
    961  * @param string $title Title of the meta box 
    962  * @param string $callback Function that fills the box with the desired content.  The function should echo its output. 
    963  * @param string $page The type of edit page on which to show the box (post, page, link) 
    964  * @param string $context The context within the page where the boxes should show ('normal', 'advanced') 
    965  */ 
    966 function add_meta_box($id, $title, $callback, $page, $context = 'advanced') { 
    967         global $wp_meta_boxes; 
    968  
    969         if  ( !isset($wp_meta_boxes) ) 
    970                 $wp_meta_boxes = array(); 
    971         if ( !isset($wp_meta_boxes[$page]) ) 
    972                 $wp_meta_boxes[$page] = array(); 
    973         if ( !isset($wp_meta_boxes[$page][$context]) ) 
    974                 $wp_meta_boxes[$page][$context] = array(); 
    975  
    976         $wp_meta_boxes[$page][$context][] = array('id' => $id, 'title' => $title, 'callback' => $callback); 
    977 } 
    978  
    979955function do_meta_boxes($page, $context, $object) { 
    980956        global $wp_meta_boxes; 
    981957