Changeset 8113
- Timestamp:
- 06/17/2008 07:36:29 PM (18 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 1 added
- 2 edited
-
css/press-this.css (modified) (2 diffs)
-
images/loading-publish.gif (added)
-
press-this.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/press-this.css
r8093 r8113 112 112 font-size: 11px; 113 113 } 114 #newtag { padding: 3px; }114 #newtag { width: 60%; padding: 3px; } 115 115 116 116 #wphead { … … 453 453 margin-bottom: 8px; 454 454 } 455 456 #post_status { 457 margin-left: 10px; 458 margin-bottom: 1em; 459 display: block; 460 } -
trunk/wp-admin/press-this.php
r8093 r8113 7 7 function press_it() { 8 8 #define some basic variables 9 $quick['post_status'] = 'publish';9 $quick['post_status'] = $_REQUEST['post_status']; 10 10 $quick['post_category'] = $_REQUEST['post_category']; 11 11 $quick['tags_input'] = $_REQUEST['tags_input']; … … 43 43 } 44 44 # set the post_content 45 $quick['post_content'] = $content;45 $quick['post_content'] = str_replace('<br />', "\n", preg_replace('/<\/?p>/','',$content)); 46 46 47 47 #error handling for $post … … 57 57 return $post_ID; 58 58 } 59 60 61 function category_div() { ?>62 <div id="categories">63 <div class="submitbox" id="submitpost">64 <div id="previewview"></div>65 <div class="inside">66 <h2><?php _e('Categories') ?></h2>67 <div id="categories-all">68 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">69 <?php wp_category_checklist() ?>70 </ul>71 </div>72 <h2><?php _e('Tags') ?></h2>73 <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>74 <div id="tagchecklist"></div>75 76 </div>77 <p class="submit">78 <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>79 <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/>80 </p>81 </div>82 <?php }83 59 84 60 # For submitted posts. … … 111 87 // Ajax Requests 112 88 $title = wp_specialchars(stripslashes($_GET['t'])); 113 $selection = trim( wp_specialchars(str_replace("\n", ' ',stripslashes($_GET['s']))));114 $url = $_GET['u'];89 $selection = trim(str_replace('\\n', "<br />", wp_specialchars(js_escape($_GET['s'])))); 90 $url = clean_url($_GET['u']); 115 91 $image = $_GET['i']; 116 92 if($_REQUEST['ajax'] == 'thickbox') { ?> … … 131 107 image_selector(); 132 108 }); 133 134 109 </script> 135 110 <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3> … … 155 130 156 131 if($_REQUEST['ajax'] == 'photo_images') { 157 error_log('photo images');158 132 function get_images_from_uri($uri) { 159 133 if(preg_match('/\.(jpg|png|gif)/', $uri)) 160 134 return "'".$uri."'"; 161 135 162 136 $content = wp_remote_fopen($uri); 137 if ( false === $content ) return ''; 138 163 139 $host = parse_url($uri); 164 165 if ( false === $content ) return '';166 140 167 141 $pattern = '/<img ([^>]*)src=(\"|\')(.+?)(\2)([^>\/]*)\/*>/is'; 168 142 preg_match_all($pattern, $content, $matches); 169 if ( empty($matches[1]) ) { error_log('empty'); return ''; }; 143 144 if ( empty($matches[1]) ) return ''; 145 170 146 $sources = array(); 171 172 147 foreach ($matches[3] as $src) { 173 error_log($src); 174 #if ( false !== strpos($src, '&') ) continue; 175 if(strpos($src, 'http') === false) { 176 if(strpos($src, '../') === false && strpos($src, './') === false) { 177 $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); 178 } else { 179 $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); 180 } 181 } 182 183 $sources[] = $src; 148 if(strpos($src, 'http') === false) 149 if(strpos($src, '../') === false && strpos($src, './') === false) 150 $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); 151 else 152 $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); 153 154 $sources[] = $src; 184 155 } 185 156 return "'" . implode("','", $sources) . "'"; … … 227 198 if (img.width * img.height < 2500) skip = true; 228 199 aspect = img.width / img.height; 229 if (aspect > 1) { // Image is wide 230 scale = 75 / img.width; 231 } else { // Image is tall or square 232 scale = 75 / img.height; 233 } 200 scale = (aspect > 1) ? (75 / img.width) : (75 / img.height); 201 234 202 if (scale < 1) { 235 203 w = parseInt(img.width * scale); … … 253 221 254 222 if($_REQUEST['ajax'] == 'photo') { ?> 255 256 223 <div class="photolist"></div> 257 258 224 <small><?php _e('Click images to select:') ?></small> 259 225 <div class="titlewrap"> … … 261 227 </div> 262 228 <?php die; } 263 264 229 ?> 265 230 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> … … 318 283 tab_focus : ":next", 319 284 plugins : "safari,inlinepopups", 320 entities : "38,amp,60,lt,62,gt" 285 entities : "38,amp,60,lt,62,gt", 286 force_p_newlines : true 321 287 }); 322 288 <?php } ?> … … 350 316 } 351 317 function set_editor(text) { 318 352 319 if(tinyMCE.activeEditor) tinyMCE.activeEditor.setContent(''); 353 320 if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text); … … 370 337 set_menu('text'); 371 338 set_title('<?php _e('Text') ?>'); 372 <?php if($selection) { ?> 373 set_editor('<?php echo '<p><a href="'.$url.'">'.$selection.'</a> </p> '; ?>'); 374 <?php } else { ?> 375 set_editor('<?php echo '<p><a href="'.$url.'">'.$title.'</a> </p> '; ?>'); 376 <?php } ?> 339 377 340 return false; 378 341 break; … … 500 463 501 464 </div> 502 <?php category_div(); ?> 465 <div id="categories"> 466 <div class="submitbox" id="submitpost"> 467 <div id="previewview"></div> 468 <div class="inside"> 469 <h2><?php _e('Categories') ?></h2> 470 <div id="categories-all"> 471 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 472 <?php wp_category_checklist() ?> 473 </ul> 474 </div> 475 <h2><?php _e('Tags') ?></h2> 476 <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p> 477 <div id="tagchecklist"></div> 478 </div> 479 <label for="post_status" id="post_status"><input type="radio" name="post_status" value="publish" checked="checked" id="published" />Published <input type="radio" name="post_status" value="draft" id="unpubplished" /> Unpublished</label> 480 481 <p class="submit"> 482 <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/> 483 <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/> 484 </p> 485 </div> 486 487 503 488 </form> 504 489
Note: See TracChangeset
for help on using the changeset viewer.