WordPress.org

Make WordPress Core

Ticket #32074: 32074.diff

File 32074.diff, 1.7 KB (added by wonderboymusic, 6 years ago)
  • src/wp-admin/includes/media.php

     
    106106 *
    107107 * @since 2.5.0
    108108 *
    109  * @param integer $id image attachment id
    110  * @param string $caption image caption
    111  * @param string $alt image alt attribute
    112  * @param string $title image title attribute
    113  * @param string $align image css alignment property
    114  * @param string $url image src url
    115  * @param string|bool $rel image rel attribute
    116  * @param string $size image size (thumbnail, medium, large, full or added  with add_image_size() )
     109 * @param int     $id      image attachment id
     110 * @param string  $caption image caption
     111 * @param string  $title   image title attribute
     112 * @param string  $align   image css alignment property
     113 * @param string  $url     image src url
     114 * @param string  $rel     image rel attribute
     115 * @param string  $size    image size (thumbnail, medium, large, full or added  with add_image_size() )
    117116 * @return string the html to insert into editor
    118117 */
    119 function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') {
     118function get_image_send_to_editor( $id, $caption, $title, $align, $url='', $rel = '', $size='medium', $alt = '' ) {
    120119
    121120        $html = get_image_tag($id, $alt, '', $align, $size);
    122121
    123         $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : '';
     122        if ( ! $rel ) {
     123                $rel = ' rel="attachment wp-att-' . esc_attr( $id ) . '"';
     124        } else {
     125                $rel = ' rel="' . esc_attr( $rel ) . '"';
     126        }
    124127
    125128        if ( $url )
    126129                $html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";