| 1 | Index: wp-admin/press-this.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/press-this.php (revision 22004) |
|---|
| 4 | +++ wp-admin/press-this.php (working copy) |
|---|
| 5 | @@ -109,28 +109,6 @@ |
|---|
| 6 | |
|---|
| 7 | if ( !empty($_REQUEST['ajax']) ) { |
|---|
| 8 | switch ($_REQUEST['ajax']) { |
|---|
| 9 | - case 'video': ?> |
|---|
| 10 | - <script type="text/javascript"> |
|---|
| 11 | - /* <![CDATA[ */ |
|---|
| 12 | - jQuery('.select').click(function() { |
|---|
| 13 | - append_editor(jQuery('#embed-code').val()); |
|---|
| 14 | - jQuery('#extra-fields').hide(); |
|---|
| 15 | - jQuery('#extra-fields').html(''); |
|---|
| 16 | - }); |
|---|
| 17 | - jQuery('.close').click(function() { |
|---|
| 18 | - jQuery('#extra-fields').hide(); |
|---|
| 19 | - jQuery('#extra-fields').html(''); |
|---|
| 20 | - }); |
|---|
| 21 | - /* ]]> */ |
|---|
| 22 | - </script> |
|---|
| 23 | - <div class="postbox"> |
|---|
| 24 | - <h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2> |
|---|
| 25 | - <div class="inside"> |
|---|
| 26 | - <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo esc_textarea( $selection ); ?></textarea> |
|---|
| 27 | - <p id="options"><a href="#" class="select button"><?php _e('Insert Video'); ?></a> <a href="#" class="close button"><?php _e('Cancel'); ?></a></p> |
|---|
| 28 | - </div> |
|---|
| 29 | - </div> |
|---|
| 30 | - <?php break; |
|---|
| 31 | |
|---|
| 32 | case 'photo_thickbox': ?> |
|---|
| 33 | <script type="text/javascript"> |
|---|
| 34 | @@ -343,88 +321,53 @@ |
|---|
| 35 | } |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | - function show(tab_name) { |
|---|
| 39 | + function show() { |
|---|
| 40 | jQuery('#extra-fields').html(''); |
|---|
| 41 | - switch(tab_name) { |
|---|
| 42 | - case 'video' : |
|---|
| 43 | - jQuery('#extra-fields').load('<?php echo esc_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo esc_attr($selection); ?>'}, function() { |
|---|
| 44 | - <?php |
|---|
| 45 | - $content = ''; |
|---|
| 46 | - if ( preg_match("/youtube\.com\/watch/i", $url) ) { |
|---|
| 47 | - list($domain, $video_id) = explode("v=", $url); |
|---|
| 48 | - $video_id = esc_attr($video_id); |
|---|
| 49 | - $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'; |
|---|
| 50 | + function setup_photo_actions() { |
|---|
| 51 | + jQuery('.close').click(function() { |
|---|
| 52 | + jQuery('#extra-fields').hide(); |
|---|
| 53 | + jQuery('#extra-fields').html(''); |
|---|
| 54 | + }); |
|---|
| 55 | + jQuery('.refresh').click(function() { |
|---|
| 56 | + photostorage = false; |
|---|
| 57 | + show(); |
|---|
| 58 | + }); |
|---|
| 59 | + jQuery('#photo-add-url').click(function(){ |
|---|
| 60 | + var form = jQuery('#photo-add-url-div').clone(); |
|---|
| 61 | + jQuery('#img_container').empty().append( form.show() ); |
|---|
| 62 | + }); |
|---|
| 63 | + jQuery('#waiting').hide(); |
|---|
| 64 | + jQuery('#extra-fields').show(); |
|---|
| 65 | + } |
|---|
| 66 | |
|---|
| 67 | - } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { |
|---|
| 68 | - list($domain, $video_id) = explode(".com/", $url); |
|---|
| 69 | - $video_id = esc_attr($video_id); |
|---|
| 70 | - $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /> <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>'; |
|---|
| 71 | - |
|---|
| 72 | - if ( trim($selection) == '' ) |
|---|
| 73 | - $selection = '<p><a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a></p>'; |
|---|
| 74 | - |
|---|
| 75 | - } elseif ( strpos( $selection, '<object' ) !== false ) { |
|---|
| 76 | - $content = $selection; |
|---|
| 77 | - } |
|---|
| 78 | - ?> |
|---|
| 79 | - jQuery('#embed-code').prepend('<?php echo htmlentities($content); ?>'); |
|---|
| 80 | - }); |
|---|
| 81 | - jQuery('#extra-fields').show(); |
|---|
| 82 | - return false; |
|---|
| 83 | - break; |
|---|
| 84 | - case 'photo' : |
|---|
| 85 | - function setup_photo_actions() { |
|---|
| 86 | - jQuery('.close').click(function() { |
|---|
| 87 | - jQuery('#extra-fields').hide(); |
|---|
| 88 | - jQuery('#extra-fields').html(''); |
|---|
| 89 | - }); |
|---|
| 90 | - jQuery('.refresh').click(function() { |
|---|
| 91 | - photostorage = false; |
|---|
| 92 | - show('photo'); |
|---|
| 93 | - }); |
|---|
| 94 | - jQuery('#photo-add-url').click(function(){ |
|---|
| 95 | - var form = jQuery('#photo-add-url-div').clone(); |
|---|
| 96 | - jQuery('#img_container').empty().append( form.show() ); |
|---|
| 97 | - }); |
|---|
| 98 | - jQuery('#waiting').hide(); |
|---|
| 99 | - jQuery('#extra-fields').show(); |
|---|
| 100 | - } |
|---|
| 101 | - |
|---|
| 102 | - jQuery('#waiting').show(); |
|---|
| 103 | - if(photostorage == false) { |
|---|
| 104 | - jQuery.ajax({ |
|---|
| 105 | - type: "GET", |
|---|
| 106 | - cache : false, |
|---|
| 107 | - url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>", |
|---|
| 108 | - data: "ajax=photo_js&u=<?php echo urlencode($url)?>", |
|---|
| 109 | - dataType : "script", |
|---|
| 110 | - success : function(data) { |
|---|
| 111 | - eval(data); |
|---|
| 112 | - photostorage = jQuery('#extra-fields').html(); |
|---|
| 113 | - setup_photo_actions(); |
|---|
| 114 | - } |
|---|
| 115 | - }); |
|---|
| 116 | - } else { |
|---|
| 117 | - jQuery('#extra-fields').html(photostorage); |
|---|
| 118 | + jQuery('#waiting').show(); |
|---|
| 119 | + if(photostorage == false) { |
|---|
| 120 | + jQuery.ajax({ |
|---|
| 121 | + type: "GET", |
|---|
| 122 | + cache : false, |
|---|
| 123 | + url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>", |
|---|
| 124 | + data: "ajax=photo_js&u=<?php echo urlencode($url)?>", |
|---|
| 125 | + dataType : "script", |
|---|
| 126 | + success : function(data) { |
|---|
| 127 | + eval(data); |
|---|
| 128 | + photostorage = jQuery('#extra-fields').html(); |
|---|
| 129 | setup_photo_actions(); |
|---|
| 130 | } |
|---|
| 131 | - return false; |
|---|
| 132 | - break; |
|---|
| 133 | + }); |
|---|
| 134 | + } else { |
|---|
| 135 | + jQuery('#extra-fields').html(photostorage); |
|---|
| 136 | + setup_photo_actions(); |
|---|
| 137 | } |
|---|
| 138 | + return false; |
|---|
| 139 | } |
|---|
| 140 | jQuery(document).ready(function($) { |
|---|
| 141 | //resize screen |
|---|
| 142 | window.resizeTo(720,580); |
|---|
| 143 | // set button actions |
|---|
| 144 | - jQuery('#photo_button').click(function() { show('photo'); return false; }); |
|---|
| 145 | - jQuery('#video_button').click(function() { show('video'); return false; }); |
|---|
| 146 | + jQuery('#photo_button').click(function() { show(); return false; }); |
|---|
| 147 | // auto select |
|---|
| 148 | - <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?> |
|---|
| 149 | - show('video'); |
|---|
| 150 | - <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?> |
|---|
| 151 | - show('video'); |
|---|
| 152 | - <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?> |
|---|
| 153 | - show('photo'); |
|---|
| 154 | + <?php if ( preg_match("/flickr\.com/i", $url) ) { ?> |
|---|
| 155 | + show(); |
|---|
| 156 | <?php } ?> |
|---|
| 157 | jQuery('#title').unbind(); |
|---|
| 158 | jQuery('#publish, #save').click(function() { jQuery('#saving').css('display', 'inline'); }); |
|---|
| 159 | @@ -622,9 +565,6 @@ |
|---|
| 160 | <img alt="<?php esc_attr_e('Insert an Image'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-image.gif?ver=20100531' ) ); ?>"/></a> |
|---|
| 161 | <?php |
|---|
| 162 | } |
|---|
| 163 | - ?> |
|---|
| 164 | - <a id="video_button" title="<?php esc_attr_e('Embed a Video'); ?>" href="#"><img alt="<?php esc_attr_e('Embed a Video'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-video.gif?ver=20100531' ) ); ?>"/></a> |
|---|
| 165 | - <?php |
|---|
| 166 | } |
|---|
| 167 | |
|---|
| 168 | wp_editor( $content, 'content', $editor_settings ); |
|---|