Changeset 7520 for trunk/wp-admin/includes/media.php
- Timestamp:
- 03/26/2008 06:37:19 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/media.php
r7510 r7520 425 425 426 426 return wp_iframe( 'media_upload_library_form', $errors ); 427 }428 429 function get_attachment_taxonomies($attachment) {430 if ( is_int( $attachment ) )431 $attachment = get_post($attachment);432 else if ( is_array($attachment) )433 $attachment = (object) $attachment;434 435 if ( ! is_object($attachment) )436 return array();437 438 $filename = basename($attachment->guid);439 440 $objects = array('attachment');441 442 if ( false !== strpos($filename, '.') )443 $objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1);444 if ( !empty($attachment->post_mime_type) ) {445 $objects[] = 'attachment:' . $attachment->post_mime_type;446 if ( false !== strpos($attachment->post_mime_type, '/') )447 foreach ( explode('/', $attachment->post_mime_type) as $token )448 if ( !empty($token) )449 $objects[] = "attachment:$token";450 }451 452 $taxonomies = array();453 foreach ( $objects as $object )454 if ( $taxes = get_object_taxonomies($object) )455 $taxonomies = array_merge($taxonomies, $taxes);456 457 return array_unique($taxonomies);458 427 } 459 428
Note: See TracChangeset
for help on using the changeset viewer.