Changeset 4682
- Timestamp:
- 01/05/2007 08:54:55 PM (19 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
-
post-template.php (modified) (2 diffs)
-
post.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r4671 r4682 379 379 return false; 380 380 381 if ( !$src = get_attachment_icon_src( $ id, $fullsize ) )381 if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) 382 382 return false; 383 383 … … 416 416 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { 417 417 $id = (int) $id; 418 419 if ( $innerHTML = get_attachment_icon($id, $fullsize, $max_dims)) 418 if ( !$post = & get_post($id) ) 419 return false; 420 421 if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) 420 422 return $innerHTML; 421 423 422 $post = & get_post($id);423 424 424 425 $innerHTML = attribute_escape($post->post_title); -
trunk/wp-includes/post.php
r4675 r4682 1403 1403 function wp_get_attachment_metadata( $post_id, $unfiltered = false ) { 1404 1404 $post_id = (int) $post_id; 1405 1406 $data = get_post_meta( $post_id, '_wp_attachment_metadata', true ); 1405 if ( !$post =& get_post( $post_id ) ) 1406 return false; 1407 1408 $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true ); 1407 1409 if ( $unfiltered ) 1408 1410 return $data; 1409 return apply_filters( 'wp_get_attachment_metadata', $data, $post _id);1411 return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID ); 1410 1412 } 1411 1413 1412 1414 function wp_update_attachment_metadata( $post_id, $data ) { 1413 1415 $post_id = (int) $post_id; 1414 if ( ! get_post( $post_id ) )1415 return false; 1416 1417 $old_data = wp_get_attachment_metadata( $post _id, true );1418 1419 $data = apply_filters( 'wp_update_attachment_metadata', $data, $post _id);1416 if ( !$post =& get_post( $post_id ) ) 1417 return false; 1418 1419 $old_data = wp_get_attachment_metadata( $post->ID, true ); 1420 1421 $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); 1420 1422 1421 1423 if ( $old_data ) 1422 return update_post_meta( $post _id, '_wp_attachment_metadata', $data, $old_data );1424 return update_post_meta( $post->ID, '_wp_attachment_metadata', $data, $old_data ); 1423 1425 else 1424 return add_post_meta( $post _id, '_wp_attachment_metadata', $data );1426 return add_post_meta( $post->ID, '_wp_attachment_metadata', $data ); 1425 1427 } 1426 1428 … … 1430 1432 return false; 1431 1433 1432 $url = get_the_guid( $post _id);1434 $url = get_the_guid( $post->ID ); 1433 1435 1434 1436 if ( 'attachment' != $post->post_type || !$url ) 1435 1437 return false; 1436 1438 1437 return apply_filters( 'wp_get_attachment_url', $url, $post _id);1438 } 1439 1440 function wp_get_attachment_thumb_file( $post_id ) {1439 return apply_filters( 'wp_get_attachment_url', $url, $post->ID ); 1440 } 1441 1442 function wp_get_attachment_thumb_file( $post_id = 0 ) { 1441 1443 $post_id = (int) $post_id; 1442 if ( !$imagedata = wp_get_attachment_metadata( $post_id ) ) 1443 return false; 1444 1445 $file = get_attached_file( $post_id ); 1444 if ( !$post =& get_post( $post_id ) ) 1445 return false; 1446 if ( !$imagedata = wp_get_attachment_metadata( $post->ID ) ) 1447 return false; 1448 1449 $file = get_attached_file( $post->ID ); 1446 1450 1447 1451 if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) 1448 return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post _id);1452 return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID ); 1449 1453 return false; 1450 1454 } … … 1452 1456 function wp_get_attachment_thumb_url( $post_id = 0 ) { 1453 1457 $post_id = (int) $post_id; 1454 if ( !$url = wp_get_attachment_url( $post_id ) ) 1455 return false; 1456 1457 if ( !$thumb = wp_get_attachment_thumb_file( $post_id ) ) 1458 if ( !$post =& get_post( $post_id ) ) 1459 return false; 1460 if ( !$url = wp_get_attachment_url( $post->ID ) ) 1461 return false; 1462 1463 if ( !$thumb = wp_get_attachment_thumb_file( $post->ID ) ) 1458 1464 return false; 1459 1465 1460 1466 $url = str_replace(basename($url), basename($thumb), $url); 1461 1467 1462 return apply_filters( 'wp_get_attachment_thumb_url', $url, $post _id);1468 return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID ); 1463 1469 } 1464 1470
Note: See TracChangeset
for help on using the changeset viewer.