Ticket #6813: press-this-6-23-1am.diff
| File press-this-6-23-1am.diff, 2.5 KB (added by noel, 5 years ago) |
|---|
-
press-this.php
30 30 # see if files exist in content - we don't want to upload non-used selected files. 31 31 preg_match('/'.$quoted.'/', $_REQUEST['content'], $matches[0]); 32 32 if($matches[0]) 33 media_sideload_image($data, $post_ID, $_REQUEST['photo_description'][$key]);33 $upload = media_sideload_image($data, $post_ID, $_REQUEST['photo_description'][$key]); 34 34 } 35 35 $content = $_REQUEST['content']; 36 36 break; … … 45 45 $quick['post_content'] = str_replace('<br />', "\n", preg_replace('/<\/?p>/','',$content)); 46 46 47 47 #error handling for $post 48 if ( is_wp_error($post_ID) ) {48 if ( is_wp_error($post_ID)) { 49 49 wp_die($id); 50 50 wp_delete_post($post_ID); 51 52 51 #error handling for media_sideload 52 } elseif ( is_wp_error($upload)) { 53 wp_die($upload); 54 wp_delete_post($post_ID); 53 55 } else { 54 56 $quick['ID'] = $post_ID; 55 57 wp_update_post($quick); … … 78 80 ?> 79 81 </head> 80 82 <body class="press-this"> 83 81 84 <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&post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();">Close Window</a></p></div> 82 85 83 86 <div id="footer"> … … 182 185 183 186 if($_REQUEST['ajax'] == 'photo_js') { ?> 184 187 185 tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox188 //tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox 186 189 187 190 function image_selector() { 188 191 desc = jQuery('#this_photo_description').val(); … … 228 231 cache : false, 229 232 async : false, 230 233 data: "ajax=photo_images&u=<?php echo urlencode($url); ?>", 231 dataType : "script" 234 dataType : "script", 232 235 }).responseText); 233 236 234 237 for (i = 0; i < my_src.length; i++) { … … 251 254 } 252 255 253 256 if (!skip) strtoappend += '<a href="?ajax=thickbox&i=' + img.src + '&u=<?php echo $url; ?>&height=400&width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; 254 255 257 } 256 258 jQuery('#img_container').html(strtoappend); 259 tb_init('a.thickbox, area.thickbox, input.thickbox'); 257 260 258 261 <?php die; } 259 262
