Ticket #7732: press-this_urlfixes.patch
| File press-this_urlfixes.patch, 2.4 KB (added by , 18 years ago) |
|---|
-
press-this.php
61 61 62 62 // insert the post with nothing in it, to get an ID 63 63 $post_ID = wp_insert_post($quick, true); 64 64 65 65 $content = $_REQUEST['content']; 66 66 67 67 if($_REQUEST['photo_src']) … … 81 81 // error handling for $post 82 82 if ( is_wp_error($post_ID)) { 83 83 wp_die($id); 84 wp_delete_post($post_ID); error_log('2');84 wp_delete_post($post_ID); 85 85 // error handling for media_sideload 86 86 } elseif ( is_wp_error($upload)) { 87 87 wp_die($upload); … … 97 97 if ( 'post' == $_REQUEST['action'] ) { 98 98 check_admin_referer('press-this'); 99 99 $post_ID = press_it(); 100 error_log($post_ID);101 100 $posted = $post_ID; 102 //wp_redirect('press-this.php?posted=' . press_it());103 101 } 104 102 105 103 // Set Variables … … 125 123 </script> 126 124 <h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2> 127 125 <div class="titlewrap" > 128 <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo $selection; ?></textarea> 129 126 <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo format_to_edit($selection, true); ?></textarea> 130 127 </div> 131 128 <p id="options"><a href="#" class="select button"><?php _e('Insert Video'); ?></a> <a href="#" class="close button"><?php _e('Cancel'); ?></a></p> 132 129 <?php break; … … 192 189 193 190 $sources = array(); 194 191 foreach ($matches[3] as $src) { 195 error_log($src);196 192 // if no http in url 197 193 if(strpos($src, 'http') === false) 198 194 // if it doesn't have a relative uri 199 if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === true)195 if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0) 200 196 $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); 201 197 else 202 198 $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src); 203 204 199 $sources[] = clean_url($src); 205 error_log($src);206 200 } 207 201 return "'" . implode("','", $sources) . "'"; 208 202 } … … 260 254 jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>'); 261 255 insert_editor("\n\n" + '<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>'); 262 256 } 263 /*tinyMCE.activeEditor.resizeToContent();*/264 257 return false; 265 258 } 266 259
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)