web/wp-admin/includes/dashboard.php
branchwordpress
changeset 132 4d4862461b8d
parent 109 03b0d1493584
equal deleted inserted replaced
131:a4642baaf829 132:4d4862461b8d
    32 	wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments' );
    32 	wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments' );
    33 
    33 
    34 	// Incoming Links Widget
    34 	// Incoming Links Widget
    35 	if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
    35 	if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
    36 		$update = true;
    36 		$update = true;
       
    37 		$num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10;
    37 		$widget_options['dashboard_incoming_links'] = array(
    38 		$widget_options['dashboard_incoming_links'] = array(
    38 			'home' => get_option('home'),
    39 			'home' => get_option('home'),
    39 			'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
    40 			'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
    40 			'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=20&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
    41 			'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
    41 			'items' => isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10,
    42 			'items' => $num_items,
    42 			'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
    43 			'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
    43 		);
    44 		);
    44 	}
    45 	}
    45 	wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
    46 	wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
    46 
    47 
   130 }
   131 }
   131 
   132 
   132 function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
   133 function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
   133 	echo '<form action="" method="post" class="dashboard-widget-control-form">';
   134 	echo '<form action="" method="post" class="dashboard-widget-control-form">';
   134 	wp_dashboard_trigger_widget_control( $meta_box['id'] );
   135 	wp_dashboard_trigger_widget_control( $meta_box['id'] );
   135 	echo "<p class='submit'><input type='hidden' name='widget_id' value='" . esc_attr($meta_box['id']) . "' /><input type='submit' value='" . esc_attr__( 'Submit' ) . "' /></p>";
   136 	echo '<p class="submit"><input type="hidden" name="widget_id" value="' . esc_attr($meta_box['id']) . '" /><input type="submit" value="' . esc_attr__( 'Submit' ) . '" /></p>';
   136 
   137 
   137 	echo '</form>';
   138 	echo '</form>';
   138 }
   139 }
   139 
   140 
   140 /**
   141 /**
   161 		default:
   162 		default:
   162 			$width = 'width:98%;';
   163 			$width = 'width:98%;';
   163 			$hide2 = $hide3 = $hide4 = 'display:none;';
   164 			$hide2 = $hide3 = $hide4 = 'display:none;';
   164 	}
   165 	}
   165 ?>
   166 ?>
   166 <div id='dashboard-widgets' class='metabox-holder'>
   167 <div id="dashboard-widgets" class="metabox-holder">
   167 <?php
   168 <?php
   168 	echo "\t<div class='postbox-container' style='$width'>\n";
   169 	echo "\t<div class='postbox-container' style='$width'>\n";
   169 	do_meta_boxes( 'dashboard', 'normal', '' );
   170 	do_meta_boxes( 'dashboard', 'normal', '' );
   170 
   171 
   171 	echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n";
   172 	echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n";
   177 	echo "\t</div><div class='postbox-container' style='{$hide4}$width'>\n";
   178 	echo "\t</div><div class='postbox-container' style='{$hide4}$width'>\n";
   178 	do_meta_boxes( 'dashboard', 'column4', '' );
   179 	do_meta_boxes( 'dashboard', 'column4', '' );
   179 ?>
   180 ?>
   180 </div></div>
   181 </div></div>
   181 
   182 
   182 <form style='display: none' method='get' action=''>
   183 <form style="display:none" method="get" action="">
   183 	<p>
   184 	<p>
   184 <?php
   185 <?php
   185 	wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
   186 	wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
   186 	wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
   187 	wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
   187 ?>
   188 ?>
   234 		$pending_text = '';
   235 		$pending_text = '';
   235 	}
   236 	}
   236 	*/
   237 	*/
   237 
   238 
   238 	// Total Comments
   239 	// Total Comments
   239 	$num = number_format_i18n($num_comm->total_comments);
   240 	$num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>';
   240 	$text = _n( 'Comment', 'Comments', $num_comm->total_comments );
   241 	$text = _n( 'Comment', 'Comments', $num_comm->total_comments );
   241 	if ( current_user_can( 'moderate_comments' ) ) {
   242 	if ( current_user_can( 'moderate_comments' ) ) {
   242 		$num = "<a href='edit-comments.php'>$num</a>";
   243 		$num = "<a href='edit-comments.php'>$num</a>";
   243 		$text = "<a href='edit-comments.php'>$text</a>";
   244 		$text = "<a href='edit-comments.php'>$text</a>";
   244 	}
   245 	}
   256 	}
   257 	}
   257 	echo '<td class="first b b_pages">' . $num . '</td>';
   258 	echo '<td class="first b b_pages">' . $num . '</td>';
   258 	echo '<td class="t pages">' . $text . '</td>';
   259 	echo '<td class="t pages">' . $text . '</td>';
   259 
   260 
   260 	// Approved Comments
   261 	// Approved Comments
   261 	$num = number_format_i18n($num_comm->approved);
   262 	$num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>';
   262 	$text = _nc( 'Approved|Right Now', 'Approved', $num_comm->approved );
   263 	$text = _nc( 'Approved|Right Now', 'Approved', $num_comm->approved );
   263 	if ( current_user_can( 'moderate_comments' ) ) {
   264 	if ( current_user_can( 'moderate_comments' ) ) {
   264 		$num = "<a href='edit-comments.php?comment_status=approved'>$num</a>";
   265 		$num = "<a href='edit-comments.php?comment_status=approved'>$num</a>";
   265 		$text = "<a class='approved' href='edit-comments.php?comment_status=approved'>$text</a>";
   266 		$text = "<a class='approved' href='edit-comments.php?comment_status=approved'>$text</a>";
   266 	}
   267 	}
   278 	}
   279 	}
   279 	echo '<td class="first b b-cats">' . $num . '</td>';
   280 	echo '<td class="first b b-cats">' . $num . '</td>';
   280 	echo '<td class="t cats">' . $text . '</td>';
   281 	echo '<td class="t cats">' . $text . '</td>';
   281 
   282 
   282 	// Pending Comments
   283 	// Pending Comments
   283 	$num = number_format_i18n($num_comm->moderated);
   284 	$num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>';
   284 	$text = _n( 'Pending', 'Pending', $num_comm->moderated );
   285 	$text = _n( 'Pending', 'Pending', $num_comm->moderated );
   285 	if ( current_user_can( 'moderate_comments' ) ) {
   286 	if ( current_user_can( 'moderate_comments' ) ) {
   286 		$num = "<a href='edit-comments.php?comment_status=moderated'><span class='pending-count'>$num</span></a>";
   287 		$num = "<a href='edit-comments.php?comment_status=moderated'>$num</a>";
   287 		$text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>$text</a>";
   288 		$text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>$text</a>";
   288 	}
   289 	}
   289 	echo '<td class="b b-waiting">' . $num . '</td>';
   290 	echo '<td class="b b-waiting">' . $num . '</td>';
   290 	echo '<td class="last t">' . $text . '</td>';
   291 	echo '<td class="last t">' . $text . '</td>';
   291 
   292 
   337 			printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
   338 			printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
   338 		}
   339 		}
   339 	} else {
   340 	} else {
   340 		if ( current_user_can( 'switch_themes' ) ) {
   341 		if ( current_user_can( 'switch_themes' ) ) {
   341 			echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
   342 			echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
   342 			printf('Theme <span class="b"><a href="themes.php">%1$s</a></span>', $ct->title);
   343 			printf( __('Theme <span class="b"><a href="themes.php">%1$s</a></span>'), $ct->title );
   343 		} else {
   344 		} else {
   344 			printf('Theme <span class="b">%1$s</span>', $ct->title);
   345 			printf( __('Theme <span class="b">%1$s</span>'), $ct->title );
   345 		}
   346 		}
   346 	}
   347 	}
   347 	echo '</p>';
   348 	echo '</p>';
   348 
   349 
   349 	update_right_now_message();
   350 	update_right_now_message();
   445 	if ( $drafts && is_array( $drafts ) ) {
   446 	if ( $drafts && is_array( $drafts ) ) {
   446 		$list = array();
   447 		$list = array();
   447 		foreach ( $drafts as $draft ) {
   448 		foreach ( $drafts as $draft ) {
   448 			$url = get_edit_post_link( $draft->ID );
   449 			$url = get_edit_post_link( $draft->ID );
   449 			$title = _draft_or_post_title( $draft->ID );
   450 			$title = _draft_or_post_title( $draft->ID );
   450 			$item = "<h4><a href='$url' title='" . sprintf( __( 'Edit &#8220;%s&#8221;' ), esc_attr( $title ) ) . "'>$title</a> <abbr title='" . get_the_time(__('Y/m/d g:i:s A'), $draft) . "'>" . get_the_time( get_option( 'date_format' ), $draft ) . '</abbr></h4>';
   451 			$item = "<h4><a href='$url' title='" . sprintf( __( 'Edit &#8220;%s&#8221;' ), esc_attr( $title ) ) . "'>" . esc_html($title) . "</a> <abbr title='" . get_the_time(__('Y/m/d g:i:s A'), $draft) . "'>" . get_the_time( get_option( 'date_format' ), $draft ) . '</abbr></h4>';
   451 			if ( $the_content = preg_split( '#\s#', strip_tags( $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) )
   452 			if ( $the_content = preg_split( '#\s#', strip_tags( $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) )
   452 				$item .= '<p>' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '&hellip;' : '' ) . '</p>';
   453 				$item .= '<p>' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '&hellip;' : '' ) . '</p>';
   453 			$list[] = $item;
   454 			$list[] = $item;
   454 		}
   455 		}
   455 ?>
   456 ?>
   478 
   479 
   479 	// Select all comment types and filter out spam later for better query performance.
   480 	// Select all comment types and filter out spam later for better query performance.
   480 	$comments = array();
   481 	$comments = array();
   481 	$start = 0;
   482 	$start = 0;
   482 
   483 
   483 	while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT $start, 50" ) ) {
   484 	while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {
   484 
   485 
   485 		foreach ( $possible as $comment ) {
   486 		foreach ( $possible as $comment ) {
   486 			if ( count( $comments ) >= 5 )
   487 			if ( count( $comments ) >= 5 )
   487 				break;
   488 				break;
   488 			if ( in_array( $comment->comment_approved, $allowed_states ) )
   489 			if ( in_array( $comment->comment_approved, $allowed_states ) )
   507 		if ( current_user_can('edit_posts') ) { ?>
   508 		if ( current_user_can('edit_posts') ) { ?>
   508 			<p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?></a></p>
   509 			<p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?></a></p>
   509 <?php	}
   510 <?php	}
   510 
   511 
   511 		wp_comment_reply( -1, false, 'dashboard', false );
   512 		wp_comment_reply( -1, false, 'dashboard', false );
       
   513 		wp_comment_trashnotice();
   512 
   514 
   513 	else :
   515 	else :
   514 ?>
   516 ?>
   515 
   517 
   516 	<p><?php _e( 'No comments yet.' ); ?></p>
   518 	<p><?php _e( 'No comments yet.' ); ?></p>
   525 	$comment_post_url = get_edit_post_link( $comment->comment_post_ID );
   527 	$comment_post_url = get_edit_post_link( $comment->comment_post_ID );
   526 	$comment_post_title = strip_tags(get_the_title( $comment->comment_post_ID ));
   528 	$comment_post_title = strip_tags(get_the_title( $comment->comment_post_ID ));
   527 	$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
   529 	$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
   528 	$comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
   530 	$comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
   529 
   531 
   530 	$delete_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
       
   531 	$approve_url = esc_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
       
   532 	$unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
       
   533 	$spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
       
   534 
       
   535 	$actions = array();
       
   536 
       
   537 	$actions_string = '';
   532 	$actions_string = '';
   538 	if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
   533 	if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
       
   534 		// preorder it: Approve | Reply | Edit | Spam | Trash
       
   535 		$actions = array(
       
   536 			'approve' => '', 'unapprove' => '',
       
   537 			'reply' => '',
       
   538 			'edit' => '',
       
   539 			'spam' => '',
       
   540 			'trash' => '', 'delete' => ''
       
   541 		);
       
   542 
       
   543 		$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
       
   544 		$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
       
   545 
       
   546 		$approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
       
   547 		$unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
       
   548 		$spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
       
   549 		$trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
       
   550 		$delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
       
   551 
   539 		$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
   552 		$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
   540 		$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
   553 		$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
   541 		$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
   554 		$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
   542 		//$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
       
   543 		$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
   555 		$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
   544 		$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */  _x( 'Spam', 'verb' ) . '</a>';
   556 		$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */  _x( 'Spam', 'verb' ) . '</a>';
   545 		$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
   557 		if ( !EMPTY_TRASH_DAYS )
   546 
   558 			$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
   547 		$actions = apply_filters( 'comment_row_actions', $actions, $comment );
   559 		else
       
   560 			$actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
       
   561 
       
   562 		$actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
   548 
   563 
   549 		$i = 0;
   564 		$i = 0;
   550 		foreach ( $actions as $action => $link ) {
   565 		foreach ( $actions as $action => $link ) {
   551 			++$i;
   566 			++$i;
   552 			( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
   567 			( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
   565 			<?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
   580 			<?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
   566 
   581 
   567 			<?php echo get_avatar( $comment, 50 ); ?>
   582 			<?php echo get_avatar( $comment, 50 ); ?>
   568 
   583 
   569 			<div class="dashboard-comment-wrap">
   584 			<div class="dashboard-comment-wrap">
   570 			<h4 class="comment-meta"><?php printf( __( 'From %1$s on %2$s%3$s' ), '<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link." ".$comment_link, ' <span class="approve">' . __( '[Pending]' ) . '</span>' ); ?></h4>
   585 			<h4 class="comment-meta"><?php printf( __( 'From %1$s on %2$s%3$s' ), '<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link.' '.$comment_link, ' <span class="approve">' . __( '[Pending]' ) . '</span>' ); ?></h4>
   571 
   586 
   572 			<?php
   587 			<?php
   573 			else :
   588 			else :
   574 				switch ( $comment->comment_type ) :
   589 				switch ( $comment->comment_type ) :
   575 				case 'pingback' :
   590 				case 'pingback' :
   583 				endswitch;
   598 				endswitch;
   584 				$type = esc_html( $type );
   599 				$type = esc_html( $type );
   585 			?>
   600 			?>
   586 			<div class="dashboard-comment-wrap">
   601 			<div class="dashboard-comment-wrap">
   587 			<?php /* translators: %1$s is type of comment, %2$s is link to the post */ ?>
   602 			<?php /* translators: %1$s is type of comment, %2$s is link to the post */ ?>
   588 			<h4 class="comment-meta"><?php printf( _x( '%1$s on %2$s', 'dashboard' ), "<strong>$type</strong>", $comment_post_link ); ?></h4>
   603 			<h4 class="comment-meta"><?php printf( _x( '%1$s on %2$s', 'dashboard' ), "<strong>$type</strong>", $comment_post_link." ".$comment_link ); ?></h4>
   589 			<p class="comment-author"><?php comment_author_link(); ?></p>
   604 			<p class="comment-author"><?php comment_author_link(); ?></p>
   590 
   605 
   591 			<?php endif; // comment_type ?>
   606 			<?php endif; // comment_type ?>
   592 			<blockquote><p><?php comment_excerpt(); ?></p></blockquote>
   607 			<blockquote><p><?php comment_excerpt(); ?></p></blockquote>
   593 			<p class="row-actions"><?php echo $actions_string; ?></p>
   608 			<p class="row-actions"><?php echo $actions_string; ?></p>
   594 
       
   595 			<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
       
   596 				<textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea>
       
   597 				<div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
       
   598 				<div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
       
   599 				<div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
       
   600 				<div class="comment_status"><?php echo $comment->comment_approved; ?></div>
       
   601 			</div>
       
   602 			</div>
   609 			</div>
   603 		</div>
   610 		</div>
   604 <?php
   611 <?php
   605 }
   612 }
   606 
   613 
   627 		return;
   634 		return;
   628 	}
   635 	}
   629 
   636 
   630 	if ( !$rss->get_item_quantity() ) {
   637 	if ( !$rss->get_item_quantity() ) {
   631 		echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
   638 		echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
       
   639 		$rss->__destruct(); 
       
   640 		unset($rss);
   632 		return;
   641 		return;
   633 	}
   642 	}
   634 
   643 
   635 	echo "<ul>\n";
   644 	echo "<ul>\n";
   636 
   645 
   680 
   689 
   681 		echo "\t<li>" . sprintf( $text, $publisher, $link, $content, $date ) . "</li>\n";
   690 		echo "\t<li>" . sprintf( $text, $publisher, $link, $content, $date ) . "</li>\n";
   682 	}
   691 	}
   683 
   692 
   684 	echo "</ul>\n";
   693 	echo "</ul>\n";
   685 
   694 	$rss->__destruct(); 
       
   695 	unset($rss);
   686 }
   696 }
   687 
   697 
   688 function wp_dashboard_incoming_links_control() {
   698 function wp_dashboard_incoming_links_control() {
   689 	wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) );
   699 	wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) );
   690 }
   700 }
   704  *
   714  *
   705  * @param int $widget_id
   715  * @param int $widget_id
   706  */
   716  */
   707 function wp_dashboard_rss_output( $widget_id ) {
   717 function wp_dashboard_rss_output( $widget_id ) {
   708 	$widgets = get_option( 'dashboard_widget_options' );
   718 	$widgets = get_option( 'dashboard_widget_options' );
   709 	echo "<div class='rss-widget'>";
   719 	echo '<div class="rss-widget">';
   710 	wp_widget_rss_output( $widgets[$widget_id] );
   720 	wp_widget_rss_output( $widgets[$widget_id] );
   711 	echo "</div>";
   721 	echo "</div>";
   712 }
   722 }
   713 
   723 
   714 function wp_dashboard_secondary() {
   724 function wp_dashboard_secondary() {
   736 			echo '<div class="rss-widget"><p>';
   746 			echo '<div class="rss-widget"><p>';
   737 			printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
   747 			printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
   738 			echo '</p></div>';
   748 			echo '</p></div>';
   739 		}
   749 		}
   740 	} elseif ( !$rss->get_item_quantity() ) {
   750 	} elseif ( !$rss->get_item_quantity() ) {
       
   751 		$rss->__destruct(); 
       
   752 		unset($rss);
   741 		return false;
   753 		return false;
   742 	} else {
   754 	} else {
   743 		echo '<div class="rss-widget">';
   755 		echo '<div class="rss-widget">';
   744 		wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
   756 		wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
   745 		echo '</div>';
   757 		echo '</div>';
       
   758 		$rss->__destruct(); 
       
   759 		unset($rss);
   746 	}
   760 	}
   747 }
   761 }
   748 
   762 
   749 function wp_dashboard_plugins() {
   763 function wp_dashboard_plugins() {
   750 	echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
   764 	echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
   823 							'&amp;TB_iframe=true&amp;width=600&amp;height=800';
   837 							'&amp;TB_iframe=true&amp;width=600&amp;height=800';
   824 
   838 
   825 		echo "<h4>$label</h4>\n";
   839 		echo "<h4>$label</h4>\n";
   826 		echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n";
   840 		echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n";
   827 		echo "<p>$description</p>\n";
   841 		echo "<p>$description</p>\n";
       
   842 		
       
   843 		$$feed->__destruct();
       
   844 		unset($$feed);
   828 	}
   845 	}
   829 }
   846 }
   830 
   847 
   831 /**
   848 /**
   832  * Checks to see if all of the feed url in $check_urls are cached.
   849  * Checks to see if all of the feed url in $check_urls are cached.
   916 		$_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] );
   933 		$_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] );
   917 		$widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
   934 		$widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
   918 		// title is optional.  If black, fill it if possible
   935 		// title is optional.  If black, fill it if possible
   919 		if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
   936 		if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
   920 			$rss = fetch_feed($widget_options[$widget_id]['url']);
   937 			$rss = fetch_feed($widget_options[$widget_id]['url']);
   921 			if ( ! is_wp_error($rss) )
   938 			if ( is_wp_error($rss) ) {
   922 				$widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
       
   923 			else
       
   924 				$widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
   939 				$widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
       
   940 			} else {
       
   941 				$widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));	
       
   942 				$rss->__destruct();
       
   943 				unset($rss);				
       
   944 			}
   925 		}
   945 		}
   926 		update_option( 'dashboard_widget_options', $widget_options );
   946 		update_option( 'dashboard_widget_options', $widget_options );
   927 	}
   947 	}
   928 
   948 
   929 	wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
   949 	wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );