Video Library Options

Active Video

Active video for this page:
'; $output .= ''; foreach ($videos as $video) { if ($selected == $video['name']) { $output .= ''; } else { if ($video['kind'] == 'dir') { $output .= ''; foreach ($video['content'] as $subVideo) { $wholePath = $video['name'].'/'.$subVideo['name']; if ($selected == $wholePath) { $output .= ''; } else { $output .= ''; } } $output .= ''; } else { $output .= ''; } } } $output .= ''; return $output; } function recur_dir($dir) { $dirlist = opendir($dir); while ($file = readdir ($dirlist)) { if ($file != '.' && $file != '..') { $newpath = $dir.'/'.$file; $level = explode('/',$newpath); if (is_dir($newpath)) { $mod_array[] = array( 'level'=>count($level)-1, 'path'=>$newpath, 'name'=>end($level), 'kind'=>'dir', 'mod_time'=>filemtime($newpath), 'content'=>recur_dir($newpath)); }else{ $mod_array[] = array( 'level'=>count($level)-1, 'path'=>$newpath, 'name'=>end($level), 'kind'=>'file', 'mod_time'=>filemtime($newpath), 'size'=>filesize($newpath)); } } } closedir($dirlist); asort($mod_array); return $mod_array; } // Functions to store the custom field: add_action('edit_post', 'add_vl_field'); add_action('publish_post', 'add_vl_field'); add_action('save_post', 'add_vl_field'); add_action('edit_page_form', 'add_vl_field'); function add_vl_field($id) { //delete the existing field delete_post_meta($id, '_videolibrary_video_item'); //Get the value from your form $userEnteredValue = $_POST["_videolibrary_video_item"]; //Add your value as a custom field with the key 'myKey' //but only if the form data exists if (isset($userEnteredValue) && !empty ($userEnteredValue)){ add_post_meta($id, '_videolibrary_video_item', $userEnteredValue);} } // frontend functions function vl_video_link($id) { global $httpPath; $video = get_post_meta($id, '_videolibrary_video_item', true); return "Click"; } function vl_video_url($id) { global $httpPath; $video = get_post_meta($id, '_videolibrary_video_item', true); return "$httpPath/$video"; } ?>