Changeset 37035 for trunk/src/wp-admin/includes/media.php
- Timestamp:
- 03/18/2016 08:04:19 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r36879 r37035 112 112 * @param string $align Image CSS alignment property. 113 113 * @param string $url Optional. Image src URL. Default empty. 114 * @param string $rel Optional. Image rel attribute. Default empty.114 * @param bool|string $rel Optional. Value for rel attribute or whether to add a dafault value. Default false. 115 115 * @param string|array $size Optional. Image size. Accepts any valid image size, or an array of width 116 116 * and height values in pixels (in that order). Default 'medium'. … … 118 118 * @return string The HTML output to insert into the editor. 119 119 */ 120 function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $rel = '', $size = 'medium', $alt = '' ) { 121 122 $html = get_image_tag($id, $alt, '', $align, $size); 123 124 if ( ! $rel ) { 125 $rel = ' rel="attachment wp-att-' . esc_attr( $id ) . '"'; 120 function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $rel = false, $size = 'medium', $alt = '' ) { 121 122 $html = get_image_tag( $id, $alt, '', $align, $size ); 123 124 if ( $rel ) { 125 if ( is_string( $rel ) ) { 126 $rel = ' rel="' . esc_attr( $rel ) . '"'; 127 } else { 128 $rel = ' rel="attachment wp-att-' . intval( $id ) . '"'; 129 } 126 130 } else { 127 $rel = ' rel="' . esc_attr( $rel ) . '"';131 $rel = ''; 128 132 } 129 133 130 134 if ( $url ) 131 $html = '<a href="' . esc_attr( $url) . "\"$rel>$html</a>";135 $html = '<a href="' . esc_attr( $url ) . '"' . $rel . '>' . $html . '</a>'; 132 136 133 137 /** … … 1167 1171 $size = !empty($attachment['image-size']) ? $attachment['image-size'] : 'medium'; 1168 1172 $alt = !empty($attachment['image_alt']) ? $attachment['image_alt'] : ''; 1169 $rel = ( $url == get_attachment_link($attachment_id) );1173 $rel = ( strpos( $url, 'attachment_id') || $url === get_attachment_link( $attachment_id ) ); 1170 1174 1171 1175 return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt);
Note: See TracChangeset
for help on using the changeset viewer.