diff --git a/wp-admin/css/press-this.css b/wp-admin/css/press-this.css index 8e712e7730..31fbd66d33 100644 --- a/wp-admin/css/press-this.css +++ b/wp-admin/css/press-this.css @@ -111,7 +111,7 @@ text-decoration: none; .howto { font-size: 11px; } -#newtag { padding: 3px; } +#newtag { width: 60%; padding: 3px; } #wphead { height: 2em; @@ -451,4 +451,10 @@ margin-bottom: .25em; } #photo_saving { margin-bottom: 8px; +} + +#post_status { +margin-left: 10px; +margin-bottom: 1em; +display: block; } \ No newline at end of file diff --git a/wp-admin/images/loading-publish.gif b/wp-admin/images/loading-publish.gif new file mode 100644 index 0000000000..fc1baf5551 Binary files /dev/null and b/wp-admin/images/loading-publish.gif differ diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index a7d159b969..a3d6360934 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -6,7 +6,7 @@ if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin’ uh?' )); ', "\n", preg_replace('/<\/?p>/','',$content)); #error handling for $post if ( is_wp_error($post_ID) ) { @@ -57,30 +57,6 @@ function press_it() { return $post_ID; } - -function category_div() { ?> -
-
-
-
-

-
-
    - -
-
-

-

-
- -
-

- - -

-
- @@ -110,8 +86,8 @@ if ( 'post' == $_REQUEST['action'] ) { // Ajax Requests $title = wp_specialchars(stripslashes($_GET['t'])); -$selection = trim(wp_specialchars(str_replace("\n", ' ',stripslashes($_GET['s'])))); -$url = $_GET['u']; +$selection = trim(str_replace('\\n', "
", wp_specialchars(js_escape($_GET['s'])))); +$url = clean_url($_GET['u']); $image = $_GET['i']; if($_REQUEST['ajax'] == 'thickbox') { ?>

@@ -154,33 +129,29 @@ if($_REQUEST['ajax'] == 'video') { ?> } if($_REQUEST['ajax'] == 'photo_images') { - error_log('photo images'); function get_images_from_uri($uri) { if(preg_match('/\.(jpg|png|gif)/', $uri)) return "'".$uri."'"; - + $content = wp_remote_fopen($uri); - $host = parse_url($uri); - if ( false === $content ) return ''; + $host = parse_url($uri); + $pattern = '/]*)src=(\"|\')(.+?)(\2)([^>\/]*)\/*>/is'; preg_match_all($pattern, $content, $matches); - if ( empty($matches[1]) ) { error_log('empty'); return ''; }; + + if ( empty($matches[1]) ) return ''; + $sources = array(); - foreach ($matches[3] as $src) { - error_log($src); - #if ( false !== strpos($src, '&') ) continue; - if(strpos($src, 'http') === false) { - if(strpos($src, '../') === false && strpos($src, './') === false) { - $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); - } else { - $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); - } - } - - $sources[] = $src; + if(strpos($src, 'http') === false) + if(strpos($src, '../') === false && strpos($src, './') === false) + $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); + else + $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); + + $sources[] = $src; } return "'" . implode("','", $sources) . "'"; } @@ -226,11 +197,8 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> if (img.width && img.height) { if (img.width * img.height < 2500) skip = true; aspect = img.width / img.height; - if (aspect > 1) { // Image is wide - scale = 75 / img.width; - } else { // Image is tall or square - scale = 75 / img.height; - } + scale = (aspect > 1) ? (75 / img.width) : (75 / img.height); + if (scale < 1) { w = parseInt(img.width * scale); h = parseInt(img.height * scale); @@ -252,15 +220,12 @@ if($_REQUEST['ajax'] == 'photo_js') { ?> -
-
> @@ -317,7 +282,8 @@ if($_REQUEST['ajax'] == 'photo') { ?> accessibility_focus : false, tab_focus : ":next", plugins : "safari,inlinepopups", - entities : "38,amp,60,lt,62,gt" + entities : "38,amp,60,lt,62,gt", + force_p_newlines : true }); @@ -349,6 +315,7 @@ if($_REQUEST['ajax'] == 'photo') { ?> jQuery("#post_type").val(type); } function set_editor(text) { + if(tinyMCE.activeEditor) tinyMCE.activeEditor.setContent(''); if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text); } @@ -369,11 +336,7 @@ if($_REQUEST['ajax'] == 'photo') { ?> jQuery('#content_type').show(); set_menu('text'); set_title(''); - - set_editor(''.$selection.'

'; ?>'); - - set_editor(''.$title.'

'; ?>'); - + return false; break; case 'quote' : @@ -499,7 +462,29 @@ if($_REQUEST['ajax'] == 'photo') { ?>
- +
+
+
+
+

+
+
    + +
+
+

+

+
+
+ + +

+ + +

+
+ +