Changeset 4670 for trunk/wp-admin/upload-functions.php
- Timestamp:
- 01/02/2007 07:28:30 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/upload-functions.php
r4657 r4670 14 14 $class = 'text'; 15 15 $innerHTML = get_attachment_innerHTML( $id, false, $dims ); 16 if ( $image_src = strstr($innerHTML, 'src=') ) { 17 preg_match("/src=(\"|')(.+?)\\1/", $image_src, $matches); 18 $image_src = $matches[2]; 16 if ( $image_src = get_attachment_icon_src() ) { 19 17 $image_rel = wp_make_link_relative($image_src); 18 $innerHTML = ' ' . str_replace($image_src, $image_rel, $innerHTML); 20 19 $class = 'image'; 21 $innerHTML = ' ' . str_replace($image_src, $image_rel, $innerHTML);22 $image_base = str_replace($image_rel, '', $image_src);23 20 } 24 21 25 $src_base = get_the_guid();22 $src_base = wp_get_attachment_url(); 26 23 $src = wp_make_link_relative( $src_base ); 27 24 $src_base = str_replace($src, '', $src_base); … … 39 36 $r .= "\t\t\t\t<input type='hidden' name='attachment-url-base-$id' id='attachment-url-base-$id' value='$src_base' />\n"; 40 37 41 if ( isset($attachment_data['thumb']) ) { 42 $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-$id' id='attachment-thumb-url-$id' value='$image_rel' />\n"; 43 $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-base-$id' id='attachment-thumb-url-base-$id' value='$image_base' />\n"; 44 } elseif ( $image_rel ) 45 $r .= "\t\t\t\t<input type='hidden' name='attachment-is-image-$id' id='attachment-is-image-$id' value='1' />\n"; 38 if ( !$thumb_base = wp_get_attachment_thumb_url() ) 39 $thumb_base = wp_mime_type_icon(); 40 if ( $thumb_base ) { 41 $thumb_rel = wp_make_link_relative( $thumb_base ); 42 $thumb_base = str_replace( $thumb_rel, '', $thumb_base ); 43 $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-$id' id='attachment-thumb-url-$id' value='$thumb_rel' />\n"; 44 $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-base-$id' id='attachment-thumb-url-base-$id' value='$thumb_base' />\n"; 45 } 46 $is_image = (int) wp_attachment_is_image(); 47 $r .= "\t\t\t\t<input type='hidden' name='attachment-is-image-$id' id='attachment-is-image-$id' value='$is_image' />\n"; 46 48 if ( isset($width) ) { 47 49 $r .= "\t\t\t\t<input type='hidden' name='attachment-width-$id' id='attachment-width-$id' value='$width' />\n"; … … 63 65 <div id="file-title"> 64 66 <h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style ) 65 echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";67 echo "<a href='" . wp_get_attachment_url() . "' title='" . __('Direct link to file') . "'>"; 66 68 the_title(); 67 69 if ( !isset($attachment_data['width']) && 'inline' != $style ) … … 80 82 <div id="upload-file-view" class="alignleft"> 81 83 <?php if ( isset($attachment_data['width']) && 'inline' != $style ) 82 echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";84 echo "<a href='" . wp_get_attachment_url() . "' title='" . __('Direct link to file') . "'>"; 83 85 echo wp_upload_display( array(171, 128) ); 84 86 if ( isset($attachment_data['width']) && 'inline' != $style ) … … 103 105 <div id="file-title"> 104 106 <h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style ) 105 echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";107 echo "<a href='" . wp_get_attachment_url() . "' title='" . __('Direct link to file') . "'>"; 106 108 the_title(); 107 109 if ( !isset($attachment_data['width']) && 'inline' != $style ) … … 120 122 <div id="upload-file-view" class="alignleft"> 121 123 <?php if ( isset($attachment_data['width']) && 'inline' != $style ) 122 echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";124 echo "<a href='" . wp_get_attachment_url() . "' title='" . __('Direct link to file') . "'>"; 123 125 echo wp_upload_display( array(171, 128) ); 124 126 if ( isset($attachment_data['width']) && 'inline' != $style ) … … 130 132 <tr> 131 133 <th scope="row"><label for="url"><?php _e('URL'); ?></label></th> 132 <td><input type="text" id="url" class="readonly" value="<?php the_guid(); ?>" readonly="readonly" /></td>134 <td><input type="text" id="url" class="readonly" value="<?php echo wp_get_attachment_url(); ?>" readonly="readonly" /></td> 133 135 </tr> 134 136 <?php else : ?> … … 344 346 } 345 347 } 346
Note: See TracChangeset
for help on using the changeset viewer.