Ticket #7026: press-this-may-27-11pm.diff
| File press-this-may-27-11pm.diff, 23.4 KB (added by noel, 5 years ago) |
|---|
-
press-this.php
19 19 20 20 $content = ''; 21 21 switch ( $_REQUEST['post_type'] ) { 22 case ' regular':22 case 'text': 23 23 $content = $_REQUEST['content']; 24 if ($_REQUEST['content2'])25 $content .= $_REQUEST['content2'];26 break;27 24 28 25 case 'quote': 29 $content = '<blockquote>' . $_REQUEST['content']; 30 if ($_REQUEST['content2']) { 31 $content .= '</blockquote> 32 '; 33 $content = $content . $_REQUEST['content2']; 34 } 26 $content = $_REQUEST['content']; 35 27 break; 36 28 37 29 case 'photo': 30 31 //http_post_data 32 38 33 if ($_REQUEST['photo_link']) 39 $content = '<a href="' . $_REQUEST['photo_link'] . '" target="_new">';34 $content = '<a href="' . $_REQUEST['photo_link'] . '">'; 40 35 41 36 $content .= '<img src="' . $_REQUEST['photo_src'] . '" alt=""/>'; 42 37 … … 49 44 50 45 break; 51 46 case "video": 52 list($garbage,$video_id) = split("v=", $_REQUEST['content']); 53 $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'; 54 if ($_REQUEST['content2']) 55 $content .= "\n" . $_REQUEST['content2']; 56 break; 47 $content = $_REQUEST['content']; 48 49 break; 57 50 } 58 51 59 52 $quick['post_content'] = $content; … … 108 101 109 102 $host = parse_url($_GET['u']); 110 103 111 if (strpos($src, 'http://') === false) {104 if (strpos($src, 'http://') === false) 112 105 $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); 113 }114 106 115 107 $sources[] = $src; 116 108 } 117 109 return "'" . implode("','", $sources) . "'"; 118 110 } 119 111 120 function press_this_js_init() { ?> 121 <?php if ( user_can_richedit() ) { 112 // Clean up the data being passed in 113 $title = wp_specialchars(stripslashes($_GET['t'])); 114 $selection = trim(wp_specialchars(str_replace("\n", ' ',stripslashes($_GET['s'])))); 115 $url = clean_url($_GET['u']); 116 ?> 117 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 118 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>> 119 <head> 120 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> 121 <title><?php _e('Press This') ?></title> 122 123 <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script> 124 <?php 125 wp_enqueue_script('jquery-ui-tabs'); 126 add_thickbox(); 127 wp_enqueue_style('press-this'); 128 wp_enqueue_style( 'colors' ); 129 wp_enqueue_script('post'); 130 131 do_action('admin_print_styles'); 132 do_action('admin_print_scripts'); 133 do_action('admin_head'); 134 ?> 135 <script type="text/javascript"> 136 <?php if ( user_can_richedit() ) { 122 137 $language = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); 123 138 // Add TinyMCE languages 124 139 @include_once( dirname(__FILE__).'/../wp-includes/js/tinymce/langs/wp-langs.php' ); … … 179 194 // auto-save tags on post save/publish 180 195 jQuery('#publish').click( tag_save_on_publish ); 181 196 jQuery('#save-post').click( tag_save_on_publish ); 182 <?php 183 } 197 198 function set_menu(type) { 199 jQuery('#text_button').removeClass('ui-tabs-selected'); 200 jQuery('#menu li').removeClass('ui-tabs-selected'); 201 jQuery('#' + type + '_button').addClass('ui-tabs-selected'); 202 jQuery("#post_type").val(type); 203 } 204 function set_editor(text) { 205 tinyMCE.activeEditor.setContent(''); 206 tinyMCE.execCommand('mceInsertContent' ,false, text); 207 } 208 function set_title(title) { jQuery("#content_type").text(title); } 209 210 var last = null; 211 function pick(img) { 212 if (last) last.style.backgroundColor = '#f4f4f4'; 213 if (img) { 214 document.getElementById('photo_src').value = img.src; 215 img.style.backgroundColor = '#44f'; 216 } 217 last = img; 218 219 /*noel's code to select more than one image.... 220 jQuery('.photolist').append('<h2><?php _e("Photo URL") ?></h2>' + 221 '<div class="titlewrap">' + 222 '<a href="#" class="remove">remove <input name="photo_src" id="photo_src[]" value ="'+ img.src +'" class="text" onkeydown="pick(0);"/></a>' + 223 '</div>');*/ 224 225 return false; 226 } 184 227 185 // Clean up the data being passed in 186 $title = wp_specialchars(stripslashes($_GET['t'])); 187 $selection = wp_specialchars(stripslashes($_GET['s'])); 188 $url = clean_url($_GET['u']); 228 jQuery(document).ready(function() { 229 230 231 <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?> 232 233 <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?> 234 235 <?php } else { ?> 189 236 190 if ( empty($_GET['tab']) ) { 191 ?> 192 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 193 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>> 194 <head> 195 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> 196 <title><?php _e('Press This') ?></title> 237 <?php } ?> 238 239 240 jQuery("#text_button").click(function () { 241 jQuery('.editor-container').show(); 242 jQuery('#content_type').show(); 243 jQuery('#photo_fields').hide(); 244 set_menu('text'); 245 set_title('<?php _e('Text') ?>'); 246 set_editor('<?php echo $selection; ?>'); 247 return false; 248 }); 249 250 jQuery("#quote_button").click(function () { 251 jQuery('.editor-container').show(); 252 jQuery('#content_type').show(); 253 jQuery('#photo_fields').hide(); 254 set_menu('quote'); 255 set_title('<?php _e('Quote') ?>'); 256 set_editor('<blockquote><p><?php echo $selection; ?> </p><p><cite><a href="<?php echo $url; ?>"><?php echo $title; ?></a></cite> </p></blockquote>'); 257 258 return false; 259 }); 260 197 261 198 <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script> 199 <?php 200 wp_enqueue_script('jquery-ui-tabs'); 201 add_thickbox(); 202 wp_enqueue_style('press-this'); 203 wp_enqueue_style( 'colors' ); 204 wp_enqueue_script('post'); 262 jQuery("#video_button").click(function () { 263 jQuery('.editor-container').show(); 264 jQuery('#content_type').show(); 265 jQuery('#photo_fields').hide(); 266 set_menu('video'); 267 set_title('<?php _e('Video') ?>'); 268 set_editor('<a href="<?php echo $url; ?>"><?php echo $title; ?></a>'); 269 <?php /* 270 <!--list($garbage,$video_id) = split("v=", $_REQUEST['content']); 271 $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';--> 272 */?> 273 return false; 274 }); 275 205 276 206 do_action('admin_print_styles'); 207 do_action('admin_print_scripts'); 208 do_action('admin_head'); 209 ?> 210 <script type="text/javascript"> 277 jQuery("#photo_button").click(function () { 278 set_menu('photo'); 279 set_title('Caption'); 280 set_editor('<a href="<?php echo $url; ?>"><?php echo $title; ?></a>'); 281 jQuery('#photo_fields').show(); 282 jQuery('.remove').click(function() { 283 jQuery(this).remove; 211 284 212 jQuery(document).ready(function() { 213 <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?> 214 jQuery('#container > ul').tabs({ selected: 3 }); 215 <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?> 216 jQuery('#container > ul').tabs({ selected: 1 }); 217 <?php } else { ?> 218 jQuery('#container > ul').tabs(); 219 <?php } ?> 220 }); 285 }); 286 287 288 var img, img_tag, aspect, w, h, skip, i, strtoappend = ""; 289 var my_src = [<?php echo get_images_from_uri($url); ?>]; 221 290 291 for (i = 0; i < my_src.length; i++) { 292 img = new Image(); 293 img.src = my_src[i]; 294 img_attr = 'id="img' + i + '" onclick="pick(this);"'; 295 skip = false; 296 297 if (img.width && img.height) { 298 if (img.width * img.height < 2500) skip = true; 299 aspect = img.width / img.height; 300 if (aspect > 1) { // Image is wide 301 scale = 75 / img.width; 302 } else { // Image is tall or square 303 scale = 75 / img.height; 304 } 305 if (scale < 1) { 306 w = parseInt(img.width * scale); 307 h = parseInt(img.height * scale); 308 } else { 309 w = img.width; 310 h = img.height; 311 } 312 img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; 313 } 314 315 if (!skip) strtoappend += '<a href="' + img.src + '" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; 316 317 } 318 319 jQuery('#img_container').html(strtoappend); 320 321 tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox 322 323 }); 324 }); 222 325 </script> 223 326 224 327 … … 227 330 <div id="wphead"> 228 331 <h1><span id="viewsite"><a href="<?php echo get_option('home'); ?>/"><?php _e('Visit:') ?> <?php bloginfo('name'); ?></a></span></h1> 229 332 </div> 230 <div id="container"> 231 <ul >232 <li ><a href="<?php echo clean_url(add_query_arg('tab', 'text', stripslashes($_SERVER['REQUEST_URI']))) ?>"><?php _e('Text') ?></a></li>233 <li ><a href="<?php echo clean_url(add_query_arg('tab', 'photo', stripslashes($_SERVER['REQUEST_URI']))) ?>"><?php _e('Photo') ?></a></li>234 <li ><a href="<?php echo clean_url(add_query_arg('tab', 'quote', stripslashes($_SERVER['REQUEST_URI']))) ?>"><?php _e('Quote') ?></a></li>235 <li ><a href="<?php echo clean_url(add_query_arg('tab', 'video', stripslashes($_SERVER['REQUEST_URI']))) ?>"><?php _e('Video') ?></a></li>333 334 <ul id="menu" class="ui-tabs-nav"> 335 <li id="text_button" class="ui-tabs-selected"><a href="#"><?php _e('Text') ?></a></li> 336 <li id="photo_button"><a href="#"><?php _e('Photo') ?></a></li> 337 <li id="quote_button"><a href="#"><?php _e('Quote') ?></a></li> 338 <li id="video_button"><a href="#"><?php _e('Video') ?></a></li> 236 339 </ul> 237 238 </div>239 </body>240 </html>241 <?php exit; } elseif ( 'photo' == $_GET['tab'] ) { ?>242 <script type="text/javascript">243 <?php press_this_js_init(); ?>244 var last = null;245 function pick(img) {246 if (last) last.style.backgroundColor = '#f4f4f4';247 if (img) {248 document.getElementById('photo_src').value = img.src;249 img.style.backgroundColor = '#44f';250 }251 last = img;252 253 /*jQuery('.photolist').append('<h2><?php _e("Photo URL") ?></h2>' +254 '<div class="titlewrap">' +255 '<a href="#" class="remove">remove <input name="photo_src" id="photo_src[]" value ="'+ img.src +'" class="text" onkeydown="pick(0);"/></a>' +256 '</div>');*/257 return false;258 }259 340 260 jQuery('.remove').click(function() { 261 jQuery(this).remove; 262 263 }); 264 jQuery(document).ready(function() { 265 var img, img_tag, aspect, w, h, skip, i, strtoappend = ""; 266 var my_src = [<?php echo get_images_from_uri($url); ?>]; 267 268 for (i = 0; i < my_src.length; i++) { 269 img = new Image(); 270 img.src = my_src[i]; 271 img_attr = 'id="img' + i + '" onclick="pick(this);"'; 272 skip = false; 273 if (img.width && img.height) { 274 if (img.width * img.height < 2500) skip = true; 275 aspect = img.width / img.height; 276 if (aspect > 1) { 277 // Image is wide 278 scale = 75 / img.width; 279 } else { 280 // Image is tall or square 281 scale = 75 / img.height; 282 } 283 if (scale < 1) { 284 w = parseInt(img.width * scale); 285 h = parseInt(img.height * scale); 286 } else { 287 w = img.width; 288 h = img.height; 289 } 290 img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; 291 } 292 if (!skip) { 293 strtoappend += '<a href="' + img.src + '" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>' 294 } 295 } 296 297 jQuery('#img_container').html(strtoappend); 298 299 tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox 300 }); 301 </script> 302 <form action="press-this.php?action=post" method="post" id="photo_form"> 341 <form action="press-this.php?action=post" method="post"> 303 342 <?php wp_nonce_field('press-this') ?> 304 343 <input type="hidden" name="source" value="bookmarklet"/> 305 <input type="hidden" name="post_type" value="photo"/>344 <input type="hidden" name="post_type" id="post_type" value="text"/> 306 345 <div id="posting"> 307 346 308 <h2 ><?php _e('Title') ?></h2>347 <h2 id="title"><?php _e('Title') ?></h2> 309 348 <div class="titlewrap"> 310 <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>349 <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/> 311 350 </div> 351 <div id="photo_fields" style="display: none;"> 352 <h2><?php _e('Photo URL') ?></h2> 353 <div class="titlewrap"> 354 <input name="photo_src" id="photo_src" class="text" onkeydown="pick(0);"/> 355 </div> 312 356 313 <h2><?php _e('Photo URL') ?></h2> 314 <div class="titlewrap"> 315 <input name="photo_src" id="photo_src" class="text" onkeydown="pick(0);"/> 316 </div> 357 <div class="photolist"></div> 317 358 318 <div class="photolist"></div> 359 <h2><?php _e('Link Photo to following URL') ?></h2><?php _e('(leave blank to leave the photo unlinked)') ?> 360 <div class="titlewrap"> 361 <input name="photo_link" id="photo_link" class="text" value="<?php echo attribute_escape($url);?>"/> 362 </div> 319 363 320 <h2><?php _e('Link Photo to following URL') ?></h2><?php _e('(leave blank to leave the photo unlinked)') ?>321 <div class="titlewrap">322 <input name="photo_link" id="photo_link" class="text" value="<?php echo attribute_escape($url);?>"/>323 </div>364 <small><?php _e('Click images to select:') ?></small> 365 <div class="titlewrap"> 366 <div id="img_container"></div> 367 </div> 324 368 325 <small><?php _e('Click images to select:') ?></small>326 <div class="titlewrap">327 <div id="img_container">328 369 </div> 329 </div>330 370 331 332 <h2><?php _e('Caption') ?></h2> 371 <h2 id="content_type"><?php _e('Post') ?></h2> 333 372 <div class="editor-container"> 334 <textarea name="content" id=" photo_post_two" style="" class="mceEditor">373 <textarea name="content" id="content" style="height:170px;width:100%;" class="mceEditor"> 335 374 <?php echo $selection; ?> 336 <p><a href="<?php echo attribute_escape($url);?>"><?php echo $title;?></a> </p>337 375 </textarea> 338 376 </div> 339 340 <?php tag_div(); ?>341 377 342 </div>343 <?php category_div() ?>344 </form>345 <?php346 exit;347 } elseif ( 'text' == $_GET['tab'] ) {348 ?>349 <script type="text/javascript">350 <?php press_this_js_init(); ?>351 </script>352 353 <form action="press-this.php?action=post" method="post" id="regular_form">354 <?php wp_nonce_field('press-this') ?>355 <input type="hidden" name="source" value="bookmarklet"/>356 <input type="hidden" name="post_type" value="regular"/>357 <div id="posting">358 <h2><?php _e('Title') ?></h2>359 <div class="titlewrap">360 <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>361 </div>362 363 <h2><?php _e('Post') ?></h2>364 <div class="editor-container">365 <textarea name="content" id="regular_post_two" style="height:170px;width:100%;" class="mceEditor">366 <?php echo $selection; ?>367 <p><a href="<?php echo $url;?>"><?php echo $title;?></a> </p>368 </textarea>369 </div>370 378 <?php tag_div(); ?> 371 372 </div>373 <?php category_div() ?>374 </form>375 <?php376 exit;377 } elseif ( 'quote' == $_GET['tab'] ) {378 ?>379 <script type="text/javascript">380 <?php press_this_js_init(); ?>381 </script>382 383 <form action="press-this.php?action=post" method="post" id="quote_form">384 <?php wp_nonce_field('press-this') ?>385 <input type="hidden" name="source" value="bookmarklet"/>386 <input type="hidden" name="post_type" value="quote"/>387 <div id="posting">388 <h2><?php _e('Title') ?></h2>389 <div class="titlewrap">390 <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape(sprintf(__('Quote by %s'), $title)); ?>"/>391 </div>392 379 393 <h2><?php _e('Quote') ?></h2>394 <div class="editor-container">395 <textarea name="content" id="quote_post_one" style="height:130px;width:100%;" class="mceEditor">396 <?php echo $selection; ?>397 </textarea>398 </div>399 400 <h2><?php _e('Source'); ?> <span class="optional"><?php _e('(optional)'); ?></span></h2>401 <div class="editor-container">402 <textarea name="content2" id="quote_post_two" style="height:130px;width:100%;" class="mceEditor">403 <p><cite><a href="<?php echo $url;?>"><?php echo $title;?></a></cite> </p>404 </textarea>405 </div>406 407 <?php tag_div(); ?>408 380 </div> 409 <?php category_div() ?> 410 </form> 411 <?php 412 exit; 413 } elseif ( 'video' == $_GET['tab'] ) { 414 ?> 415 <script type="text/javascript"> 416 <?php press_this_js_init(); ?> 417 </script> 418 419 <form action="press-this.php?action=post" method="post" id="video_form"> 420 <?php wp_nonce_field('press-this') ?> 421 <input type="hidden" name="source" value="bookmarklet"/> 422 <input type="hidden" name="post_type" value="video"/> 423 <div id="posting"> 424 425 <h2><?php _e('Video Title') ?></h2> 426 <div class="titlewrap"> 427 <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/> 428 </div> 429 <?php 381 <?php category_div(); ?> 382 </form> 383 <?php /* 430 384 if ( preg_match("/youtube\.com\/watch/i", $url) ) { 431 385 list($domain, $video_id) = split("v=", $url); 432 386 ?> … … 436 390 437 391 <h2><?php _e('Embed Code') ?></h2> 438 392 <textarea name="content" id="video_post_one" style="height:80px;width:100%;"></textarea> 439 <?php } ?> 440 441 <h2><?php _e('Caption <span class="optional">(optional)</span>') ?></h2> 442 443 <div class="editor-container"> 444 <textarea name="content2" id="video_post_two" style="height:130px;width:100%;" class="mceEditor"> 445 <?php echo $selection; ?> 446 <p><a href="<?php echo $url; ?>"><?php echo $title; ?></a> </p> 447 </textarea> 448 </div> 449 450 <?php tag_div(); ?> 451 </div> 452 <?php category_div() ?> 453 </form> 454 <?php 455 exit; 456 } 457 ?> 458 No newline at end of file 393 <?php } */?> 394 395 </body> 396 </html> 397 No newline at end of file -
css/press-this.css
3 3 margin: 0px; 4 4 padding: 0px; 5 5 } 6 6 /* Tabs */ 7 7 @media projection , screen { 8 8 .ui-tabs-hide { 9 9 display: none; … … 16 16 } 17 17 } 18 18 19 /* Skin */20 div.ui-tabs-panel {21 border: none;22 width: 100%;23 height: auto;24 margin: 0;25 padding: 0;26 position: relative;27 }28 29 19 .ui-tabs-nav { 30 20 list-style: none; 31 21 border-bottom: 1px solid #C6D9E9; … … 34 24 margin-top: -2em; 35 25 } 36 26 27 /* Additional IE specific bug fixes... */ 28 * html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */ 29 display: inline-block; 30 } 31 32 * :first-child+html .ui-tabs-nav { 33 /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */ 34 display: inline-block; 35 } 36 37 37 .ui-tabs-nav:after { 38 38 /* clearing without presentational markup, IE gets extra treatment */ 39 39 display: block; … … 77 77 -webkit-border-top-right-radius: 4px; 78 78 border-style: solid; 79 79 border-width: 1px; 80 }81 82 .ui-tabs-nav .ui-tabs-selected a {83 80 background: white; 84 81 border-bottom-width: 2px; 85 82 margin-top: -2px; 86 83 } 87 84 88 .ui-tabs-nav .ui-tabs-selected a:link,.ui-tabs-nav .ui-tabs-selected a:visited,.ui-tabs-nav .ui-tabs-disabled a:link,.ui-tabs-nav .ui-tabs-disabled a:visited89 { /* @ Opera, use pseudo classes otherwise it confuses cursor... */ 85 .ui-tabs-nav a:hover,.ui-tabs-nav a:focus,.ui-tabs-nav a:active, 86 .ui-tabs-nav .ui-tabs-selected a:link,.ui-tabs-nav .ui-tabs-selected a:visited { 90 87 cursor: pointer; 91 88 } 92 89 93 .ui-tabs-nav a:hover,.ui-tabs-nav a:focus,.ui-tabs-nav a:active,.ui-tabs-nav .ui-tabs-unselect a:hover,.ui-tabs-nav .ui-tabs-unselect a:focus,.ui-tabs-nav .ui-tabs-unselect a:active94 { /* @ Opera, we need to be explicit again here now... */95 cursor: pointer;96 }97 98 .ui-tabs-loading em {99 padding: 0 0 0 20px;100 background: url(../images/loading.gif) no-repeat 0 50%;101 }102 103 /* Additional IE specific bug fixes... */104 * html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */105 display: inline-block;106 }107 108 * :first-child+html .ui-tabs-nav {109 /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */110 display: inline-block;111 }112 113 90 #wphead { 114 91 border-top: none; 115 92 } … … 212 189 div#categories { 213 190 font-size: 85%; 214 191 position: absolute; 215 top: 1.9em; 192 216 193 right: 16px; 217 194 width: 27%; 218 195 z-index: 2; … … 308 285 } 309 286 310 287 .submitbox { 311 width: 1 80px;288 width: 100%; 312 289 float: right; 313 290 } 314 291 -
bookmarklet.php
1 <?php2 $mode = 'bookmarklet';3 require_once('admin.php');4 5 if ( ! current_user_can('edit_posts') )6 wp_die(__('Cheatin’ uh?'));7 8 if ('b' == $a):9 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">10 <html xmlns="http://www.w3.org/1999/xhtml">11 <head>12 <script type="text/javascript">13 <!--14 window.close()15 -->16 </script>17 </head>18 <body></body>19 </html>20 <?php21 exit;22 endif;23 24 $post = get_default_post_to_edit();25 26 $popuptitle = wp_specialchars(stripslashes($popuptitle));27 $text = wp_specialchars(stripslashes(urldecode($text)));28 29 $popuptitle = funky_javascript_fix($popuptitle);30 $text = funky_javascript_fix($text);31 32 $post_title = wp_specialchars($_REQUEST['post_title']);33 if (!empty($post_title))34 $post->post_title = stripslashes($post_title);35 else36 $post->post_title = $popuptitle;37 38 39 $content = wp_specialchars($_REQUEST['content']);40 $popupurl = clean_url($_REQUEST['popupurl']);41 if ( !empty($content) ) {42 $post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );43 } else {44 $post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";45 }46 47 /* /big funky fixes */48 49 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">50 <html xmlns="http://www.w3.org/1999/xhtml">51 <head>52 <title><?php bloginfo('name') ?> › Bookmarklet — WordPress</title>53 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />54 <?php55 wp_admin_css( 'css/global' );56 wp_admin_css();57 ?>58 59 <style type="text/css">60 <!--61 62 #wpbookmarklet textarea,input,select {63 border-width: 1px;64 border-color: #cccccc;65 border-style: solid;66 padding: 2px;67 margin: 1px;68 }69 70 #wpbookmarklet .checkbox {71 background-color: #ffffff;72 border-width: 0px;73 padding: 0px;74 margin: 0px;75 }76 77 #wpbookmarklet textarea {78 font-family: Verdana, Geneva, Arial, Helvetica;79 font-size: 0.9em;80 }81 82 #wpbookmarklet .wrap {83 border: 0px;84 }85 86 #wpbookmarklet #postdiv {87 margin-bottom: 0.5em;88 }89 90 #wpbookmarklet #titlediv {91 margin-bottom: 1em;92 }93 94 -->95 </style>96 </head>97 <body id="wpbookmarklet">98 <div id="wphead">99 <h1><?php bloginfo('name') ?></h1>100 </div>101 102 <?php require('edit-form.php'); ?>103 104 <?php do_action('admin_footer', ''); ?>105 106 </body>107 </html>