diff --git a/wp-admin/css/press-this.css b/wp-admin/css/press-this.css
index a9cb1c1066..8e712e7730 100644
--- a/wp-admin/css/press-this.css
+++ b/wp-admin/css/press-this.css
@@ -448,4 +448,7 @@ margin-bottom: .25em;
.updated a {
text-decoration: none;
padding-bottom: 2px;
+}
+#photo_saving {
+margin-bottom: 8px;
}
\ No newline at end of file
diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php
index 94a4088779..a7d159b969 100644
--- a/wp-admin/press-this.php
+++ b/wp-admin/press-this.php
@@ -76,7 +76,7 @@ function category_div() { ?>
-
+
}
if($_REQUEST['ajax'] == 'photo_images') {
-$url = urldecode($url);
-$url = str_replace(' ', '%20', $url);
-
+ error_log('photo images');
function get_images_from_uri($uri) {
- if(preg_match('/\.(jpg|png|gif)/', $uri)) return "'".$uri."'";
+ if(preg_match('/\.(jpg|png|gif)/', $uri))
+ return "'".$uri."'";
+
$content = wp_remote_fopen($uri);
$host = parse_url($uri);
+
if ( false === $content ) return '';
-
- $pattern = '/
]+src=[\'"]([^\'" >]+?)[\'" >]/is';
+
+ $pattern = '/
]*)src=(\"|\')(.+?)(\2)([^>\/]*)\/*>/is';
preg_match_all($pattern, $content, $matches);
- if ( empty($matches[1]) ) return '';
-
+ if ( empty($matches[1]) ) { error_log('empty'); return ''; };
$sources = array();
- foreach ($matches[1] as $src) {
- if ( false !== strpos($src, '&') ) continue;
+ 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);
@@ -178,12 +179,14 @@ $url = str_replace(' ', '%20', $url);
$src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src);
}
}
+
$sources[] = $src;
}
return "'" . implode("','", $sources) . "'";
}
-
+ $url = urldecode($url);
+ $url = str_replace(' ', '%20', $url);
echo 'new Array('.get_images_from_uri($url).')';
die;
}
@@ -366,7 +369,11 @@ if($_REQUEST['ajax'] == 'photo') { ?>
jQuery('#content_type').show();
set_menu('text');
set_title('');
- set_editor("");
+
+ set_editor(''.$selection.' '; ?>');
+
+ set_editor(''.$title.' '; ?>');
+
return false;
break;
case 'quote' :
@@ -375,7 +382,7 @@ if($_REQUEST['ajax'] == 'photo') { ?>
jQuery('#content_type').show();
set_menu('quote');
set_title('');
- set_editor("
'>
");
+ set_editor("
");
return false;
break;
@@ -421,11 +428,9 @@ if($_REQUEST['ajax'] == 'photo') { ?>
set_title('Post');
set_editor("");
-
- set_editor('')
jQuery('#extra_fields').show();
- jQuery('#extra_fields').prepend('
Loading...
');
+ jQuery('#extra_fields').before('
Loading...
');
jQuery('#extra_fields').load('');
jQuery.ajax({
type: "GET",
@@ -434,7 +439,7 @@ if($_REQUEST['ajax'] == 'photo') { ?>
data: "ajax=photo_js&u=",
dataType : "script",
success : function() {
- jQuery('#waiting').innerHTML('');
+ jQuery('#waiting').remove();
}
});
@@ -489,9 +494,7 @@ if($_REQUEST['ajax'] == 'photo') { ?>