summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-07-03 17:00:59 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-07-03 17:00:59 +0000
commit2b6348978ec434e2fa4114085783cf9ada097b22 (patch)
treea3745bb9ace00b0a8f687bc8c1bfb74bb885077c /wp-admin/includes
parent102dc1d903d95fd7abdf2243d7e047b4b20099d3 (diff)
downloadwordpress-mu-2b6348978ec434e2fa4114085783cf9ada097b22.tar.gz
wordpress-mu-2b6348978ec434e2fa4114085783cf9ada097b22.tar.xz
wordpress-mu-2b6348978ec434e2fa4114085783cf9ada097b22.zip
WP Merge to rev 8249
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1347 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/includes')
-rw-r--r--wp-admin/includes/media.php31
-rw-r--r--wp-admin/includes/misc.php2
-rw-r--r--wp-admin/includes/post.php3
-rw-r--r--wp-admin/includes/template.php3
4 files changed, 30 insertions, 9 deletions
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 99f2bbd..a79944a 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -62,6 +62,25 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
return $html;
}
+function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
+
+ if ( empty($alt) ) return $html;
+ $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
+
+ preg_match( '/width="([0-9]+)/', $html, $matches );
+ if ( ! isset($matches[1]) ) return $html;
+ $width = $matches[1];
+
+ $html = preg_replace( '/align[^\s\'"]+\s?/', '', $html );
+ if ( empty($align) ) $align = 'none';
+
+ $shcode = '[wp_caption id="' . $id . '" align="align' . $align
+ . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/wp_caption]';
+
+ return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
+}
+add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 );
+
function media_send_to_editor($html) {
?>
<script type="text/javascript">
@@ -212,10 +231,10 @@ function media_buttons() {
$audio_title = __('Add Audio');
$out = <<<EOF
- <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
- <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
- <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
- <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
+ <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
+ <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
+ <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
+ <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
EOF;
printf($context, $out);
@@ -321,10 +340,8 @@ function media_sideload_image($file, $post_id, $desc = null) {
$id = media_handle_sideload($file_array, $post_id, $desc);
$src = $id;
- unset($file_array);
-
if ( is_wp_error($id) ) {
- $errors['upload_error'] = $id;
+ @unlink($file_array['tmp_name']);
return $id;
}
}
diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php
index 1d81bf8..7e1e75f 100644
--- a/wp-admin/includes/misc.php
+++ b/wp-admin/includes/misc.php
@@ -68,7 +68,7 @@ function insert_with_markers( $filename, $marker, $insertion ) {
}
}
if (!$foundit) {
- fwrite( $f, "# BEGIN {$marker}\n" );
+ fwrite( $f, "\n# BEGIN {$marker}\n" );
foreach ( $insertion as $insertline )
fwrite( $f, "{$insertline}\n" );
fwrite( $f, "# END {$marker}\n" );
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index f98b9de..a34aeab 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -93,7 +93,10 @@ function _wp_translate_postdata( $update = false ) {
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
+ $aa = ($aa <= 0 ) ? date('Y') : $aa;
+ $mm = ($mm <= 0 ) ? date('n') : $mm;
$jj = ($jj > 31 ) ? 31 : $jj;
+ $jj = ($jj <= 0 ) ? date('j') : $jj;
$hh = ($hh > 23 ) ? $hh -24 : $hh;
$mn = ($mn > 59 ) ? $mn -60 : $mn;
$ss = ($ss > 59 ) ? $ss -60 : $ss;
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 346fe7e..bde13d0 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -767,6 +767,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
$actions = array();
+ if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
@@ -779,9 +780,9 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
unset($actions['approve']);
}
- if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
+ $actions = apply_filters( 'comment_row_actions', $actions, $comment );
foreach ( $actions as $action => $link )
echo "<span class='$action'>$link</span>";
}