Make WordPress Core

Changeset 8996


Ignore:
Timestamp:
09/27/2008 06:21:12 AM (16 years ago)
Author:
ryan
Message:

Media fixes for Press This. Props noel. see #7732

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/press-this.php

    r8959 r8996  
    118118        <script type="text/javascript" charset="utf-8">
    119119            jQuery('.select').click(function() {
    120                 append_editor(jQuery('#embed-code').html());
     120                append_editor(jQuery('#embed-code').val());
    121121            });
    122122            jQuery('.close').click(function() {
     
    126126        <h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2>
    127127        <div class="titlewrap" >
    128             <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo format_to_edit($selection); ?></textarea>
     128            <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo $selection; ?></textarea>
    129129
    130130        </div>
     
    178178    case 'photo_images':
    179179        function get_images_from_uri($uri) {
    180             if( preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com') )
     180            if( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') )
    181181                return "'".$uri."'";
    182182
    183183            $content = wp_remote_fopen($uri);
    184184            if ( false === $content ) return '';
    185 
     185       
    186186            $host = parse_url($uri);
    187187
     
    193193            $sources = array();
    194194            foreach ($matches[3] as $src) {
     195                error_log($src);
    195196                // if no http in url
    196197                if(strpos($src, 'http') === false)
     
    258259                jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
    259260                jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
    260                 append_editor("\n\n" + '<p style="text-align: center;"><a href="<?php echo urlencode($url); ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>');
     261                insert_editor("\n\n" + '<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>');
    261262            }
    262             tinyMCE.activeEditor.resizeToContent();
     263            /*tinyMCE.activeEditor.resizeToContent();*/
    263264            return false;
    264265        }
     
    343344                accessibility_focus : false,
    344345                tab_focus : ":next",
    345                 plugins : "safari,inlinepopups, media",
     346                plugins : "safari, inlinepopups, media",
    346347                entities : "38,amp,60,lt,62,gt",
    347348                force_p_newlines : true,
     
    373374        if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text);
    374375    }
    375 
     376    function insert_editor(text) {
     377        if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceInsertContent', false, '<p>' + tinymce.DOM.decode(text) + '</p>');
     378    }
    376379    function append_editor(text) {
    377         if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'})
    378          + '<p>' + tinymce.DOM.decode(text) + '</p>');
     380        if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '<p>' + text + '</p>');
    379381        tinyMCE.execCommand('mceCleanup');
    380382    }
     
    533535           
    534536                <div class="editor-container">
    535                     <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15"><?php if ($selection) { echo wp_richedit_pre($selection); } ?><a href="<?php echo $url ?>"><?php echo $title; ?></a><?php if($selection) echo '.'; ?></textarea>
     537                    <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15"><?php if ($selection) { echo wp_richedit_pre($selection); } ?><p>via <a href="<?php echo $url ?>"><?php echo $title; ?></a></p><?php if($selection) echo '.'; ?></textarea>
    536538                </div>
    537539            </div>
Note: See TracChangeset for help on using the changeset viewer.