From 180e0ce4dcbc15cf171565a8f44ef3d4614812e0 Mon Sep 17 00:00:00 2001 From: Zachary Howarth Date: Fri, 26 Nov 2010 16:49:00 -0400 Subject: [PATCH 1/2] Added some additional audio/video formats to MimeClass, including the non-standard but widely-used .m4a extension. Also removed some commented-out test cases. --- MimeClass.inc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MimeClass.inc b/MimeClass.inc index 55228740..652f3cc3 100644 --- a/MimeClass.inc +++ b/MimeClass.inc @@ -163,6 +163,9 @@ class MimeClass { "mpeg" => "video/mpeg", "mpe" => "video/mpeg", "mpg" => "video/mpeg", + "m4v" => "video/mp4", + "mp4" => "video/mp4", + "ogv" => "video/ogg", "qt" => "video/quicktime", "mov" => "video/quicktime", "mxu" => "video/vnd.mpegurl", @@ -170,12 +173,20 @@ class MimeClass { "movie" => "video/x-sgi-movie", "flv" => "video/x-flv", "swf" => "application/x-shockwave-flash", + // audio: + "mp3" => "audio/mpeg", + "mp4a" => "audio/mp4", + "m4a" => "audio/mp4", + "oga" => "audio/ogg", + "ogg" => "audio/ogg", + "flac" => "audio/x-flac", + "wav" => "audio/vnd.wave", // compressed formats: (note: http://svn.cleancode.org/svn/email/trunk/mime.types) "tgz" => "application/x-gzip", "gz" => "application/x-gzip", "tar" => "application/x-tar", "gtar" => "application/x-gtar", - "zip" => "application/x-zip", + "zip" => "application/x-zip", // others: 'bin' => 'application/octet-stream', ); @@ -323,14 +334,3 @@ class MimeClass { } -/* -$helper = new MimeClass(); -print "get_extension('application/x-gzip'): \n"; -echo print_r( $helper->get_extension('application/x-gzip', true), true ) . "\n"; -print "get_extension('text/plain'): \n"; -echo print_r( $helper->get_extension('text/plain', true), true ) . "\n"; -print "get_mimetype('fucker/asdf.tar.gz'): \n"; -echo print_r( $helper->get_mimetype('fucker/asdf.tar.gz', true), true ) . "\n"; -print "get_mimetype('blah.tsp'): \n"; -echo print_r( $helper->get_mimetype('blah.tsp', true), true ) . "\n"; -/* */ From 7941b435d552d43158803b2d0a76261875a66680 Mon Sep 17 00:00:00 2001 From: Zachary Howarth Date: Wed, 1 Dec 2010 16:27:11 -0400 Subject: [PATCH 2/2] Don't render PID field unless a pid is present, as it displays the default collection object. --- plugins/pidfield/pidfield.module | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/pidfield/pidfield.module b/plugins/pidfield/pidfield.module index 902d6690..53e176a2 100644 --- a/plugins/pidfield/pidfield.module +++ b/plugins/pidfield/pidfield.module @@ -276,11 +276,14 @@ function theme_pidfield_formatter_default($element) { //return $element['#item']['safe']; $pid = $element['#item']['safe']; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $item = new Fedora_Item($pid); + if(!empty($pid)) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $item = new Fedora_Item($pid); - return fedora_repository_get_items($pid); - //return $item->objectProfile->objLabel; + return fedora_repository_get_items($pid); + //return $item->objectProfile->objLabel; + } + return null; } /**