diff --git a/wp-admin/css/press-this.css b/wp-admin/css/press-this.css index 6b6763c3dd..70c7e64b13 100644 --- a/wp-admin/css/press-this.css +++ b/wp-admin/css/press-this.css @@ -231,7 +231,8 @@ div#posting h2 { } #photo_saving { - margin-bottom: 8px; + margin: 0 8px 8px; + vertical-align: middle; } #img_container { @@ -302,6 +303,7 @@ div#categories h2 { #jaxtag { clear: both; padding-left: 1em; + margin: 0; } #tagchecklist { @@ -348,7 +350,7 @@ div#categories h2 { -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; margin: 0; - padding: 0; + padding: 10px; } .submitbox { width: 100%; @@ -363,10 +365,9 @@ div#categories h2 { .submitbox .submit input { border: none; text-align: left; - padding: 12px 10px 10px 10px; + padding: 6px 4px; font-size: 12px; - margin: 10px; - + margin: 2px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index 5f6904ead4..921ae4454a 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -10,52 +10,54 @@ function aposfix($text) { $translation_table[chr(34)] = '"'; $translation_table[chr(38)] = '&'; $translation_table[chr(39)] = '''; - return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($text, $translation_table)); + return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($text, $translation_table)); } function press_it() { // define some basic variables - $quick['post_status'] = $_REQUEST['post_status']; + $quick['post_status'] = isset($_REQUEST['publish']) ? 'publish' : 'draft'; $quick['post_category'] = $_REQUEST['post_category']; $quick['tags_input'] = $_REQUEST['tags_input']; $quick['post_title'] = $_REQUEST['post_title']; $quick['post_content'] = ''; - + + $posted = str_replace('
', "\n", str_replace('

', '', $_REQUEST['content'])); + $posted = str_replace('

', "\n\n", $posted); + // insert the post with nothing in it, to get an ID $post_ID = wp_insert_post($quick, true); - + $content = ''; switch ( $_REQUEST['post_type'] ) { case 'text': case 'quote': - $content .= $_REQUEST['content']; + $content .= $posted; break; - + case 'photo': - $content = $_REQUEST['content']; - - foreach($_REQUEST['photo_src'] as $key => $image) { + $content = $posted; + + foreach( (array) $_REQUEST['photo_src'] as $key => $image) { // escape quote for matching $quoted = preg_quote2($image); - + // see if files exist in content - we don't want to upload non-used selected files. - preg_match('/'.$quoted.'/', $_REQUEST['content'], $matches[0]); - if($matches[0]) { + if( strpos($posted, $quoted) !== false ) { $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]); // Replace the POSTED content with correct uploaded ones. if( !is_wp_error($upload) ) $content = preg_replace('/]*)src=(\"|\')'.$quoted.'(\2)([^>\/]*)\/*>/is', $upload, $content); } } - + break; - + case "video": if($_REQUEST['embed_code']) $content .= $_REQUEST['embed_code']."\n\n"; - $content .= $_REQUEST['content']; - break; + $content .= $posted; + break; } // set the post_content - $quick['post_content'] = str_replace('
', "\n", preg_replace('/<\/?p>/','',$content)); + $quick['post_content'] = preg_replace("/\n\n+/", "\n\n", $content); // error handling for $post if ( is_wp_error($post_ID)) { @@ -65,7 +67,7 @@ function press_it() { } elseif ( is_wp_error($upload)) { wp_die($upload); wp_delete_post($post_ID); - } else { + } else { $quick['ID'] = $post_ID; wp_update_post($quick); } @@ -80,6 +82,9 @@ if ( 'post' == $_REQUEST['action'] ) { <?php _e('Press This') ?> + - -

| |

+ +

| |

- + ", aposfix( stripslashes($_GET['s']) ) ); +$selection = trim( aposfix( stripslashes($_GET['s']) ) ); +if ( ! empty($selection) ) { + $selection = preg_replace('/(\r?\n|\r)/', '

', $selection); + $selection = '

'.str_replace('

', '', $selection).'

'; +} + $url = clean_url($_GET['u']); $image = $_GET['i']; @@ -118,7 +128,7 @@ if($_REQUEST['ajax'] == 'thickbox') { ?> jQuery('.cancel').click(function() { tb_remove(); }); - + jQuery('.select').click(function() { image_selector(); }); @@ -127,10 +137,10 @@ if($_REQUEST['ajax'] == 'thickbox') { ?>
- +

<?php echo attribute_escape(__('Click to insert.')); ?>

- +

jQuery('.cancel').click(function() { tb_remove(); }); - + jQuery('.select').click(function() { image_selector(); }); @@ -149,13 +159,13 @@ if($_REQUEST['ajax'] == 'thickbox_url') { ?>
- - + +

- +

|

]*)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(strpos($src, 'http') === false) @@ -190,16 +200,16 @@ if($_REQUEST['ajax'] == 'photo_images') { $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); else $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); - + $sources[] = clean_url($src); } return "'" . implode("','", $sources) . "'"; } - + $url = urldecode($url); $url = str_replace(' ', '%20', $url); echo 'new Array('.get_images_from_uri($url).')'; -die; +die; } if($_REQUEST['ajax'] == 'photo_js') { ?> @@ -216,7 +226,7 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> dataType : "script" }).responseText ); - + for (i = 0; i < my_src.length; i++) { img = new Image(); img.src = my_src[i]; @@ -227,10 +237,10 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> skip = true; aspect = img.width / img.height; scale = (aspect > 1) ? (75 / img.width) : (75 / img.height); - + w = img.width; h = img.height; - + if (scale < 1) { w = parseInt(img.width * scale); h = parseInt(img.height * scale); @@ -239,7 +249,7 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> } if (!skip) strtoappend += ''; } - + function pick(img, desc) { if (img) { length = jQuery('.photolist input').length; @@ -251,7 +261,7 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> tinyMCE.activeEditor.resizeToContent(); return false; } - + function image_selector() { tb_remove(); desc = jQuery('#this_photo_description').val(); @@ -259,13 +269,13 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> pick(src, desc); return false; } - + jQuery(document).ready(function() { 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'); }); - + <?php _e('Press This') ?> + sl.markDone(base + '/themes/advanced/langs/' + ln + '.js'); sl.markDone(base + '/themes/advanced/langs/' + ln + '_dlg.js'); })(); - + tinyMCE.init({ mode: "textareas", editor_selector: "mceEditor", @@ -330,7 +343,7 @@ if($_REQUEST['ajax'] == 'photo') { ?> remove_script_host : false, convert_urls : false, apply_source_formatting : false, - remove_linebreaks : false, + remove_linebreaks : true, accessibility_focus : false, tab_focus : ":next", plugins : "safari,inlinepopups", @@ -345,7 +358,7 @@ if($_REQUEST['ajax'] == 'photo') { ?> // add the quickadd form jQuery('#jaxtag').prepend(''+postL10n.separate+''); - + jQuery('#tagadd').click( tag_flush_to_text ); jQuery('#newtag').focus(function() { if ( this.value == postL10n.addTag ) @@ -359,23 +372,23 @@ if($_REQUEST['ajax'] == 'photo') { ?> // auto-save tags on post save/publish jQuery('#publish').click( tag_save_on_publish ); jQuery('#save-post').click( tag_save_on_publish ); - + function set_menu(type) { jQuery('#text_button').removeClass('ui-tabs-selected'); jQuery('#menu li').removeClass('ui-tabs-selected'); jQuery('#' + type + '_button').addClass('ui-tabs-selected'); jQuery("#post_type").val(type); } - + function set_editor(text) { - if(tinyMCE.activeEditor) tinyMCE.activeEditor.setContent(''); - if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text); + if ( '' == text || '

' == text ) text = '


'; + if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text); } - + function append_editor(text) { - if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text); + if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceInsertContent', false, text); } - + function set_title(title) { jQuery("#content_type").text(title); } function show(tab_name) { @@ -386,16 +399,16 @@ if($_REQUEST['ajax'] == 'photo') { ?> set_menu('text'); set_title(''); - set_editor(""); + set_editor('

'); - set_editor(""); + set_editor('

'); return false; break; case 'quote' : set_menu('quote'); set_title(''); - set_editor("

"); + set_editor('

'); return false; break; case 'video' : @@ -405,25 +418,25 @@ if($_REQUEST['ajax'] == 'photo') { ?> jQuery('body').addClass('video_split'); jQuery('#extra_fields').load('', { ajax: 'video', s: ''}, function() { '; - + } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { list($domain, $video_id) = split(".com/", $url); $content = ' '; - + if ( trim($selection) == '' ) - $selection = '' . $title . ' on Vimeo'; - - } else { + $selection = '

' . $title . ' on Vimeo

'; + + } elseif ( strpos( $selection, ' jQuery('#embed_code').prepend(''); - - set_editor(""); + + set_editor(' ‏'); }); return false; break; @@ -431,9 +444,9 @@ if($_REQUEST['ajax'] == 'photo') { ?> set_menu('photo'); set_title(''); - set_editor(""); + set_editor('

'); - set_editor(""); + set_editor('

'); jQuery('#extra_fields').show(); jQuery('#extra_fields').before('

'); @@ -452,7 +465,7 @@ if($_REQUEST['ajax'] == 'photo') { ?> break; } } - + jQuery(document).ready(function() { jQuery('#menu li').click(function (){ tab_name = this.id.split('_'); @@ -491,39 +504,39 @@ if($_REQUEST['ajax'] == 'photo') { ?>
- + - +

- +
-
-
-

-
-
    - -
+
+
+

+
+
    + +
+
+ +

+

+
-

-

-
+ +

+ + + +

-
- - -
-

- - -

diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index eea7507c83..b9455eb6ae 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -229,7 +229,7 @@ function wp_default_styles( &$styles ) { $styles->add( 'dashboard', '/wp-admin/css/dashboard.css' ); $styles->add( 'install', '/wp-admin/css/install.css', array(), '20080708' ); $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css' ); - $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20080704' ); + $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20080710' ); $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20080613' ); $styles->add( 'login', '/wp-admin/css/login.css' );