public static function get_video_playlist_dates_for_display($type) { $all_dates = BC_Utility::get_video_playlist_dates($type); foreach ($all_dates as $id => $dates_for_id) { $new_id = $id === 'all' ? 'all' : BC_Utility::get_sanitized_video_id($id); // Strip ID_ $labelled_dates = array(); foreach ($dates_for_id as $yyyy_mm) { $date_object = new DateTime($yyyy_mm . '-01'); $labelled_dates[] = array('code' => $yyyy_mm, 'value' => $date_object->format('F Y')); } unset($all_dates[$id]); // Has to proceed for $id === 'all' $all_dates[$new_id] = $labelled_dates; } return $all_dates; }
/** * Add in process videos to media query results. * Also clear in process videos if they are already returned by brightcove. * * @param array $videos List of videos. * * @return array Processed list of videos. */ public function add_in_process_videos($videos) { $video_ids = wp_list_pluck($videos, 'id'); $video_post_ids = $this->videos->get_in_progress_videos(); foreach ($video_post_ids as $video_post_id) { $in_process_video_id = BC_Utility::get_sanitized_video_id($video_post_id); if (in_array($in_process_video_id, $video_ids)) { wp_delete_post($video_post_id, true); } else { $videos[] = get_post_meta($video_post_id, '_brightcove_video_object', true); } } return $videos; }