Quick post updates: More gettext, escaping, compress bookmarklet JS. see #6813

git-svn-id: http://svn.automattic.com/wordpress/trunk@7924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-05-13 16:02:12 +00:00
parent f6d1274333
commit 9b7daff0b4
2 changed files with 44 additions and 43 deletions

View File

@ -30,20 +30,20 @@ function quick_post() {
if ($_REQUEST['photo_link'])
$content = '<a href="' . $_REQUEST['photo_link'] . '" target="_new">';
$content .= '<img src="' . $_REQUEST['photo_src'] . '\ style="float:left;padding:5px;">';
$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'];
$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>";
$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>";
$content = $content . '</br><p>' . $_REQUEST['content2'] . '</p>';
break;
}
@ -208,7 +208,7 @@ $title = stripslashes($_GET['t']);
<h2><?php _e('Caption') ?></h2>
<div class="editor-container">
<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>
<br>&lt;a href="<?php echo clean_url($_GET['u']);?>"&gt;<?php echo $title;?>&lt;/a&gt;</textarea>
</div>
<h2><?php _e('Photo URL') ?></h2>
@ -285,7 +285,7 @@ $title = stripslashes($_GET['t']);
<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;
<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="photo_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
</div>
</div>
@ -321,8 +321,8 @@ $title = stripslashes($_GET['t']);
<?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;
<input type="submit" value="<?php echo attribute_escape(__('Create Quote')) ?>" style="margin-top:15px;" onclick="document.getElementById('quote_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="quote_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
</div>
</div>
@ -349,7 +349,7 @@ $title = stripslashes($_GET['t']);
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']; ?>" />
<input type="hidden" name="content" value="<?php echo attribute_escape($_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>
@ -359,14 +359,14 @@ $title = stripslashes($_GET['t']);
<h2><?php _e('Caption <span class="optional">(optional)</span>') ?></h2>
<div class="editor-container">
<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>
<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 clean_url($_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;
<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="video_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
</div>
</div>

View File

@ -744,39 +744,40 @@ 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;
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);";
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);";
$link = str_replace(array("\r", "\n", "\t"), '', $link);
return apply_filters('shortcut_link', $link);
}