Advertisement
Guest User

Meta Boxes 2.4.1 Date Edit

a guest
Dec 13th, 2010
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 20.85 KB | None | 0 0
  1. <?php
  2.      
  3.     /**
  4.      * Create meta boxes for editing pages in WordPress
  5.      * Compatible with custom post types in WordPress 3.0
  6.      *
  7.      * Support input types: text, textarea, checkbox, radio box, select, file, image
  8.      *
  9.      * @author: Rilwis
  10.      * @url: http://www.deluxeblogtips.com/2010/04/how-to-create-meta-box-wordpress-post.html
  11.      * @version: 2.4.1
  12.      *
  13.      * Changelog:
  14.      * - 2.4.1: fix bug of not receiving value for select box
  15.      * - 2.4: (image upload features are credit to Kai http://twitter.com/ungestaltbar)
  16.      *   + change image upload using meta fields to using default WP gallery
  17.      *   + add delete button for images, using ajax
  18.      *   + allow to upload multiple images
  19.      *   + add validation for meta fields
  20.      * - 2.3: add wysiwyg editor type, improve check for upload fields, change context and priority attributes to optional
  21.      * - 2.2: add enctype to post form (fix upload bug), thanks to http://www.hashbangcode.com/blog/add-enctype-wordpress-post-and-page-forms-471.html
  22.      * - 2.1: add file upload, image upload support
  23.      * - 2.0: oop code, support multiple post types, multiple meta boxes
  24.      * - 1.0: procedural code
  25.      */
  26.      /*
  27.       * Edits added by Funkatron
  28.       * Changelog:
  29.       *-Date feature added.  Creates 3 select boxes corresponding with month, day and year and saves in 3 custom fields by taking the id and appending with '_month',
  30.       * '_day', or '_year'.  year_range feature added to set a range of years.  See example below for usage.
  31.       *-Taxonomy feature added.  Id corresponds with name of already precreated taxonomy.  Can be set to either 'taxonomy-select' to mimic categories or
  32.       * 'taxonomy-checkbox' to mimic tags.  Autopopulates from existing taxonomy terms.
  33.       */
  34.     /*
  35.     Usage: for more information, please visit: http://www.deluxeblogtips.com/2010/04/how-to-create-meta-box-wordpress-post.html
  36.      
  37.     // Register meta boxes
  38.      
  39.     $prefix = 'dbt_';
  40.      
  41.     $meta_boxes = array();
  42.      
  43.     // first meta box
  44.     $meta_boxes[] = array(
  45.             'id' => 'my-meta-box-1',
  46.             'title' => 'Custom meta box 1',
  47.             'pages' => array('post', 'page', 'link'), // multiple post types, accept custom post types
  48.             'context' => 'normal', // normal, advanced, side (optional)
  49.             'priority' => 'high', // high, low (optional)
  50.             'fields' => array(
  51.                     array(
  52.                             'name' => 'Text box',
  53.                             'desc' => 'Enter something here',
  54.                             'id' => $prefix . 'text',
  55.                             'type' => 'text', // text box
  56.                             'std' => 'Default value 1',
  57.                             'validate_func' => 'check_text' // validate function, created below, inside RW_Meta_Box_Validate class
  58.                     ),
  59.                     array(
  60.                             'name' => 'Textarea',
  61.                             'desc' => 'Enter big text here',
  62.                             'id' => $prefix . 'textarea',
  63.                             'type' => 'textarea', // text area
  64.                             'std' => 'Default value 2'
  65.                     ),
  66.                     array(
  67.                             'name' => 'Select box',
  68.                             'id' => $prefix . 'select',
  69.                             'type' => 'select', // select box
  70.                             'options' => array( // array of name, value pairs for select box
  71.                                     array('name' => 'Name 1', 'value' => 'Value 1'),
  72.                                     array('name' => 'Name 2', 'value' => 'Value 2')
  73.                             )
  74.                     ),
  75.                     array(
  76.                             'name' => 'Radio',
  77.                             'id' => $prefix . 'radio',
  78.                             'type' => 'radio', // radio box
  79.                             'options' => array( // array of name, value pairs for radio options
  80.                                     array('name' => 'Name 1', 'value' => 'Value 1'),
  81.                                     array('name' => 'Name 2', 'value' => 'Value 2')
  82.                             )
  83.                     ),
  84.                     array(
  85.                             'name' => 'Checkbox', // check box
  86.                             'id' => $prefix . 'checkbox',
  87.                             'type' => 'checkbox'
  88.                     )
  89.             )
  90.     );
  91.      
  92.     // second meta box
  93.     $meta_boxes[] = array(
  94.             'id' => 'my-meta-box-2',
  95.             'title' => 'Custom meta box 2',
  96.             'pages' => array('post', 'film', 'album'), // custom post types, since WordPress 3.0
  97.             'context' => 'normal',
  98.             'priority' => 'high',
  99.             'fields' => array(
  100.                     array(
  101.                             'name' => 'Rich editor',
  102.                             'id' => $prefix . 'wysiwyg',
  103.                             'type' => 'wysiwyg', // WYSIWYG editor
  104.                             'std' => 'Default value 2'
  105.                     ),
  106.                     array(
  107.                             'name' => 'File upload',
  108.                             'desc' => 'For file upload',
  109.                             'id' => $prefix . 'file',
  110.                             'type' => 'file' // file upload
  111.                     ),
  112.                     array(
  113.                             'name' => 'Image upload',
  114.                             'desc' => 'For image upload',
  115.                             'id' => $prefix . 'image',
  116.                             'type' => 'image' // image upload
  117.                     ),
  118.      
  119.             )
  120.     );
  121.     //New metabox elements: date, taxonomy select and taxonomy checkboxes
  122.     metaboxes[] = array(
  123.             'id' => 'my-meta-box-2',
  124.             'title' => 'Custom meta box 2',
  125.             'pages' => array('post', 'film', 'album'), // custom post types, since WordPress 3.0
  126.             'context' => 'normal',
  127.             'priority' => 'high',
  128.             'fields' => array(
  129.                     array(
  130.                             'name' => 'Due Date:',
  131.                             'desc' => 'date is due',
  132.                             'id' =>  'due_date',
  133.                             'type' => 'date',
  134.                  'year_range' => array('min'=>1990, max => 2011)
  135.                     ),
  136.             array(
  137.                             'name' => 'Places',
  138.                             'desc' => 'Enter something here',
  139.                             'id' => 'places',
  140.                             'type' => 'taxonomy-select'
  141.             ),
  142.             array(
  143.                             'name' => 'People',
  144.                             'desc' => 'Enter something here',
  145.                             'id' => 'people',
  146.                             'type' => 'taxonomy-checkbox'
  147.                     )
  148.  
  149.      
  150.             )
  151.     );
  152.      
  153.     foreach ($meta_boxes as $meta_box) {
  154.             $my_box = new RW_Meta_Box($meta_box);
  155.     }
  156.      
  157.     // Validate value of meta fields
  158.      
  159.     // Define ALL validation methods inside this class
  160.     // and use the names of these methods in the definition of meta boxes (key 'validate_func' of each field)
  161.      
  162.     class RW_Meta_Box_Validate {
  163.             function check_text($text) {
  164.                     if ($text != 'hello') {
  165.                             return false;
  166.                     }
  167.                     return true;
  168.             }
  169.     }
  170.     */
  171.      
  172.     /**
  173.      * AJAX delete images on the fly. This script is a slightly altered version of a function used by the Plugin "Verve Meta Boxes"
  174.      * http://wordpress.org/extend/plugins/verve-meta-boxes/
  175.      *
  176.      */
  177.  
  178. add_action('wp_ajax_unlink_file', 'unlink_file_callback');
  179. function unlink_file_callback() {
  180.     global $wpdb;
  181.     if ($_POST['data']) {
  182.         $data = explode('-', $_POST['data']);
  183.         $att_id = $data[0];
  184.         $post_id = $data[1];
  185.         wp_delete_attachment($att_id);
  186.     }
  187. }
  188.  
  189. /**
  190.  * Create meta boxes
  191.  */
  192. class RW_Meta_Box {
  193.  
  194.     protected $_meta_box;
  195.  
  196.     // create meta box based on given data
  197.     function __construct($meta_box) {
  198.         if (!is_admin()) return;
  199.  
  200.         $this->_meta_box = $meta_box;
  201.  
  202.         // fix upload bug: http://www.hashbangcode.com/blog/add-enctype-wordpress-post-and-page-forms-471.html
  203.         $upload = false;
  204.         foreach ($meta_box['fields'] as $field) {
  205.             if ($field['type'] == 'file' || $field['type'] == 'image') {
  206.                     $upload = true;
  207.                     break;
  208.             }
  209.         }
  210.         $current_page = substr(strrchr($_SERVER['PHP_SELF'], '/'), 1, -4);
  211.         if ($upload && ($current_page == 'page' || $current_page == 'page-new' || $current_page == 'post' || $current_page == 'post-new')) {
  212.             add_action('admin_head', array(&$this, 'add_post_enctype'));
  213.             add_action('admin_head', array(&$this, 'add_unlink_script'));
  214.             add_action('admin_head', array(&$this, 'add_clone_script'));
  215.         }
  216.  
  217.         add_action('admin_menu', array(&$this, 'add'));
  218.  
  219.         add_action('save_post', array(&$this, 'save'));
  220.     }
  221.  
  222.     function add_post_enctype() {
  223.         echo '
  224.         <script type="text/javascript">
  225.         jQuery(document).ready(function(){
  226.                 jQuery("#post").attr("enctype", "multipart/form-data");
  227.                 jQuery("#post").attr("encoding", "multipart/form-data");
  228.         });
  229.         </script>';
  230.     }
  231.  
  232.     function add_unlink_script(){
  233.         echo '
  234.         <script type="text/javascript">
  235.         jQuery(document).ready(function($){
  236.                 $("a.deletefile").click(function () {
  237.                         var parent = jQuery(this).parent(),
  238.                                 data = jQuery(this).attr("rel"),
  239.                                 _wpnonce = $("input[name=\'_wpnonce\']").val();
  240.  
  241.                         $.post(
  242.                                 ajaxurl,
  243.                                 {action: \'unlink_file\', _wpnonce: _wpnonce, data: data},
  244.                                 function(response){
  245.                                         //$("#info").html(response).fadeOut(3000);
  246.                                         //alert(data.post);
  247.                                 },
  248.                                 "json"
  249.                         );
  250.                         parent.fadeOut("slow");
  251.                         return false;
  252.                 });
  253.         });
  254.         </script>';
  255.     }
  256.  
  257.     function add_clone_script() {
  258.         echo '
  259.         <script type="text/javascript">
  260.         jQuery(document).ready(function() {
  261.                 jQuery(".add").click(function() {
  262.                         jQuery("#newimages p:first-child").clone().insertAfter("#newimages p:last").show();
  263.                         return false;
  264.                 });
  265.                 jQuery(".remove").click(function() {
  266.                         jQuery(this).parent().remove();
  267.                 });
  268.         });
  269.         </script>';
  270.     }
  271.  
  272.  
  273.     /// Add meta box for multiple post types
  274.     function add() {
  275.         $this->_meta_box['context'] = empty($this->_meta_box['context']) ? 'normal' : $this->_meta_box['context'];
  276.         $this->_meta_box['priority'] = empty($this->_meta_box['priority']) ? 'high' : $this->_meta_box['priority'];
  277.         foreach ($this->_meta_box['pages'] as $page) {
  278.             add_meta_box($this->_meta_box['id'], $this->_meta_box['title'], array(&$this, 'show'), $page, $this->_meta_box['context'], $this->_meta_box['priority']);
  279.         }
  280.     }
  281.  
  282.     // Callback function to show fields in meta box
  283.     function show() {
  284.         global $post;
  285.  
  286.         // Use nonce for verification
  287.         echo '<input type="hidden" name="wp_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
  288.  
  289.         echo '<table class="form-table">';
  290.  
  291.         foreach ($this->_meta_box['fields'] as $field) {
  292.                 // get current post meta data
  293.             $meta = get_post_meta($post->ID, $field['id'], true);
  294.  
  295.             echo '<tr>',
  296.                             '<th style="width:20%"><label for="', $field['id'], '">', $field['name'], '</label></th>',
  297.                             '<td>';
  298.             switch ($field['type']) {
  299.                 case 'text':
  300.                     echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />',
  301.                     '<br />', $field['desc'];
  302.                     break;
  303.                 case 'textarea':
  304.                     echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="15" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>',
  305.                     '<br />', $field['desc'];
  306.                     break;
  307.                 case 'select':
  308.                     echo '<select name="', $field['id'], '" id="', $field['id'], '">';
  309.                     foreach ($field['options'] as $option) {
  310.                         echo '<option value="', $option['value'], '"', $meta == $option['value'] ? ' selected="selected"' : '', '>', $option['name'], '</option>';
  311.                     }
  312.                     echo '</select>';
  313.                     break;
  314.                 case 'date':
  315.                     $meta_month = get_post_meta($post->ID, $field['id'].'_month', true);
  316.                     $meta_day = get_post_meta($post->ID, $field['id'].'_day', true);
  317.                     $meta_year = get_post_meta($post->ID, $field['id'].'_year', true);
  318.                     $years = range(isset($field['year_range']['max']) ? $field['year_range']['max'] :(int) date('Y'), isset($field['year_range']['min']) ? $field['year_range']['min'] : 1950);
  319.                     $months = array(1 => 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
  320.                     $days = range(1,31);
  321.                     echo '<select name="', $field['id'], '_month" id="', $field['id'], '_month">';
  322.                     foreach ($months as $month => $mvalue) {
  323.                             echo '<option value="', $month, '"', (int) $meta_month == (int) $month ? ' selected="selected"' : '', '>', $mvalue, '</option>';
  324.                     }
  325.                     echo '</select>';
  326.                     echo '<select name="', $field['id'], '_day" id="', $field['id'], '_day">';
  327.                     foreach ($days as $day) {
  328.                             echo '<option value="', $day, '"', (int) $meta_day == (int) $day ? ' selected="selected"' : '', '>', $day, '</option>';
  329.                     }
  330.                     echo '</select>';
  331.                     echo '<select name="', $field['id'], '_year" id="', $field['id'], '_year">';
  332.                     foreach ($years as $year) {
  333.                             echo '<option value="', $year, '"', (int) $meta_year == (int) $year ? ' selected="selected"' : '', '>', $year, '</option>';
  334.                     }
  335.                     echo '</select>';
  336.  
  337.                     break;
  338.                 case 'taxonomy-select':
  339.                     $taxterms = get_terms($field['id'], 'hide_empty=0');
  340.                     echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';
  341.                     $names = wp_get_object_terms($post->ID, $field['id']);
  342.                     echo '<option value=""';
  343.                     if (!count($names))
  344.                         echo 'selected';
  345.                     echo 'None</option>';
  346.                     foreach ($taxterms as $taxterm) {
  347.                         if (!is_wp_error($names) && !empty($names) && !strcmp($taxterm->slug, $names[0]->slug))
  348.                             echo '<option value="' . $taxterm->slug . '" selected>' . $taxterm->name . '</option>';
  349.                         else
  350.                             echo '<option value="' . $taxterm->slug . '">' . $taxterm->name . '</option>';
  351.                     }
  352.                     echo '</select>';
  353.                     break;
  354.                 case 'taxonomy-checkbox':
  355.                     $taxterms = get_terms($field['id'], 'hide_empty=0');
  356.                     $names = wp_get_object_terms($post->ID, $field['id']);
  357.                     foreach ($taxterms as $taxterm) {
  358.                         echo '<input type="checkbox" name="', $field['id'], '[]" id="', $field['id'], '[]"value="' . $taxterm->slug . '"';
  359.                         if(!is_wp_error($names) && !empty($names)) {
  360.                             foreach($names as $name) {
  361.                                 if(!strcmp($taxterm->slug, $name->slug)) {
  362.                                      echo 'checked="checked"';
  363.                                      continue;
  364.                                 }
  365.                             }
  366.                         }
  367.                         echo '>' . $taxterm->name . '</input>'.'<br />';
  368.                              
  369.                     }
  370.                     break;
  371.                 case 'radio':
  372.                     foreach ($field['options'] as $option) {
  373.                         echo '<input type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'];
  374.                     }
  375.                     break;
  376.                 case 'checkbox':
  377.                     echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
  378.                     break;
  379.                 case 'file':
  380.                     echo $meta ? "$meta<br />" : '', '<input type="file" name="', $field['id'], '" id="', $field['id'], '" />','<br />', $field['desc'];
  381.                     break;
  382.                 case 'wysiwyg':
  383.                     echo '<textarea name="', $field['id'], '" id="', $field['id'], '" class="theEditor" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>','<br />', $field['desc'];
  384.                     break;
  385.                 case 'image':
  386. ?>
  387. <h2>Images attached to this post</h2>
  388. <div id="uploaded">
  389. <?php
  390.                     $args = array(
  391.                         'post_type' => 'attachment',
  392.                         'post_parent' => $post->ID,
  393.                         'numberposts' => -1,
  394.                         'post_status' => NULL
  395.                     );
  396.                     $attachs = get_posts($args);
  397.                     if (!empty($attachs)) {
  398.                         foreach ($attachs as $att) {
  399. ?>
  400. <div class="single-att" style="margin: 0 10px 10px 0; float: left;"> <?php echo wp_get_attachment_image($att->ID, 'thumbnail'); ?> <br />
  401. <a class="deletefile" href="#" rel="<?php echo $att->ID ?>-<?php echo $post_id ?> "title="Delete this file">Delete Image</a> </div>
  402. <?php
  403.                         }
  404.                     } else {
  405.                         echo 'No Images uploaded yet';
  406.                     }
  407. ?>
  408. </div>
  409. <h2>Upload new Images</h2>
  410. <div id="newimages">
  411. <p>
  412. <input type="file" name="<?php echo $field['id'] ?>[]" id="" />
  413. </p>
  414. <a class="add" href="#">Add More Images</a> </div>
  415. <?php
  416.                     break;
  417.             }
  418.                 echo    '<td>',
  419.                         '</tr>';
  420.         }
  421.  
  422.         echo '</table>';
  423.     }
  424.  
  425.     // Save data from meta box
  426.     function save($post_id) {
  427.            
  428.         $real_post_id = isset($_POST['post_ID']) ? $_POST['post_ID'] : NULL ;
  429.         // verify nonce
  430.         if (!wp_verify_nonce($_POST['wp_meta_box_nonce'], basename(__FILE__))) {
  431.             return $post_id;
  432.         }
  433.    
  434.         // check autosave
  435.         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
  436.             return $post_id;
  437.         }
  438.    
  439.         // check permissions
  440.         if ('page' == $_POST['post_type']) {
  441.             if (!current_user_can('edit_page', $post_id)) {
  442.                 return $post_id;
  443.             }
  444.         } elseif (!current_user_can('edit_post', $post_id)) {
  445.             return $post_id;
  446.         }
  447.    
  448.         foreach ($this->_meta_box['fields'] as $field) {
  449.             $name = $field['id'];
  450.             $old = get_post_meta($real_post_id, $name, true);
  451.             $new = $_POST[$field['id']];
  452.             if ($field['type'] == 'file' || $field['type'] == 'image') {
  453.                 if (!empty($_FILES[$name])) {
  454.                     $this->fix_file_array($_FILES[$name]);
  455.                     foreach ($_FILES[$name] as $position => $fileitem) {
  456.                         $file = wp_handle_upload($fileitem, array('test_form' => false));
  457.                         $filename = $file['url'];
  458.                         if (!empty($filename)) {
  459.                             $wp_filetype = wp_check_filetype(basename($filename), null);
  460.                             $attachment = array(
  461.                                 'post_mime_type' => $wp_filetype['type'],
  462.                                 'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
  463.                                 'post_status' => 'inherit'
  464.                             );
  465.                             $attach_id = wp_insert_attachment($attachment, $filename, $real_post_id);
  466.                             // you must first include the image.php file
  467.                             // for the function wp_generate_attachment_metadata() to work
  468.                             require_once(ABSPATH . 'wp-admin/includes/image.php');
  469.                             $attach_data = wp_generate_attachment_metadata($attach_id, $filename);
  470.                             wp_update_attachment_metadata($attach_id, $attach_data);
  471.                         }
  472.                     }
  473.                 }
  474.             }
  475.    
  476.             if ($field['type'] == 'wysiwyg') {
  477.                 $new = wpautop($new);
  478.             }
  479.    
  480.             if ($field['type'] == 'textarea') {
  481.                 $new = htmlspecialchars($new);
  482.             }
  483.                
  484.             if($field['type'] == 'date') {
  485.                 $name_m = $field['id'].'_month';
  486.                 $name_d = $field['id'].'_day';
  487.                 $name_y = $field['id'].'_year';
  488.                 $old_m  = get_post_meta($real_post_id, $name_m, true);
  489.                 $old_d = get_post_meta($real_post_id, $name_d, true);
  490.                 $old_y = get_post_meta($real_post_id, $name_y, true);
  491.                 $new_m = $_POST[$name_m];
  492.                 $new_d =  $_POST[$name_d];
  493.                 $new_y = $_POST[$name_y];
  494.             }
  495.    
  496.             // validate meta value
  497.             if (isset($field['validate_func'])) {
  498.                 $ok = call_user_func(array('RW_Meta_Box_Validate', $field['validate_func']), $new);
  499.                 if ($ok === false) { // pass away when meta value is invalid
  500.                     continue;
  501.                 }
  502.             }
  503.             if($field['type'] == 'date') { 
  504.                 if ($new_m && $new_m != $old_m) {
  505.                     update_post_meta($real_post_id, $name_m, $new_m);
  506.                 }elseif ('' == $new_m && $old_m ) {
  507.                     delete_post_meta($real_post_id, $name_d, $old_m);
  508.                 }  
  509.                 if ($new_d && $new_d != $old_d) {
  510.                     update_post_meta($real_post_id, $name_d, $new_d);
  511.                 }elseif ('' == $new_d && $old_d ) {
  512.                     delete_post_meta($real_post_id, $name_d, $old_d);
  513.                 }  
  514.                 if ($new_y && $new_y != $old_y) {
  515.                     update_post_meta($real_post_id, $name_y, $new_y);
  516.                 }elseif ('' == $new_y && $old_y ) {
  517.                     delete_post_meta($real_post_id, $name_y, $old_y);
  518.                 }          
  519.                                        
  520.             } elseif ( $field['type'] == 'taxonomy-select' || $field['type'] == 'taxonomy-checkbox' ) {
  521.                 wp_set_object_terms( $real_post_id, $new, $name );
  522.             }  elseif ($new && $new != $old) {             
  523.                 update_post_meta($real_post_id, $name, $new);
  524.             } elseif ('' == $new && $old && $field['type'] != 'file' && $field['type'] != 'image') {
  525.                 delete_post_meta($real_post_id, $name, $old);
  526.             }
  527.         }
  528.     }
  529.  
  530.     /**
  531.      * Fixes the odd indexing of multiple file uploads from the format:
  532.      *
  533.      * $_FILES['field']['key']['index']
  534.      *
  535.      * To the more standard and appropriate:
  536.      *
  537.      * $_FILES['field']['index']['key']
  538.      *
  539.      * @param array $files
  540.      * @author Corey Ballou
  541.      * @link http://www.jqueryin.com
  542.      */
  543.     function fix_file_array(&$files) {
  544.         $names = array(
  545.             'name' => 1,
  546.             'type' => 1,
  547.             'tmp_name' => 1,
  548.             'error' => 1,
  549.             'size' => 1
  550.         );
  551.  
  552.         foreach ($files as $key => $part) {
  553.             // only deal with valid keys and multiple files
  554.             $key = (string) $key;
  555.             if (isset($names[$key]) && is_array($part)) {
  556.                 foreach ($part as $position => $value) {
  557.                     $files[$position][$key] = $value;
  558.                 }
  559.                 // remove old key reference
  560.                 unset($files[$key]);
  561.             }
  562.         }
  563.     }
  564. }
  565. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement