From 859921a0f410e865adf93a6338121c6aa3502927 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 5 Aug 2008 17:13:58 +0000 Subject: [PATCH] Press This: Fix image insert in IE7, set textarea height. Props noael and zamoose. fixes #7387 #7310 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@8551 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/press-this.css | 2 ++ wp-admin/press-this.php | 31 ++++++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/wp-admin/css/press-this.css b/wp-admin/css/press-this.css index 70c7e64b1..daf60bafe 100644 --- a/wp-admin/css/press-this.css +++ b/wp-admin/css/press-this.css @@ -4,6 +4,8 @@ body { margin: 0px; padding: 0px; } + +img { border: 0; } /* Tabs */ @media projection , screen { .ui-tabs-hide { diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index ed9f598d7..ce60aa557 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -184,19 +184,21 @@ if($_REQUEST['ajax'] == 'photo_images') { $host = parse_url($uri); - $pattern = '/]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif)[^<>\'\"]*)(\2)([^>\/]*)\/*>/is'; + $pattern = '/]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif))[^<>\'\"]*(\2)([^>\/]*)\/*>/is'; preg_match_all($pattern, $content, $matches); - + if ( empty($matches[1]) ) return ''; $sources = array(); foreach ($matches[3] as $src) { + // if no http in url if(strpos($src, 'http') === false) - if(strpos($src, '../') === false && strpos($src, './') === false) + // if it doesn't have a relative uri + if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === true) $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); else - $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); - + $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src); + $sources[] = clean_url($src); } return "'" . implode("','", $sources) . "'"; @@ -247,12 +249,12 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> } function pick(img, desc) { - if (img) { - length = jQuery('.photolist input').length; + if (img) { + if('object' == typeof jQuery('.photolist input') && jQuery('.photolist input').length != 0) length = jQuery('.photolist input').length; if(length == 0) length = 1; jQuery('.photolist').append(''); jQuery('.photolist').append(''); - append_editor("\n\n" + '

' + desc + '

'); + append_editor("\n\n" + '

' + desc + '

'); } tinyMCE.activeEditor.resizeToContent(); return false; @@ -267,6 +269,7 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> } jQuery(document).ready(function() { + jQuery('#extra_fields').html('
+
'); jQuery('#img_container').html(strtoappend); jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500'); tb_init('a.thickbox, area.thickbox, input.thickbox'); @@ -276,13 +279,7 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> } if($_REQUEST['ajax'] == 'photo') { ?> -
- + - -
-
-
@@ -323,6 +320,7 @@ if($_REQUEST['ajax'] == 'photo') { ?> editor_selector: "mceEditor", language : "", width: "100%", + height: "300", theme : "advanced", theme_advanced_buttons1 : "bold,italic,underline,blockquote,separator,strikethrough,bullist,numlist,undo,redo,link,unlink", theme_advanced_buttons2 : "", @@ -446,7 +444,6 @@ if($_REQUEST['ajax'] == 'photo') { ?> jQuery('#extra_fields').show(); jQuery('#extra_fields').before('

'); - jQuery('#extra_fields').load(''); jQuery.ajax({ type: "GET", cache : false, @@ -473,7 +470,7 @@ if($_REQUEST['ajax'] == 'photo') { ?> show('video'); show('video'); - + show('photo'); }); @@ -506,7 +503,7 @@ if($_REQUEST['ajax'] == 'photo') { ?>

- +