Quick post bookmarklet. First cut. see #6813

git-svn-id: http://svn.automattic.com/wordpress/trunk@7919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-05-12 19:08:39 +00:00
parent 359601b720
commit 9830ab988c
5 changed files with 741 additions and 0 deletions

342
wp-admin/css/quick-post.css Normal file
View File

@ -0,0 +1,342 @@
/* jquery tabs css */
/* Caution! Ensure accessibility in print and other media types... */
@media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */
.ui-tabs-hide {
display: none;
}
}
/* Hide useless elements in print layouts... */
@media print {
.ui-tabs-nav {
display: none;
}
}
/* Skin */
.ui-tabs-nav, .ui-tabs-panel {
font-family: "Trebuchet MS", Trebuchet, Verdana, Helvetica, Arial, sans-serif;
font-size: 12px;
}
.ui-tabs-nav {
list-style: none;
margin: 0;
padding: 0 0 0 4px;
}
.ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */
display: block;
clear: both;
content: " ";
}
.ui-tabs-nav li {
float: left;
margin: 0 0 0 1px;
min-width: 84px; /* be nice to Opera */
}
.ui-tabs-nav a, .ui-tabs-nav a span {
display: block;
padding: 0 10px;
background: url(../images/tab.png) no-repeat;
}
.ui-tabs-nav a {
margin: 1px 0 0; /* position: relative makes opacity fail for disabled tab in IE */
padding-left: 0;
color: #27537a;
font-weight: bold;
line-height: 1.2;
text-align: center;
text-decoration: none;
white-space: nowrap; /* required in IE 6 */
outline: 0; /* prevent dotted border in Firefox */
}
.ui-tabs-nav .ui-tabs-selected a {
position: relative;
top: 1px;
z-index: 2;
margin-top: 0;
color: #000;
}
.ui-tabs-nav a span {
width: 64px; /* IE 6 treats width as min-width */
min-width: 64px;
height: 18px; /* IE 6 treats height as min-height */
min-height: 18px;
padding-top: 6px;
padding-right: 0;
}
*>.ui-tabs-nav a span { /* hide from IE 6 */
width: auto;
height: auto;
}
.ui-tabs-nav .ui-tabs-selected a span {
padding-bottom: 1px;
}
.ui-tabs-nav .ui-tabs-selected a, .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active {
background-position: 100% -150px;
}
.ui-tabs-nav a, .ui-tabs-nav .ui-tabs-disabled a:hover, .ui-tabs-nav .ui-tabs-disabled a:focus, .ui-tabs-nav .ui-tabs-disabled a:active {
background-position: 100% -100px;
}
.ui-tabs-nav .ui-tabs-selected a span, .ui-tabs-nav a:hover span, .ui-tabs-nav a:focus span, .ui-tabs-nav a:active span {
background-position: 0 -50px;
}
.ui-tabs-nav a span, .ui-tabs-nav .ui-tabs-disabled a:hover span, .ui-tabs-nav .ui-tabs-disabled a:focus span, .ui-tabs-nav .ui-tabs-disabled a:active span {
background-position: 0 0;
}
.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:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */
cursor: text;
}
.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:active { /* @ Opera, we need to be explicit again here now... */
cursor: pointer;
}
.ui-tabs-disabled {
opacity: .4;
filter: alpha(opacity=40);
}
.ui-tabs-panel {
border-top: 1px solid #97a5b0;
padding: 1em 8px;
background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */
}
.ui-tabs-loading em {
padding: 0 0 0 20px;
background: url(loading.gif) no-repeat 0 50%;
}
/* Additional IE specific bug fixes... */
* html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
display: inline-block;
}
*:first-child+html .ui-tabs-nav { /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
display: inline-block;
}
/* end jquery tabs css */
/* jquery thickbox css */
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
*{padding: 0; margin: 0;}
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
#TB_window {
font: 12px Arial, Helvetica, sans-serif;
color: #333333;
}
#TB_secondLine {
font: 10px Arial, Helvetica, sans-serif;
color:#666666;
}
#TB_window a:link {color: #666666;}
#TB_window a:visited {color: #666666;}
#TB_window a:hover {color: #000;}
#TB_window a:active {color: #666666;}
#TB_window a:focus{color: #666666;}
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
#TB_overlay {
position: fixed;
z-index:100;
top: 0px;
left: 0px;
background-color:#000;
filter:alpha(opacity=75);
-moz-opacity: 0.75;
opacity: 0.75;
height:100%;
width:100%;
}
* html #TB_overlay { /* ie6 hack */
position: absolute;
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
}
#TB_window {
position: fixed;
background: #ffffff;
z-index: 102;
color:#000000;
display:none;
border: 4px solid #525252;
text-align:left;
top:50%;
left:50%;
}
* html #TB_window { /* ie6 hack */
position: absolute;
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}
#TB_window img#TB_Image {
display:block;
margin: 15px 0 0 15px;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
border-top: 1px solid #666;
border-left: 1px solid #666;
}
#TB_caption{
height:25px;
padding:7px 30px 10px 25px;
float:left;
}
#TB_closeWindow{
height:25px;
padding:11px 25px 10px 0;
float:right;
}
#TB_closeAjaxWindow{
padding:7px 10px 5px 0;
margin-bottom:1px;
text-align:right;
float:right;
}
#TB_ajaxWindowTitle{
float:left;
padding:7px 0 5px 10px;
margin-bottom:1px;
}
#TB_title{
background-color:#e8e8e8;
height:27px;
}
#TB_ajaxContent{
clear:both;
padding:2px 15px 15px 15px;
overflow:auto;
text-align:left;
line-height:1.4em;
}
#TB_ajaxContent.TB_modal{
padding:15px;
}
#TB_ajaxContent p{
padding:5px 0px 5px 0px;
}
#TB_load{
position: fixed;
display:none;
height:13px;
width:208px;
z-index:103;
top: 50%;
left: 50%;
margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
}
* html #TB_load { /* ie6 hack */
position: absolute;
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}
#TB_HideSelect{
z-index:99;
position:fixed;
top: 0;
left: 0;
background-color:#fff;
border:none;
filter:alpha(opacity=0);
-moz-opacity: 0;
opacity: 0;
height:100%;
width:100%;
}
* html #TB_HideSelect { /* ie6 hack */
position: absolute;
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
}
#TB_iframeContent{
clear:both;
border:none;
margin-bottom:-1px;
margin-top:1px;
_margin-bottom:1px;
}
/* end jquery thickbox css */
/* quickpost css */
div#container {
background-color: #fff;
padding: 0px 15px 0px 15px;
}
div#container h2 {
margin: 15px 0px 0px 0px;
font-size: 15px;
}
div#container h2 span.optional {
font-size: 10px;
color: #bbb;
font-style: italic;
font-weight: normal;
}
div#container form {
margin: 0px;
padding: 0px;
}
div#categories {
float:right;
width:30%;
padding: 0px 5px 0px 5px;
}
div#posting {
float:left;
width:65%;
padding: 0px 5px 0px 5px;
}
textarea, input.text {
font: Normal 12px 'Lucida Grande', Verdana, Helvetica, sans-serif;
border: solid 1px #ccc;
background-color: #f4f4f4;
}
input.text {
width: 100%;
}
body {
background-color: #fff;
margin: 0px;
padding: 5px;
font: Normal 13px 'Lucida Grande', Verdana, Helvetica, sans-serif;
}
a {
color: #007BFF;
}
#categories ul {
list-style: none;
padding: 0;
margin: 0;
}
/* end quickpost css */

View File

@ -189,6 +189,9 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
<li><a href="edit.php?post_status=draft"><?php _e('View Drafts'); ?></a></li>
<?php do_action('post_relatedlinks_list'); ?>
</ul>
<h5><?php _e('Shortcuts') ?></h5>
<p><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?> <a href="<?php echo get_shortcut_link(); ?>" title="<?php echo attribute_escape(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
</div>
<?php do_action('submitpost_box'); ?>

BIN
wp-admin/images/tab.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

358
wp-admin/quick-post.php Normal file
View File

@ -0,0 +1,358 @@
<?php
require_once('admin.php');
if ( ! current_user_can('publish_posts') )
wp_die( __( 'Cheatin&#8217; uh?' ));
function quick_post() {
$quick['post_status'] = 'publish';
$quick['post_category'] = $_REQUEST['post_category'];
$quick['tags_input'] = $_REQUEST['tags_input'];
$quick['post_title'] = $_REQUEST['post_title'];
$content = '';
switch ( $_REQUEST['post_type'] ) {
case 'regular':
$content = $_REQUEST['content'];
if ($_REQUEST['content2'])
$content .= '<p>' . $_REQUEST['content2'];
break;
case 'quote':
$content = '<blockquote>' . $_REQUEST['content'];
if ($_REQUEST['content2']) {
$content = $content . '</blockquote>';
$content = $content . '<p>' . $_REQUEST['content2'];
}
break;
case 'photo':
if ($_REQUEST['photo_link'])
$content = '<a href="' . $_REQUEST['photo_link'] . '" target="_new">';
$content .= '<img src="' . $_REQUEST['photo_src'] . '\ style="float:left;padding:5px;">';
if ($_REQUEST['photo_link'])
$content .= '</a>';
if ($_REQUEST['content'])
$content = $content . "<br clear=\"all\">" . $_REQUEST['content'];
break;
case "video":
list($garbage,$video_id) = split("v=", $_REQUEST['content']);
$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>";
if ($_REQUEST['content2'])
$content = $content ."</br><p>" .$_REQUEST['content2'] ."</p>";
break;
}
$quick['post_content'] = $content;
$post_ID = wp_insert_post($quick, true);
if ( is_wp_error($post_ID) )
wp_die($wp_error);
return $post_ID;
}
function tag_input() {
$s = '<div id="tagdiv">
<h2>' . __('Tags') . '</h2>
<input type="text" name="tags_input" class="text" id="tags-input" size="30" tabindex="3" value="" /><br/>' .
__('Comma separated (e.g. Wordpress, Plugins)') .
'</div>';
return $s;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php _e('Quick Post') ?></title>
<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script>
<?php wp_enqueue_script('jquery-ui-tabs'); ?>
<?php wp_enqueue_script('thickbox'); ?>
<?php do_action('admin_print_scripts'); do_action('admin_head'); ?>
<?php wp_admin_css('css/quick-post'); ?>
<script type="text/javascript">
<? if ( user_can_richedit() ) { ?>
tinyMCE.init({
mode: "textareas",
editor_selector: "mceEditor",
width: "100%",
theme : "advanced",
theme_advanced_buttons1 : "bold,italic,underline,indent,separator,strikethrough,bullist,numlist,undo,redo,link,unlink",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
});
<? } ?>
jQuery(document).ready(function() {
<?php if ( preg_match("/youtube\.com\/watch/i", $_GET['u']) ) { ?>
jQuery('#container > ul').tabs({ selected: 4 })({ fx: { height: 'toggle', opacity: 'toggle', fxSpeed: 'fast' } });
<?php } elseif ( preg_match("/flickr\.com/i", $_GET['u']) ) { ?>
jQuery('#container > ul').tabs({ selected: 2 })({ fx: { height: 'toggle', opacity: 'toggle', fxSpeed: 'fast' } });
<?php } else { ?>
jQuery('#container > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle', fxSpeed: 'fast' } });
<?php } ?>
});
</script>
</head>
<body>
<?php
if ( 'post' == $_REQUEST['action'] ) {
check_admin_referer('quick-post');
$post_ID = quick_post();
?>
<script>if(confirm("<?php _e('Your post is saved. Do you want to view the post?') ?>")) {window.opener.location.replace("<?php echo get_permalink($post_ID);?>");}window.close();</script>
</body></html>
<?php
die;
}
// Clean up the data being passed in
$title = stripslashes($_GET['t']);
?>
<div id="container">
<ul>
<li><a href="#section-1"><span><?php _e('Text/Link') ?></span></a></li>
<li><a href="#section-2"><span><?php _e('Photo') ?></span></a></li>
<li><a href="#section-3"><span><?php _e('Quote') ?></span></a></li>
<li><a href="#section-4"><span><?php _e('Video') ?></span></a></li>
</ul>
<!-- Regular -->
<div id="section-1">
<form action="quick-post.php?action=post" method="post" id="regular_form">
<?php wp_nonce_field('quick-post') ?>
<input type="hidden" name="source" value="bookmarklet"/>
<input type="hidden" name="post_type" value="regular"/>
<div id="posting">
<h2><?php _e('Post Title') ?></h2>
<input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
<h2><?php _e('Post') ?></h2>
<div>
<textarea name="content" id="regular_post_two" style="height:170px;width:100%;" class="mceEditor"><?php echo stripslashes($_GET['s']);?><br>&lt;a href="<?php echo $_GET['u'];?>"&gt;<?php echo $title;?>&lt;/a&gt;</textarea>
</div>
<?php tag_input(); ?>
<div>
<input type="submit" value="<?php _e('Create Post') ?>" style="margin-top:15px;" onclick="document.getElementById('regular_saving').style.display = '';"/>&nbsp;&nbsp;
<a href="#" onclick="if (confirm('<?php _e('Are you sure?') ?>')) { self.close(); } else { return false; }" style="color:#007BFF;"><?php _e('Cancel') ?></a>&nbsp;&nbsp;
<img src="/images/bookmarklet_loader.gif" alt="" id="regular_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
</div>
</div>
<div id="categories">
<h2><?php _e('Categories') ?></h2>
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php wp_category_checklist($post_ID) ?>
</ul>
</div>
</form>
</div>
<!-- Photo -->
<div id="section-2">
<form action="quick-post.php?action=post" method="post" id="photo_form">
<?php wp_nonce_field('quick-post') ?>
<input type="hidden" name="source" value="bookmarklet"/>
<input type="hidden" name="post_type" value="photo"/>
<div id="posting">
<h2><?php _e('Post Title') ?></h2>
<input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
<h2><?php _e('Caption') ?></h2>
<div>
<textarea name="content" id="photo_post_two" style="height:130px;width:100%;" class="mceEditor"><?php echo "" .stripslashes($_GET['s']);?>
<br>&lt;a href="<?php echo $_GET['u'];?>"&gt;<?php echo $title;?>&lt;/a&gt;</textarea>
</div>
<h2><?php _e('Photo URL') ?></h2>
<input name="photo_src" id="photo_src" class="text" onkeydown="pick(0);"/>
<style type="text/css">
#img_container img {
width: 75px;
height: 75px;
padding: 2px;
background-color: #f4f4f4;
margin-right: 7px;
margin-bottom: 7px;
cursor: pointer;
}
</style>
<div id="img_container" style="border:solid 1px #ccc; background-color:#f4f4f4; padding:5px; width:370px; margin-top:10px; overflow:auto; height:100px;">
<script type="text/javascript">
var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
var my_src = ['<?php echo str_replace(",", "','", rtrim($_GET['imagez'], ","));?>'];
var last = null;
function pick(img) {
if (last) last.style.backgroundColor = '#f4f4f4';
if (img) {
document.getElementById('photo_src').value = img.src;
img.style.backgroundColor = '#44f';
}
last = img;
return false;
}
for (i = 0; i < my_src.length; i++) {
img = new Image();
img.src = my_src[i];
img_attr = 'id="img' + i + '" onclick="pick(this);"';
skip = false;
if (img.width && img.height) {
if (img.width * img.height < 2500) skip = true;
aspect = img.width / img.height;
if (aspect > 1) {
// Image is wide
scale = 75 / img.width;
} else {
// Image is tall or square
scale = 75 / img.height;
}
if (scale < 1) {
w = parseInt(img.width * scale);
h = parseInt(img.height * scale);
} else {
w = img.width;
h = img.height;
}
img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
}
if (!skip) {
strtoappend += '<a href="' + img.src + '" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'
}
}
if (jQuery.browser.safari) {
document.getElementById('img_container').innerHTML = strtoappend;
} else {
document.write(strtoappend);
}
</script>
</div>
<h2><?php _e('Link Photo to following URL') ?></h2><?php _e('(leave blank to leave the photo unlinked)') ?>
<input name="photo_link" id="photo_link" class="text" value="<?php echo attribute_escape($_GET['u']);?>"/>
<?php tag_input(); ?>
<div>
<input type="submit" value="<?php _e('Create Photo') ?>" style="margin-top:15px;" onclick="document.getElementById('photo_saving').style.display = '';"/>&nbsp;&nbsp;
<a href="#" onclick="if (confirm('Are you sure?')) { self.close(); } else { return false; }" style="color:#007BFF;">Cancel</a>&nbsp;&nbsp;
<img src="/images/bookmarklet_loader.gif" alt="" id="photo_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
</div>
</div>
<div id="categories">
<h2><?php _e('Categories') ?></h2>
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php wp_category_checklist($post_ID) ?>
</ul>
</div>
</form>
</div>
<!-- Quote -->
<div id="section-3">
<form action="quick-post.php?action=post" method="post" id="quote_form">
<?php wp_nonce_field('quick-post') ?>
<input type="hidden" name="source" value="bookmarklet"/>
<input type="hidden" name="post_type" value="quote"/>
<div id="posting">
<h2><?php _e('Post Title') ?></h2>
<input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape(sprintf(__('Quote by %s'), $title)); ?>"/>
<h2><?php _e('Quote') ?></h2>
<div>
<textarea name="content" id="quote_post_one" style="height:130px;width:100%;" class="mceEditor"><?php echo stripslashes($_GET['s']);?></textarea>
</div>
<h2><?php _e('Source <span class="optional">(optional)</span>') ?></h2>
<div>
<textarea name="content2" id="quote_post_two" style="height:130px;width:100%;" class="mceEditor"><br>&lt;a href="<?php echo clean_url($_GET['u']);?>"&gt;<?php echo $title;?>&lt;/a&gt;</textarea>
</div>
<?php tag_input(); ?>
<div>
<input type="submit" value="Create Quote" style="margin-top:15px;" onclick="document.getElementById('quote_saving').style.display = '';"/>&nbsp;&nbsp;
<a href="#" onclick="if (confirm('Are you sure?')) { self.close(); } else { return false; }" style="color:#007BFF;"><?php _e('Cancel') ?></a>&nbsp;&nbsp;
<img src="/images/bookmarklet_loader.gif" alt="" id="quote_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
</div>
</div>
<div id="categories">
<h2><?php _e('Categories') ?></h2>
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php wp_category_checklist($post_ID) ?>
</ul>
</div>
</form>
</div>
<!-- Video -->
<div id="section-4">
<form action="quick-post.php?action=post" method="post" id="video_form">
<?php wp_nonce_field('quick-post') ?>
<input type="hidden" name="source" value="bookmarklet"/>
<input type="hidden" name="post_type" value="video"/>
<div id="posting">
<h2><?php _e('Post Title') ?></h2>
<input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
<?php
if ( preg_match("/youtube\.com\/watch/i", $_GET['u']) ) {
list($domain, $video_id) = split("v=", $_GET['u']);
?>
<input type="hidden" name="content" value="<?php echo $_GET['u']; ?>" />
<img src="http://img.youtube.com/vi/<?php echo $video_id; ?>/default.jpg" align="right" style="border:solid 1px #aaa;" width="130" height="97"/><br clear="all" />
<?php } else { ?>
<h2><?php _e('Embed Code') ?></h2>
<textarea name="content" id="video_post_one" style="height:80px;width:100%;"></textarea>
<?php } ?>
<h2><?php _e('Caption <span class="optional">(optional)</span>') ?></h2>
<div>
<textarea name="content2" id="video_post_two" style="height:130px;width:100%;" class="mceEditor"><?php echo stripslashes($_GET['s']);?><br>&lt;a href="<?php echo $_GET['u'];?>"&gt;<?php echo $title;?>&lt;/a&gt;</textarea>
</div>
<?php tag_input(); ?>
<div>
<input type="submit" value="<?php _e('Create Video') ?>" style="margin-top:15px;" onclick="document.getElementById('video_saving').style.display = '';"/>&nbsp;&nbsp;
<a href="#" onclick="if (confirm('Are you sure?')) { self.close(); } else { return false; }" style="color:#007BFF;"><?php _e('Cancel'); ?></a>&nbsp;&nbsp;
<img src="/images/bookmarklet_loader.gif" alt="" id="video_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
</div>
</div>
<div id="categories">
<h2><?php _e('Categories') ?></h2>
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php wp_category_checklist($post_ID) ?>
</ul>
</div>
</form>
</div>
</div>
</body>
</html>

View File

@ -742,4 +742,42 @@ function posts_nav_link($sep=' &#8212; ', $prelabel='&laquo; Previous Page', $nx
}
}
function get_shortcut_link() {
$link = "javascript:
var imgstr='';
var reg=new RegExp('&');
for(i=0;i<document.images.length;i++){
if(! reg.test(document.images[i].src)){
imgstr = imgstr + document.images[i].src + ',';
}
}
var d=document;
var w=window;
var e=w.getSelection;
var k=d.getSelection;
var x=d.selection;
var s=(e?e():(k)?k():(x?x.createRange().text:0));
var f='" . get_settings('siteurl') . '/wp-admin/quick-post.php' . "';
var l=d.location;
var e=encodeURIComponent;
var p='?imagez='+imgstr;
var u= '&u=' + e(l.href);
var t= '&t=' + e(d.title);
var s= '&s=' + e(s);
var g= f+p+u+t+s;
function a(){
if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=700,height=500')){
l.href=g;
}
}
if(/Firefox/.test(navigator.userAgent)){
setTimeout(a,0);
}else{
a();
}
void(0);";
return apply_filters('shortcut_link', $link);
}
?>