PressThis updates from Noel, see #7949
git-svn-id: http://svn.automattic.com/wordpress/trunk@9866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
141eb9777e
commit
9c3332c2d2
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
@ -213,6 +213,7 @@ switch ($_REQUEST['ajax']) {
|
|||
if ( empty($matches[0]) ) return '';
|
||||
|
||||
$sources = array();
|
||||
|
||||
foreach ($matches[3] as $src) {
|
||||
// if no http in url
|
||||
if(strpos($src, 'http') === false)
|
||||
|
@ -223,6 +224,7 @@ switch ($_REQUEST['ajax']) {
|
|||
$src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src);
|
||||
$sources[] = clean_url($src);
|
||||
}
|
||||
|
||||
return "'" . implode("','", $sources) . "'";
|
||||
}
|
||||
|
||||
|
@ -257,17 +259,18 @@ switch ($_REQUEST['ajax']) {
|
|||
}).responseText
|
||||
);
|
||||
if(my_src.length == 0) {
|
||||
|
||||
strtoappend = '<?php _e('Unable to retrieve images or no images on page.'); ?>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < my_src.length; i++) {
|
||||
img = new Image();
|
||||
img.src = my_src[i];
|
||||
img_attr = 'id="img' + i + '"';
|
||||
skip = false;
|
||||
|
||||
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>';
|
||||
|
||||
if (img.width && img.height) {
|
||||
if (img.width >= 30 && img.height >= 30) {
|
||||
aspect = img.width / img.height;
|
||||
|
@ -281,8 +284,10 @@ switch ($_REQUEST['ajax']) {
|
|||
h = parseInt(img.height * scale);
|
||||
}
|
||||
img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
|
||||
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>';
|
||||
strtoappend += maybeappend;
|
||||
}
|
||||
} else {
|
||||
strtoappend += maybeappend;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,7 +297,7 @@ switch ($_REQUEST['ajax']) {
|
|||
if(length == 0) length = 1;
|
||||
jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
|
||||
jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
|
||||
insert_editor("\n\n" + '<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>');
|
||||
insert_editor( "\n\n" + '<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -370,26 +375,35 @@ die;
|
|||
// auto-save tags on post save/publish
|
||||
jQuery('#publish').click( tag_save_on_publish );
|
||||
jQuery('#save').click( tag_save_on_publish );
|
||||
|
||||
|
||||
function insert_plain_editor(text) {
|
||||
edCanvas = document.getElementById('content');
|
||||
edInsertContent(edCanvas, text);
|
||||
}
|
||||
function set_editor(text) {
|
||||
if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>';
|
||||
if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text);
|
||||
}
|
||||
function insert_editor(text) {
|
||||
if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceInsertContent', false, '<p>' + tinymce.DOM.decode(text) + '</p>');
|
||||
if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) {
|
||||
tinyMCE.execCommand('mceInsertContent', false, '<p>' + tinymce.DOM.decode(text) + '</p>', {format : 'raw'});
|
||||
} else {
|
||||
insert_plain_editor(text);
|
||||
}
|
||||
}
|
||||
function append_editor(text) {
|
||||
if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '<p>' + text + '</p>');
|
||||
if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) {
|
||||
tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '<p>' + text + '</p>');
|
||||
tinyMCE.execCommand('mceCleanup');
|
||||
} else {
|
||||
insert_plain_editor(text);
|
||||
}
|
||||
}
|
||||
|
||||
function show(tab_name) {
|
||||
|
||||
switch(tab_name) {
|
||||
case 'video' :
|
||||
jQuery('#extra_fields').html('');
|
||||
jQuery('#extra_fields').show();
|
||||
switch(tab_name) {
|
||||
case 'video' :
|
||||
jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
|
||||
<?php
|
||||
$content = '';
|
||||
|
@ -409,13 +423,10 @@ die;
|
|||
}
|
||||
?>
|
||||
jQuery('#embed-code').prepend('<?php echo htmlentities($content); ?>');
|
||||
|
||||
});
|
||||
return false;
|
||||
break;
|
||||
case 'photo' :
|
||||
jQuery('#extra_fields').html('');
|
||||
jQuery('#extra_fields').show();
|
||||
jQuery('#extra_fields').before('<p id="waiting"><img src="images/loading.gif" alt="" /> <?php echo js_escape( __( 'Loading...' ) ); ?></p>');
|
||||
jQuery.ajax({
|
||||
type: "GET",
|
||||
|
@ -427,7 +438,6 @@ die;
|
|||
jQuery('#waiting').remove();
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
@ -435,13 +445,10 @@ die;
|
|||
jQuery(document).ready(function() {
|
||||
//resize screen
|
||||
window.resizeTo(720,570);
|
||||
|
||||
// set button actions
|
||||
jQuery('#photo_button').click(function() { show('photo'); return false; });
|
||||
jQuery('#video_button').click(function() { show('video'); return false; });
|
||||
jQuery('#visual_mode_button').click(function() {
|
||||
|
||||
});
|
||||
// Set default tabs
|
||||
// auto select
|
||||
<?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
|
||||
show('video');
|
||||
<?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
|
||||
|
@ -450,18 +457,14 @@ die;
|
|||
show('photo');
|
||||
<?php } ?>
|
||||
|
||||
jQuery('#submit').click(function() { jQuery('saving').css('display', 'block'); });
|
||||
jQuery('#publish, #save').click(function() { alert('test'); jQuery('#saving').css('display', 'inline'); });
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body class="press-this">
|
||||
<div id="wphead">
|
||||
</div>
|
||||
|
||||
<div id="wphead"></div>
|
||||
<form action="press-this.php?action=post" method="post">
|
||||
|
||||
|
||||
<div id="poststuff" class="metabox-holder">
|
||||
<div id="poststuff" class="metabox-holder">
|
||||
<div id="side-info-column">
|
||||
<div class="sleeve">
|
||||
<h1 id="viewsite"><a class="button" href="<?php echo get_option('home'); ?>/" target="_blank"><?php bloginfo('name'); ?> › <?php _e('Press This') ?></a></span></h1>
|
||||
|
@ -469,6 +472,7 @@ die;
|
|||
<?php wp_nonce_field('press-this') ?>
|
||||
<input type="hidden" name="post_type" id="post_type" value="text"/>
|
||||
<input type="hidden" name="autosave" id="autosave" />
|
||||
|
||||
<!-- This div holds the photo metadata -->
|
||||
<div class="photolist"></div>
|
||||
|
||||
|
@ -480,7 +484,6 @@ die;
|
|||
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
|
||||
<?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="category-adder" class="wp-hidden-children">
|
||||
|
@ -500,8 +503,10 @@ die;
|
|||
<h2><?php _e('Tags') ?></h2>
|
||||
<div class="inside">
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
<div id="tagchecklist"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -519,15 +524,9 @@ die;
|
|||
</div>
|
||||
|
||||
<div class="posting">
|
||||
<?php
|
||||
if ( isset($posted) && intval($posted) ) {
|
||||
$post_ID = intval($posted);
|
||||
?>
|
||||
<?php if ( isset($posted) && intval($posted) ) { $post_ID = intval($posted); ?>
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<div id="titlediv">
|
||||
<div class="titlewrap">
|
||||
|
@ -540,7 +539,6 @@ die;
|
|||
<div class="postdivrich">
|
||||
<ul id="actions">
|
||||
<li id="photo_button">
|
||||
|
||||
Add: <a title="<?php _e('Insert an Image'); ?>" href="#">
|
||||
<img alt="<?php _e('Insert an Image'); ?>" src="images/media-button-image.gif"/></a>
|
||||
</li>
|
||||
|
@ -549,7 +547,6 @@ die;
|
|||
</li>
|
||||
<li id="switcher">
|
||||
<?php wp_print_scripts( 'quicktags' ); ?>
|
||||
|
||||
<?php add_filter('the_editor_content', 'wp_richedit_pre'); ?>
|
||||
<a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
|
||||
<a id="edButtonPreview" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
|
||||
|
@ -557,19 +554,15 @@ die;
|
|||
</li>
|
||||
</ul>
|
||||
<div id="quicktags"></div>
|
||||
|
||||
|
||||
|
||||
<div class="editor-container">
|
||||
<textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15">
|
||||
<?php if ($selection) echo wp_richedit_pre(htmlspecialchars_decode($selection)); ?>
|
||||
<?php if ($url) { echo '<p>'; if($selection) _e('via '); echo "<a href='$url'>$title</a>."; echo '</p>'; } ?>
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue