Make WordPress Core


Ignore:
Timestamp:
12/01/2009 09:22:48 AM (16 years ago)
Author:
azaozz
Message:

Remove oEmbed references and auto-insert of shortcodes from the UI, fixes #11288

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r12297 r12304  
    483483    if ( !empty($_POST['insertonlybutton']) ) {
    484484        $alt = $align = '';
    485         if ( !empty($_POST['insertonly']['embed-src']) ) {
    486             $src = $_POST['insertonly']['embed-src'];
    487             if ( !strpos($src, '://') )
    488                 $src = "http://$src";
    489             $html = '[embed]' . esc_url($src) . '[/embed]';
    490         } else {
    491             $src = $_POST['insertonly']['src'];
    492             if ( !empty($src) && !strpos($src, '://') )
    493                 $src = "http://$src";
    494             $alt = esc_attr($_POST['insertonly']['alt']);
    495             if ( isset($_POST['insertonly']['align']) ) {
    496                 $align = esc_attr($_POST['insertonly']['align']);
    497                 $class = " class='align$align'";
    498             }
    499             if ( !empty($src) )
    500                 $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
     485
     486        $src = $_POST['insertonly']['src'];
     487        if ( !empty($src) && !strpos($src, '://') )
     488            $src = "http://$src";
     489        $alt = esc_attr($_POST['insertonly']['alt']);
     490        if ( isset($_POST['insertonly']['align']) ) {
     491            $align = esc_attr($_POST['insertonly']['align']);
     492            $class = " class='align$align'";
    501493        }
     494        if ( !empty($src) )
     495            $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
    502496
    503497        $html = apply_filters('image_send_to_editor_url', $html, esc_url_raw($src), $alt, $align);
     
    597591            $href = "http://$href";
    598592
    599         $html = '[embed]' . esc_url($href) . '[/embed]';
    600         $html = apply_filters('audio_send_to_editor_url', $html, esc_url_raw($href));
     593        $title = esc_attr($_POST['insertonly']['title']);
     594        if ( empty($title) )
     595            $title = esc_attr( basename($href) );
     596
     597        if ( !empty($title) && !empty($href) )
     598            $html = "<a href='" . esc_url($href) . "' >$title</a>";
     599
     600        $html = apply_filters('audio_send_to_editor_url', $html, $href, $title);
     601
    601602        return media_send_to_editor($html);
    602603    }
     
    648649            $href = "http://$href";
    649650
    650         $html = '[embed]' . esc_url($href) . '[/embed]';
    651         $html = apply_filters('video_send_to_editor_url', $html, esc_url_raw($href));
     651        $title = esc_attr($_POST['insertonly']['title']);
     652        if ( empty($title) )
     653            $title = esc_attr( basename($href) );
     654
     655        if ( !empty($title) && !empty($href) )
     656            $html = "<a href='" . esc_url($href) . "' >$title</a>";
     657
     658        $html = apply_filters('video_send_to_editor_url', $html, $href, $title);
     659
    652660        return media_send_to_editor($html);
    653661    }
     
    15401548        var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';
    15411549
    1542         if ( '' != document.getElementById('embed-src').value )
    1543             return true;
    1544 
    15451550        if ( '' == f.src.value || '' == t.width )
    15461551            return false;
     
    19521957
    19531958    return '
    1954     <h4 class="media-sub-title">' . __('Embed a picture from a web site that supports oEmbed') . '</h4>
    1955     <table class="describe"><tbody>
    1956         <tr>
    1957             <th valign="top" scope="row" class="label" style="width:130px;">
    1958                 <span class="alignleft"><label for="embed-src">' . __('Embed image') . '</label></span>
    1959                 <span class="alignright"><abbr title="required" class="required">*</abbr></span>
    1960             </th>
    1961             <td class="field"><input id="embed-src" name="insertonly[embed-src]" value="" type="text" /></td>
    1962         </tr>
    1963 
    1964         <tr>
    1965             <td></td>
    1966             <td>
    1967                 <input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Embed') . '" />
    1968             </td>
    1969         </tr>
    1970     </tbody></table>
    1971 
    19721959    <h4 class="media-sub-title">' . __('Insert an image from another web site') . '</h4>
    19731960    <table class="describe"><tbody>
     
    20492036            <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
    20502037        </tr>
    2051 
     2038        <tr>
     2039            <th valign="top" scope="row" class="label">
     2040                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
     2041                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
     2042            </th>
     2043            <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
     2044        </tr>
     2045        <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Still Alive by Jonathan Coulton&#8221;') . '</td></tr>
    20522046        <tr>
    20532047            <td></td>
     
    20772071            <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
    20782072        </tr>
    2079 
     2073        <tr>
     2074            <th valign="top" scope="row" class="label">
     2075                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
     2076                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
     2077            </th>
     2078            <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
     2079        </tr>
     2080        <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Lucy on YouTube&#8220;') . '</td></tr>
    20802081        <tr>
    20812082            <td></td>
Note: See TracChangeset for help on using the changeset viewer.