videopress_merge_file_status

The WordPress Core videopress merge file status function.

Description

(array) videopress_merge_file_status( (array) $current_status, (array) $new_meta ); 

Returns (array)

Parameters (2)

0. $current_status (array)
The current status.
1. $new_meta (array)
The new meta.

Usage

  1. if ( !function_exists( 'videopress_merge_file_status' ) ) { 
  2. require_once '/modules/videopress/utility-functions.php'; 
  3.  
  4. // The current status. 
  5. $current_status = array(); 
  6.  
  7. // The new meta. 
  8. $new_meta = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = videopress_merge_file_status($current_status, $new_meta); 
  12.  

Defined (1)

The function is defined in the following location(s).

/modules/videopress/utility-functions.php  
  1. function videopress_merge_file_status( $current_status, $new_meta ) { 
  2. $new_statuses = array(); 
  3.  
  4. if ( isset( $new_meta['videopress']['files_status']['hd'] ) ) { 
  5. $new_statuses['hd'] = $new_meta['videopress']['files_status']['hd']; 
  6.  
  7. if ( isset( $new_meta['videopress']['files_status']['dvd'] ) ) { 
  8. $new_statuses['dvd'] = $new_meta['videopress']['files_status']['dvd']; 
  9.  
  10. if ( isset( $new_meta['videopress']['files_status']['std']['mp4'] ) ) { 
  11. $new_statuses['mp4'] = $new_meta['videopress']['files_status']['std']['mp4']; 
  12.  
  13. if ( isset( $new_meta['videopress']['files_status']['std']['ogg'] ) ) { 
  14. $new_statuses['ogg'] = $new_meta['videopress']['files_status']['std']['ogg']; 
  15.  
  16. foreach ( $new_statuses as $format => $status ) { 
  17. if ( ! isset( $current_status[ $format ] ) ) { 
  18. $current_status[ $format ] = $status; 
  19. continue; 
  20.  
  21. if ( $current_status[ $format ] !== 'DONE' ) { 
  22. $current_status[ $format ] = $status; 
  23.  
  24. return $current_status;