Changeset 9866 for trunk/wp-admin/press-this.php
- Timestamp:
- 11/25/2008 01:16:00 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/press-this.php
r9857 r9866 214 214 215 215 $sources = array(); 216 216 217 foreach ($matches[3] as $src) { 217 218 // if no http in url … … 224 225 $sources[] = clean_url($src); 225 226 } 227 226 228 return "'" . implode("','", $sources) . "'"; 227 229 } … … 258 260 ); 259 261 if(my_src.length == 0) { 260 261 262 strtoappend = '<?php _e('Unable to retrieve images or no images on page.'); ?>'; 262 263 } 263 264 } 264 265 265 266 266 for (i = 0; i < my_src.length; i++) { 267 267 img = new Image(); … … 269 269 img_attr = 'id="img' + i + '"'; 270 270 skip = false; 271 272 maybeappend = '<a href="?ajax=photo_thickbox&i=' + encodeURI(img.src) + '&u=<?php echo urlencode($url); ?>&height=400&width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; 273 271 274 if (img.width && img.height) { 272 275 if (img.width >= 30 && img.height >= 30) { … … 282 285 } 283 286 img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; 284 strtoappend += '<a href="?ajax=photo_thickbox&i=' + encodeURI(img.src) + '&u=<?php echo $url; ?>&height=400&width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';287 strtoappend += maybeappend; 285 288 } 289 } else { 290 strtoappend += maybeappend; 286 291 } 287 292 } 288 293 289 294 function pick(img, desc) { 290 295 if (img) { … … 293 298 jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>'); 294 299 jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>'); 295 insert_editor( "\n\n" + '<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>');300 insert_editor( "\n\n" + '<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>'); 296 301 } 297 302 return false; … … 371 376 jQuery('#publish').click( tag_save_on_publish ); 372 377 jQuery('#save').click( tag_save_on_publish ); 373 374 378 function insert_plain_editor(text) { 379 edCanvas = document.getElementById('content'); 380 edInsertContent(edCanvas, text); 381 } 375 382 function set_editor(text) { 376 383 if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>'; … … 378 385 } 379 386 function insert_editor(text) { 380 if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceInsertContent', false, '<p>' + tinymce.DOM.decode(text) + '</p>'); 387 if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) { 388 tinyMCE.execCommand('mceInsertContent', false, '<p>' + tinymce.DOM.decode(text) + '</p>', {format : 'raw'}); 389 } else { 390 insert_plain_editor(text); 391 } 381 392 } 382 393 function append_editor(text) { 383 if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '<p>' + text + '</p>'); 384 tinyMCE.execCommand('mceCleanup'); 394 if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) { 395 tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '<p>' + text + '</p>'); 396 tinyMCE.execCommand('mceCleanup'); 397 } else { 398 insert_plain_editor(text); 399 } 385 400 } 386 401 387 402 function show(tab_name) { 388 403 jQuery('#extra_fields').html(''); 404 jQuery('#extra_fields').show(); 389 405 switch(tab_name) { 390 406 case 'video' : 391 jQuery('#extra_fields').html('');392 jQuery('#extra_fields').show();393 407 jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() { 394 408 <?php … … 410 424 ?> 411 425 jQuery('#embed-code').prepend('<?php echo htmlentities($content); ?>'); 412 413 426 }); 414 427 return false; 415 428 break; 416 429 case 'photo' : 417 jQuery('#extra_fields').html(''); 418 jQuery('#extra_fields').show(); 419 jQuery('#extra_fields').before('<p id="waiting"><img src="images/loading.gif" alt="" /> <?php echo js_escape( __( 'Loading...' ) ); ?></p>'); 420 jQuery.ajax({ 421 type: "GET", 422 cache : false, 423 url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>", 424 data: "ajax=photo_js&u=<?php echo urlencode($url)?>", 425 dataType : "script", 426 success : function() { 427 jQuery('#waiting').remove(); 428 } 429 }); 430 430 jQuery('#extra_fields').before('<p id="waiting"><img src="images/loading.gif" alt="" /> <?php echo js_escape( __( 'Loading...' ) ); ?></p>'); 431 jQuery.ajax({ 432 type: "GET", 433 cache : false, 434 url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>", 435 data: "ajax=photo_js&u=<?php echo urlencode($url)?>", 436 dataType : "script", 437 success : function() { 438 jQuery('#waiting').remove(); 439 } 440 }); 431 441 return false; 432 442 break; … … 436 446 //resize screen 437 447 window.resizeTo(720,570); 438 448 // set button actions 439 449 jQuery('#photo_button').click(function() { show('photo'); return false; }); 440 450 jQuery('#video_button').click(function() { show('video'); return false; }); 441 jQuery('#visual_mode_button').click(function() { 442 443 }); 444 // Set default tabs 451 // auto select 445 452 <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?> 446 453 show('video'); … … 451 458 <?php } ?> 452 459 453 jQuery('# submit').click(function() { jQuery('saving').css('display', 'block'); });460 jQuery('#publish, #save').click(function() { alert('test'); jQuery('#saving').css('display', 'inline'); }); 454 461 }); 455 462 </script> 456 463 </head> 457 464 <body class="press-this"> 458 <div id="wphead"> 459 </div> 460 465 <div id="wphead"></div> 461 466 <form action="press-this.php?action=post" method="post"> 462 463 464 <div id="poststuff" class="metabox-holder"> 467 <div id="poststuff" class="metabox-holder"> 465 468 <div id="side-info-column"> 466 469 <div class="sleeve"> … … 469 472 <?php wp_nonce_field('press-this') ?> 470 473 <input type="hidden" name="post_type" id="post_type" value="text"/> 471 <input type="hidden" name="autosave" id="autosave" /> 474 <input type="hidden" name="autosave" id="autosave" /> 475 472 476 <!-- This div holds the photo metadata --> 473 477 <div class="photolist"></div> 474 478 475 479 <div id="categorydiv" class="stuffbox"> 476 <h2><?php _e('Categories') ?></h2>480 <h2><?php _e('Categories') ?></h2> 477 481 <div class="inside"> 478 482 479 <div id="categories-all" class="ui-tabs-panel"> 480 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 481 <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?> 482 </ul> 483 483 <div id="categories-all" class="ui-tabs-panel"> 484 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 485 <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?> 486 </ul> 487 </div> 488 489 <div id="category-adder" class="wp-hidden-children"> 490 <a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a> 491 <p id="category-add" class="wp-hidden-child"> 492 <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/> 493 <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> 494 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> 495 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> 496 <span id="category-ajax-response"></span> 497 </p> 498 </div> 499 </div> 484 500 </div> 485 486 <div id="category-adder" class="wp-hidden-children">487 <a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a>488 <p id="category-add" class="wp-hidden-child">489 <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>490 <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>491 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />492 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>493 <span id="category-ajax-response"></span>494 </p>495 </div>496 </div>497 </div>498 501 499 502 <div class="stuffbox"> 500 <h2><?php _e('Tags') ?></h2>503 <h2><?php _e('Tags') ?></h2> 501 504 <div class="inside"> 502 505 503 <div 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 ); ?>" /></div> 504 505 <div id="tagchecklist"></div> 506 <div id="jaxtag"> 507 <label class="hidden" for="newtag"><?php _e('Tags'); ?></label> 508 <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 ); ?>" /> 509 </div> 510 <div id="tagchecklist"></div> 506 511 </div> 507 512 </div> … … 509 514 <h2><?php _e('Publish') ?></h2> 510 515 <div class="inside"> 511 <p>512 <input class="button" type="submit" name="draft" value="<?php _e('Save Draft') ?>" id="save" />513 <input class="button-primary" type="submit" name="publish" value="<?php _e('Publish') ?>" id="publish" />514 <img src="images/loading-publish.gif" alt="" id="saving" style="display:none;"/>515 </p>516 <p> 517 <input class="button" type="submit" name="draft" value="<?php _e('Save Draft') ?>" id="save" /> 518 <input class="button-primary" type="submit" name="publish" value="<?php _e('Publish') ?>" id="publish" /> 519 <img src="images/loading-publish.gif" alt="" id="saving" style="display:none;"/> 520 </p> 516 521 </div> 517 522 </div> … … 519 524 </div> 520 525 521 <div class="posting"> 522 <?php 523 if ( isset($posted) && intval($posted) ) { 524 $post_ID = intval($posted); 525 ?> 526 <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="<?php echo get_edit_post_link( $post_ID ); ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div> 527 <?php 528 } 529 ?> 530 531 532 <div id="titlediv"> 533 <div class="titlewrap"> 534 <input name="title" id="title" class="text" value="<?php echo attribute_escape($title);?>"/> 535 </div> 536 </div> 537 538 <div id="extra_fields" style="display: none"></div> 539 540 <div class="postdivrich"> 541 <ul id="actions"> 542 <li id="photo_button"> 543 544 Add: <a title="<?php _e('Insert an Image'); ?>" href="#"> 526 <div class="posting"> 527 <?php if ( isset($posted) && intval($posted) ) { $post_ID = intval($posted); ?> 528 <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="<?php echo get_edit_post_link( $post_ID ); ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div> 529 <?php } ?> 530 531 <div id="titlediv"> 532 <div class="titlewrap"> 533 <input name="title" id="title" class="text" value="<?php echo attribute_escape($title);?>"/> 534 </div> 535 </div> 536 537 <div id="extra_fields" style="display: none"></div> 538 539 <div class="postdivrich"> 540 <ul id="actions"> 541 <li id="photo_button"> 542 Add: <a title="<?php _e('Insert an Image'); ?>" href="#"> 545 543 <img alt="<?php _e('Insert an Image'); ?>" src="images/media-button-image.gif"/></a> 546 </li> 547 <li id="video_button"> 548 <a title="<?php _e('Embed a Video'); ?>" href="#"><img alt="<?php _e('Embed a Video'); ?>" src="images/media-button-video.gif"/></a> 549 </li> 550 <li id="switcher"> 551 <?php wp_print_scripts( 'quicktags' ); ?> 552 553 <?php add_filter('the_editor_content', 'wp_richedit_pre'); ?> 554 <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a> 555 <a id="edButtonPreview" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a> 556 <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div> 557 </li> 558 </ul> 544 </li> 545 <li id="video_button"> 546 <a title="<?php _e('Embed a Video'); ?>" href="#"><img alt="<?php _e('Embed a Video'); ?>" src="images/media-button-video.gif"/></a> 547 </li> 548 <li id="switcher"> 549 <?php wp_print_scripts( 'quicktags' ); ?> 550 <?php add_filter('the_editor_content', 'wp_richedit_pre'); ?> 551 <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a> 552 <a id="edButtonPreview" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a> 553 <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div> 554 </li> 555 </ul> 559 556 <div id="quicktags"></div> 560 561 562 563 <div class="editor-container"> 564 <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15"> 557 <div class="editor-container"> 558 <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15"> 565 559 <?php if ($selection) echo wp_richedit_pre(htmlspecialchars_decode($selection)); ?> 566 560 <?php if ($url) { echo '<p>'; if($selection) _e('via '); echo "<a href='$url'>$title</a>."; echo '</p>'; } ?> 567 </textarea> 568 </div> 569 570 </div> 561 </textarea> 562 </div> 571 563 </div> 572 564 </div> 565 </div> 573 566 </form> 574 567 </body>
Note: See TracChangeset
for help on using the changeset viewer.