Index: press-this.php
===================================================================
--- press-this.php	(revision 8302)
+++ press-this.php	(working copy)
@@ -1,13 +1,17 @@
 <?php
 require_once('admin.php');
 
-if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' )); ?>
+if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' ) );
 
-<?php 
-
 function preg_quote2($string) {
 	return str_replace('/', '\/', preg_quote($string));
 }
+function aposfix($text) {
+	$translation_table[chr(34)] = '&quot;';
+	$translation_table[chr(38)] = '&';
+	$translation_table[chr(39)] = '&apos;';
+	return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($text, $translation_table));	
+}
 function press_it() {
 	// define some basic variables
 	$quick['post_status'] = $_REQUEST['post_status'];
@@ -30,7 +34,7 @@
 			$content = $_REQUEST['content'];
 			
 			foreach($_REQUEST['photo_src'] as $key => $image) {
-				#quote for matching
+				// escape quote for matching
 				$quoted = preg_quote2($image);
 				
 				// see if files exist in content - we don't want to upload non-used selected files.
@@ -50,14 +54,14 @@
 			$content .= $_REQUEST['content'];
 			break;	
 		}
-	# set the post_content
+	// set the post_content
 	$quick['post_content'] = str_replace('<br />', "\n", preg_replace('/<\/?p>/','',$content));
 
-	#error handling for $post
+	// error handling for $post
 	if ( is_wp_error($post_ID)) {
 		wp_die($id);
 		wp_delete_post($post_ID);
-	#error handling for media_sideload
+	// error handling for media_sideload
 	} elseif ( is_wp_error($upload)) {
 		wp_die($upload);
 		wp_delete_post($post_ID);
@@ -68,10 +72,9 @@
 	return $post_ID;
 }
 
-# For submitted posts.
+// For submitted posts.
 if ( 'post' == $_REQUEST['action'] ) { 
 	check_admin_referer('press-this'); $post_ID = press_it(); ?>
-	
 	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 	<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
 	<head>
@@ -88,10 +91,8 @@
 		do_action('admin_head');
 	?>
 	</head>
-	<body class="press-this">
-		
-		<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div>
-		
+	<body class="press-this">	
+		<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div>	
 		<div id="footer">
 		<p><?php
 		do_action('in_admin_footer', '');
@@ -99,21 +100,12 @@
 		echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>');
 		?></p>
 		</div>
-		<?php do_action('admin_footer', ''); ?>
-		
+		<?php do_action('admin_footer', ''); ?>		
 	</body>
 	</html>
 	<?php die;
 }
 
-
-function aposfix($text) {
-	$translation_table[chr(34)] = '&quot;';
-	$translation_table[chr(38)] = '&';
-	$translation_table[chr(39)] = '&apos;';
-	return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($text, $translation_table));	
-}
-
 // Ajax Requests
 $title = wp_specialchars(aposfix(stripslashes($_GET['t'])));
 
@@ -178,7 +170,7 @@
 
 if($_REQUEST['ajax'] == 'photo_images') {
 	function get_images_from_uri($uri) {
-		if(preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com')) 
+		if( preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com') ) 
 			return "'".$uri."'";
 
 		$content = wp_remote_fopen($uri);
@@ -211,10 +203,7 @@
 }
 
 if($_REQUEST['ajax'] == 'photo_js') { ?>
-	
-	
  	// gather images and load some default JS
-	
 	var last = null
 	var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
 	var my_src = eval(
@@ -257,7 +246,7 @@
 			if(length == 0) length = 1;
 			jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
 			jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
-			append_editor('<img src="' + img +'" alt="' + desc + '" />');
+			append_editor("\n\n" + '<p><img src="' + img +'" alt="' + desc + '" /></p>');
 		}
 		tinyMCE.activeEditor.resizeToContent();
 		return false;
@@ -277,7 +266,8 @@
 		tb_init('a.thickbox, area.thickbox, input.thickbox');
 	});
 	
-<?php die; }
+<?php die;
+}
 
 if($_REQUEST['ajax'] == 'photo') { ?>
 		<div class="photolist"></div>
@@ -287,7 +277,8 @@
 		<div class="titlewrap">
 			<div id="img_container"></div>
 		</div>
-<?php die; }
+<?php die;
+}
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
@@ -377,7 +368,6 @@
 	}
 	
 	function set_editor(text) {
-
 		if(tinyMCE.activeEditor) tinyMCE.activeEditor.setContent('');
 		if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text);
 	}
@@ -399,7 +389,7 @@
 					set_editor("<?php echo $selection; ?>");
 				<?php } else { ?>
 					set_editor("<a href='<?php echo $url ?>'><?php echo $title; ?></a>");
-				<? } ?>
+				<?php } ?>
 				return false;
 				break;
 			case 'quote' :
@@ -411,25 +401,26 @@
 			case 'video' :
 				set_menu('video');
 				set_title('<?php _e('Caption') ?>');
-				
 				jQuery('#extra_fields').show();
 				jQuery('body').addClass('video_split');
 				jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
 					<?php 
 					if ( preg_match("/youtube\.com\/watch/i", $url) ) {
-					list($domain, $video_id) = split("v=", $url);
-					$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>'; ?>
+						list($domain, $video_id) = split("v=", $url);
+						$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>';
+						
+					} elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
+						list($domain, $video_id) = split(".com/", $url);
+						$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 . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />	<embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
 					
-					<?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
-					
-					list($domain, $video_id) = split(".com/", $url);
-					$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 . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />	<embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
-					
-					if ( trim($selection) == '' )
-						$selection = '<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>';
+						if ( trim($selection) == '' )
+							$selection = '<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>';
+										
 					} else {
 						$content = $selection;
-					} ?>
+					}
+					
+					?>
 					jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>');
 					
 					set_editor("<?php echo $title; ?>");
@@ -443,7 +434,7 @@
 					set_editor("<?php echo $selection; ?>");
 				<?php } else { ?>
 					set_editor("<a href='<?php echo $url ?>'><?php echo $title; ?></a>");
-				<? } ?>
+				<?php } ?>
 				jQuery('#extra_fields').show();
 				jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /><?php echo js_escape( __( 'Loading...' ) ); ?></h2>');
 				jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'/?ajax=photo&u='.attribute_escape($url); ?>');
@@ -468,7 +459,6 @@
 			tab_name = tab_name[0];
 			show(tab_name);
 		});
-		
 		// Set default tabs
 		<?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
 			show('video');
@@ -478,7 +468,7 @@
 			show('photo');
 		<?php } ?>
 	});
-	
+
 </script>
 </head>
 <body class="press-this">
@@ -537,4 +527,4 @@
 	</div>
 </form>
 </body>
-</html>
+</html>
\ No newline at end of file
Index: css/press-this.css
===================================================================
--- css/press-this.css	(revision 8302)
+++ css/press-this.css	(working copy)
@@ -88,36 +88,35 @@
 	cursor: pointer;
 }
 
+/* Header */
 #wphead {
 	border-top: none;
+	height: 2em;
+	padding-top: 8px;
 }
 
 .button {
-font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-padding: 3px 5px;
-font-size: 12px;
-line-height: 1.5em;
-border-width: 1px;
-border-style: solid;
--moz-border-radius: 3px;
--khtml-border-radius: 3px;
--webkit-border-radius: 3px;
-border-radius: 3px;
-cursor: pointer;
-margin-left: 5px;
-text-decoration: none;
+	font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+	padding: 3px 5px;
+	font-size: 12px;
+	line-height: 1.5em;
+	border-width: 1px;
+	border-style: solid;
+	-moz-border-radius: 3px;
+	-khtml-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	cursor: pointer;
+	margin-left: 5px;
+	text-decoration: none;
 }
 
 .howto {
-font-size: 11px;
+	font-size: 11px;
+	font-style: italic;
+	display: block;
 }
-#newtag { width: 60%; padding: 3px; }
 
-#wphead {
-	height: 2em;
-	padding-top: 8px;
-}
-
 #wphead #viewsite {
 	position: absolute;
 	margin-top: 12px;
@@ -132,8 +131,7 @@
 }
 
 #wphead #viewsite a {
-	font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana,
-		sans-serif;
+	font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
 	padding: 3px 4px;
 	display: block;
 	letter-spacing: normal;
@@ -173,18 +171,18 @@
 	color: #333333;
 }
 
-.titlewrap {
-	border-style: solid;
-	border-width: 1px;
-	padding: 2px 3px;
-	border-color: #CCCCCC;
-}
+/* Editor/Main Column */
 
 div#container {
 	margin: 0;
 	min-width: 500px;
 }
 
+div#container form {
+	margin: 0px;
+	padding: 0px;
+}
+
 div#posting {
 	padding-left: 16px;
 	position: absolute;
@@ -192,6 +190,17 @@
 	width: 66%;
 }
 
+#post_title {
+	width: 99%;
+}
+
+.titlewrap {
+	border-style: solid;
+	border-width: 1px;
+	padding: 2px 3px;
+	border-color: #CCCCCC;
+}
+
 div#posting h2 {
 	margin: .5em 0 .25em 0;
 	font-size: 12px;
@@ -199,11 +208,63 @@
 	background: ;
 }
 
-div#container form {
-	margin: 0px;
-	padding: 0px;
+.editor-container {
+	border-width: 1px;
+	border-color: #ccc;
+	border-style: solid;
+	margin-bottom: 1em;
 }
 
+/* Photo Styles */
+
+#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;
+}
+
+#img_container {
+	background-color: #fff;
+	overflow: auto;
+	height: 100px;
+}
+
+#img_container a {
+	display: block;
+	width: 79px;
+	height: 79px;
+	float: left;
+}
+
+#img_container img {
+	width: 75px;
+	height: 75px;
+	border: 0px;
+	padding: 2px;
+	background-color: #f4f4f4;
+	cursor: pointer;
+}
+#img_container a, #img_container a:link, #img_container a:visited {
+	border: 2px solid #ccc;
+	margin: 0 4px 4px 0;
+} 
+#img_container a:hover, #img_container a:active {
+	border: 2px solid #000;
+}
+
+/* Submit Column */
+
 div#categories {
 	font-size: 85%;
 	position: absolute;
@@ -216,13 +277,13 @@
 div#categories h2 {
 	color: #333;
 	font-size: 12px;
-	margin: .5em 0 0 1em;
+	margin: .5em 0 .5em 1em;
 	padding: 0;
 }
 
 #categories-all {
 	overflow: auto;
-	padding: 1em;
+	padding: 0 1em 1em 1em;
 	height: 15em;
 }
 
@@ -232,18 +293,17 @@
 	margin: 0;
 }
 
-.editor-container {
-	border-width: 1px;
-	border-color: #ccc;
-	border-style: solid;
-	margin-bottom: 1em;
-}
-
 #tagsdiv #newtag {
+	padding: 3px;
 	margin-right: 5px;
-	width: 16em;
+	width: 16em;	
 }
 
+#jaxtag {
+	clear: both;
+	padding-left: 1em;
+}
+
 #tagchecklist {
 	padding-left: 1em;
 	margin-bottom: 1em;
@@ -278,43 +338,6 @@
 	overflow: hidden;
 	position: absolute;
 }
-
-.howto {
-	font-style: italic;
-	display: block;
-}
-
-#post_title {
-	width: 99%;
-}
-
-#img_container {
-	background-color: #fff;
-	overflow: auto;
-	height: 100px;
-}
-
-#img_container a {
-	display: block;
-	width: 79px;
-	height: 79px;
-	float: left;
-}
-#img_container img {
-	width: 75px;
-	height: 75px;
-	border: 0px;
-	padding: 2px;
-	background-color: #f4f4f4;
-	cursor: pointer;
-}
-#img_container a, #img_container a:link, #img_container a:visited {
-	border: 2px solid #ccc;
-	margin: 0 4px 4px 0;
-} 
-#img_container a:hover, #img_container a:active {
-	border: 2px solid #000;
-}
 .submit {
 	-moz-border-radius-bottomleft: 3px;
 	-khtml-border-bottom-left-radius: 3px;
@@ -363,10 +386,7 @@
 	border-top-right-radius: 3px;
 }
 
-.hidden {
-	display: none;
-}
-
+/* Video Styles */
 .video_split #extra_fields {
 	width: 27%;
 	height: 300px;
@@ -383,11 +403,6 @@
 	float: right;
 }
 
-#jaxtag {
-	clear: both;
-	padding-left: 1em;
-}
-
 .ac_results {
 	padding: 0;
 	margin: 0;
@@ -413,25 +428,24 @@
 	text-decoration: underline;
 }
 
-
 .photolist {
-display: none;
+	display: none;
 }
 
 #extra_fields small {
-display: block;
-margin-top: .5em;
-padding-bottom: .25em;
+	display: block;
+	margin-top: .5em;
+	padding-bottom: .25em;
 }
 
 #TB_ajaxContent #options {
-position: absolute;
-top: 20px;
-right: 25px;
-padding: 5px;
+	position: absolute;
+	top: 20px;
+	right: 25px;
+	padding: 5px;
 }
 #TB_ajaxContent h3 {
-margin-bottom: .25em;
+	margin-bottom: .25em;
 }
 
 .updated {
@@ -461,27 +475,14 @@
 	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;
-}
-
 #post_status {
 	margin-left: 10px;
 	margin-bottom: 1em;
 	display: block;
 }
 
+/* Footer */
+
 #footer {
 	height: 65px;
 	display: block;
@@ -506,6 +507,12 @@
 	text-decoration: underline;
 }
 
+
+/* Utility Classes */
 .centered {
 	text-align: center;
 }
+
+.hidden {
+	display: none;
+}
\ No newline at end of file

