From 9f3313b115de6717afc447cfc35cb05d8d3bd3eb Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 19 Jun 2008 17:03:23 +0000 Subject: [PATCH] Press This: Fixes for unicode/ascii/apostrophe problems. Upgrades to the Photo tab. Props noel. see #6813 git-svn-id: http://svn.automattic.com/wordpress/trunk@8128 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/press-this.css | 37 +++++++++- wp-admin/press-this.php | 133 +++++++++++++++++++++--------------- 2 files changed, 115 insertions(+), 55 deletions(-) diff --git a/wp-admin/css/press-this.css b/wp-admin/css/press-this.css index 31fbd66d33..64920abaed 100644 --- a/wp-admin/css/press-this.css +++ b/wp-admin/css/press-this.css @@ -449,6 +449,18 @@ margin-bottom: .25em; text-decoration: none; padding-bottom: 2px; } + +#photo_directions { +margin-top: .25em; +display: block; +position: relative; +} +#photo_directions span { +display: block; +position: absolute; +top: 0; +right: 3px; +} #photo_saving { margin-bottom: 8px; } @@ -457,4 +469,27 @@ margin-bottom: 8px; margin-left: 10px; margin-bottom: 1em; display: block; -} \ No newline at end of file +} + +#footer { + height: 65px; + display: block; + width: 640px; + padding: 10px 0 0 60px; + margin: 0; + position: absolute; + bottom: 0; + font-size: 12px; +} + +#footer p { + margin: 0; + padding: 7px 0; +} + +#footer p a { + text-decoration: none; +} + +#footer p a:hover { + text-decoration: underline; diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index a3d6360934..ce990ecec8 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -79,46 +79,64 @@ if ( 'post' == $_REQUEST['action'] ) {

| | Close Window

+ + + + ", wp_specialchars(js_escape($_GET['s'])))); + +$selection = str_replace("\n", "
", aposfix( stripslashes($_GET['s']) ) ); $url = clean_url($_GET['u']); $image = $_GET['i']; + if($_REQUEST['ajax'] == 'thickbox') { ?> -

- Click to insert.

+ Click to insert.

-

Insert Image | Cancel

+

Insert Image | Cancel

+

+
+ +
+ + +

+
+ +
+ +

Insert Image | Cancel

+

@@ -130,9 +148,9 @@ if($_REQUEST['ajax'] == 'video') { ?> if($_REQUEST['ajax'] == 'photo_images') { function get_images_from_uri($uri) { - if(preg_match('/\.(jpg|png|gif)/', $uri)) + if(preg_match('/\.(jpg|png|gif)/', $uri) && !strpos($uri,'blogger.com')) return "'".$uri."'"; - + $content = wp_remote_fopen($uri); if ( false === $content ) return ''; @@ -163,8 +181,32 @@ die; } if($_REQUEST['ajax'] == 'photo_js') { ?> - - var last = null + + tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox + + function image_selector() { + desc = jQuery('#this_photo_description').val(); + src = jQuery('#this_photo').val(); + pick(src, desc); + tb_remove(); + return false; + } + + jQuery(document).ready(function() { + jQuery('#this_photo').focus(); + + jQuery('.cancel').click(function() { + tb_remove(); + }); + + jQuery('.select').click(function() { + image_selector(); + }); + + jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500'); + + }); + function pick(img, desc) { if (img) { @@ -173,11 +215,12 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> jQuery('.photolist').append(''); jQuery('.photolist').append(''); append_editor('' + desc + ''); } + tinyMCE.activeEditor.resizeToContent(); return false; } + var last = null var my_src, img, img_tag, aspect, w, h, skip, i, strtoappend = ""; - var my_src = eval( jQuery.ajax({ type: "GET", @@ -189,13 +232,11 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> }).responseText); for (i = 0; i < my_src.length; i++) { - img = new Image(); - img.src = my_src[i]; - img_attr = 'id="img' + i; - skip = false; + img = new Image(); img.src = my_src[i]; img_attr = 'id="img' + i; skip = false; if (img.width && img.height) { - if (img.width * img.height < 2500) skip = true; + if (img.width * img.height < 2500) + skip = true; aspect = img.width / img.height; scale = (aspect > 1) ? (75 / img.width) : (75 / img.height); @@ -212,16 +253,15 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> if (!skip) strtoappend += ''; } - jQuery('#img_container').html(strtoappend); - tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox -
- + + + +
@@ -323,43 +363,30 @@ if($_REQUEST['ajax'] == 'photo') { ?> if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text); } function set_title(title) { jQuery("#content_type").text(title); } - function reset_height() { - tinyMCE.height = '170px'; - } + function show(tab_name) { jQuery('body').removeClass('video_split'); jQuery('#extra_fields').hide(); switch(tab_name) { case 'text' : - reset_height(); - jQuery('.editor-container').show(); - jQuery('#content_type').show(); set_menu('text'); - set_title(''); + set_title(''); return false; break; case 'quote' : - reset_height(); - jQuery('.editor-container').show(); - jQuery('#content_type').show(); set_menu('quote'); set_title(''); - set_editor("

"); - + set_editor("

"); return false; break; case 'video' : - reset_height(); - jQuery('.editor-container').show(); - jQuery('#content_type').show(); + set_menu('video'); set_title(''); jQuery('#extra_fields').show(); jQuery('body').addClass('video_split'); - - jQuery('#extra_fields').load('', { ajax: 'video', s: ''}, function() { $content = $selection; } ?> jQuery('#embed_code').prepend(''); - set_editor(""); + set_editor(""); }); - return false; break; case 'photo' : - reset_height(); set_menu('photo'); set_title('Post');