Ticket #3520: 3520b.diff
| File 3520b.diff, 4.1 KB (added by , 20 years ago) |
|---|
-
wp-includes/post-template.php
378 378 if ( !$post = & get_post($id) ) 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 384 384 list($src, $src_file) = $src; … … 415 415 416 416 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { 417 417 $id = (int) $id; 418 if ( !$post = & get_post($id) ) 419 return false; 418 420 419 if ( $innerHTML = get_attachment_icon($ id, $fullsize, $max_dims))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); 425 426 -
wp-includes/post.php
1402 1402 1403 1403 function wp_get_attachment_metadata( $post_id, $unfiltered = false ) { 1404 1404 $post_id = (int) $post_id; 1405 if ( !$post =& get_post( $post_id ) ) 1406 return false; 1405 1407 1406 $data = get_post_meta( $post _id, '_wp_attachment_metadata', true );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 ) )1416 if ( !$post =& get_post( $post_id ) ) 1415 1417 return false; 1416 1418 1417 $old_data = wp_get_attachment_metadata( $post _id, true );1419 $old_data = wp_get_attachment_metadata( $post->ID, true ); 1418 1420 1419 $data = apply_filters( 'wp_update_attachment_metadata', $data, $post _id);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 1427 1429 function wp_get_attachment_url( $post_id = 0 ) { … … 1429 1431 if ( !$post =& get_post( $post_id ) ) 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);1439 return apply_filters( 'wp_get_attachment_url', $url, $post->ID ); 1438 1440 } 1439 1441 1440 function wp_get_attachment_thumb_file( $post_id ) {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 ) )1444 if ( !$post =& get_post( $post_id ) ) 1443 1445 return false; 1446 if ( !$imagedata = wp_get_attachment_metadata( $post->ID ) ) 1447 return false; 1444 1448 1445 $file = get_attached_file( $post _id);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 } 1451 1455 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 ) )1458 if ( !$post =& get_post( $post_id ) ) 1455 1459 return false; 1460 if ( !$url = wp_get_attachment_url( $post->ID ) ) 1461 return false; 1456 1462 1457 if ( !$thumb = wp_get_attachment_thumb_file( $post _id) )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 1465 1471 function wp_attachment_is_image( $post_id = 0 ) {
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)