Ticket #23396: only-compare-to-current.diff
File only-compare-to-current.diff, 12.6 KB (added by , 12 years ago) |
---|
-
wp-includes/post-template.php
1371 1371 } 1372 1372 1373 1373 /* translators: post revision: 1: when, 2: author name */ 1374 $titlef = _x( ' %1$s by%2$s', 'post revision' );1374 $titlef = _x( '<strong>%1$s:</strong> %2$s', 'post revision' ); 1375 1375 1376 1376 if ( $parent ) 1377 1377 array_unshift( $revisions, $post ); … … 1385 1385 if ( 'revision' === $type && wp_is_post_autosave( $revision ) ) 1386 1386 continue; 1387 1387 1388 $date = wp_post_revision_title( $revision );1388 $date = wp_post_revision_title( $revision, false ); 1389 1389 $name = get_the_author_meta( 'display_name', $revision->post_author ); 1390 1390 $editlink = '<a href="' . get_edit_post_link( $revision->ID ) . '">' . __( 'View' ) . '</a>'; 1391 1391 if ( 'form-table' == $format ) { 1392 1392 if ( $left ) 1393 1393 $left_checked = $left == $revision->ID ? ' checked="checked"' : ''; … … 1398 1398 $class = $class ? '' : " class='alternate'"; 1399 1399 1400 1400 if ( $post->ID != $revision->ID && $can_edit_post ) 1401 $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>'; 1401 $actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>'. 1402 ' · ' . $editlink . 1403 ' · <a href="' . 'revision.php?action=diff&right=' . $post->ID .'&left=' . $revision->ID . '">' . __( 'Compare to' ) . '</a>'; 1404 1405 1402 1406 else 1403 1407 $actions = ''; 1404 1408 1409 $avatar = get_avatar( $revision->post_author, 24 ); 1405 1410 $rows .= "<tr$class>\n"; 1406 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /></th>\n"; 1407 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n"; 1408 $rows .= "\t<td>$date</td>\n"; 1409 $rows .= "\t<td>$name</td>\n"; 1410 $rows .= "\t<td class='action-links'>$actions</td>\n"; 1411 $rows .= "\t<td class='revision-details'>$avatar <strong>$name</strong></td>\n"; 1412 $rows .= "\t<td class='revision-details'>$date<br />$actions</td>\n"; 1411 1413 $rows .= "</tr>\n"; 1412 1414 } else { 1413 $title = sprintf( $titlef, $date, $name ); 1414 $rows .= "\t<li>$title</li>\n"; 1415 $avatar = get_avatar( $revision->post_author, 18 ); 1416 $title = sprintf( $titlef, $name, $date ); 1417 $rows .= "\t<li>$avatar $title $editlink</li>\n"; 1415 1418 } 1416 1419 } 1417 1420 … … 1432 1435 <table class="widefat post-revisions" cellspacing="0" id="post-revisions"> 1433 1436 <col /> 1434 1437 <col /> 1435 <col style="width: 33%" />1436 <col style="width: 33%" />1437 <col style="width: 33%" />1438 1438 <thead> 1439 1439 <tr> 1440 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'Old', 'revisions column name' ); ?></th> 1441 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'New', 'revisions column name' ); ?></th> 1442 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'Date Created', 'revisions column name' ); ?></th> 1443 <th scope="col"><?php _e( 'Author' ); ?></th> 1444 <th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th> 1440 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'Author', 'author column name' ); ?></th> 1441 <th scope="col"><?php /* translators: column name in revisions */ _ex( 'Revisions', 'revisions column name' ); ?></th> 1445 1442 </tr> 1446 1443 </thead> 1447 1444 <tbody> -
wp-includes/wp-diff.php
98 98 * @return string 99 99 */ 100 100 function addedLine( $line ) { 101 return "<td> +</td><td class='diff-addedline'>{$line}</td>";101 return "<td><div class='diff-addedline-leftcol'>{$line}</div></td><td class='ltype'><div class='diff-addedline'>" . __("Added") . "</div></td>"; 102 102 } 103 103 104 104 /** … … 108 108 * @return string 109 109 */ 110 110 function deletedLine( $line ) { 111 return "<td> -</td><td class='diff-deletedline'>{$line}</td>";111 return "<td><div class='diff-deletedline-leftcol'>{$line}</div></td><td class='ltype'><div class='diff-deletedline'>" . __( "Removed" ) . "</div></td>"; 112 112 } 113 113 114 114 /** … … 118 118 * @return string 119 119 */ 120 120 function contextLine( $line ) { 121 return "<td> </td><td class='diff-context'>{$line}</td>";121 return "<td><div class='diff-context'>{$line}</div></td>"; 122 122 } 123 123 124 124 /** … … 127 127 * @return string 128 128 */ 129 129 function emptyLine() { 130 return '<td c olspan="2"> </td>';130 return '<td class="ltype"> </td>'; 131 131 } 132 132 133 133 /** … … 142 142 $r = ''; 143 143 foreach ($lines as $line) { 144 144 if ( $encode ) 145 $line = htmlspecialchars( $line );146 $r .= '<tr>' . $this-> emptyLine() . $this->addedLine( $line ) . "</tr>\n";145 $line = wp_kses_post( $line ); 146 $r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n"; 147 147 } 148 148 return $r; 149 149 } … … 160 160 $r = ''; 161 161 foreach ($lines as $line) { 162 162 if ( $encode ) 163 $line = htmlspecialchars( $line );164 $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() ."</tr>\n";163 $line = wp_kses_post( $line ); 164 $r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n"; 165 165 } 166 166 return $r; 167 167 } … … 178 178 $r = ''; 179 179 foreach ($lines as $line) { 180 180 if ( $encode ) 181 $line = htmlspecialchars( $line );181 $line = wp_kses_post( $line ); 182 182 $r .= '<tr>' . 183 $this->contextLine( $line ) . $this-> contextLine( $line) . "</tr>\n";183 $this->contextLine( $line ) . $this->emptyLine() . "</tr>\n"; 184 184 } 185 185 return $r; 186 186 } … … 248 248 if ( isset( $orig_diffs[$orig_rows[$row]] ) ) 249 249 $orig_line = $orig_diffs[$orig_rows[$row]]; 250 250 elseif ( isset( $orig[$orig_rows[$row]] ) ) 251 $orig_line = htmlspecialchars($orig[$orig_rows[$row]]);251 $orig_line = wp_kses_post($orig[$orig_rows[$row]]); 252 252 else 253 253 $orig_line = ''; 254 254 255 255 if ( isset( $final_diffs[$final_rows[$row]] ) ) 256 256 $final_line = $final_diffs[$final_rows[$row]]; 257 257 elseif ( isset( $final[$final_rows[$row]] ) ) 258 $final_line = htmlspecialchars($final[$final_rows[$row]]);258 $final_line = wp_kses_post($final[$final_rows[$row]]); 259 259 else 260 260 $final_line = ''; 261 261 … … 264 264 } elseif ( $final_rows[$row] < 0 ) { // Final is blank. This is really a deleted row. 265 265 $r .= $this->_deleted( array($orig_line), false ); 266 266 } else { // A true changed row. 267 $r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->addedLine( $final_line ) . "</tr>\n";267 $r .= '<tr>' . $this->deletedLine( $orig_line ) . '</tr><tr>' . $this->addedLine( $final_line ) . "</tr>\n"; 268 268 } 269 269 } 270 270 -
wp-includes/Text/Diff/Renderer/inline.php
200 200 201 201 function _encode(&$string) 202 202 { 203 $string = htmlspecialchars($string);203 $string = wp_kses_post($string); 204 204 } 205 205 206 206 } -
wp-includes/pluggable.php
1722 1722 return ''; 1723 1723 1724 1724 $r = "<table class='diff'>\n"; 1725 $r .= "<col class=' ltype' /><col class='content' /><col class='ltype' /><col class='content' />";1725 $r .= "<col class='content' /><col class='ltype' />"; 1726 1726 1727 1727 if ( $args['title'] || $args['title_left'] || $args['title_right'] ) 1728 1728 $r .= "<thead>"; 1729 1729 if ( $args['title'] ) 1730 $r .= "<tr class='diff-title'><th colspan=' 4'>$args[title]</th></tr>\n";1730 $r .= "<tr class='diff-title'><th colspan='3'>$args[title]</th></tr>\n"; 1731 1731 if ( $args['title_left'] || $args['title_right'] ) { 1732 1732 $r .= "<tr class='diff-sub-title'>\n"; 1733 $r .= "\t<t d></td><th>$args[title_left]</th>\n";1734 $r .= "\t<t d></td><th>$args[title_right]</th>\n";1733 $r .= "\t<th>$args[title_left]</th>\n"; 1734 $r .= "\t<th>$args[title_right]</th>\n"; 1735 1735 $r .= "</tr>\n"; 1736 1736 } 1737 1737 if ( $args['title'] || $args['title_left'] || $args['title_right'] ) -
wp-admin/revision.php
153 153 154 154 <h2 class="long-header"><?php echo $h2; ?></h2> 155 155 156 <table class="form-table ie-fixed ">156 <table class="form-table ie-fixed revision-compare"> 157 157 <col class="th" /> 158 158 <?php if ( 'diff' == $action ) : ?> 159 159 <tr id="revision"> 160 <th scope="row"></th>161 160 <th scope="col" class="th-full"> 162 <span class="alignleft"><?php printf( __('Older: %s'), wp_post_revision_title( $left_revision ) ); ?></span> 163 <span class="alignright"><?php printf( __('Newer: %s'), wp_post_revision_title( $right_revision ) ); ?></span> 161 <span class="revision-details"><?php 162 _e('<strong>Comparing from the current version of the post.</strong><br />'); 163 ?> 164 <span class="revision-details" ><?php 165 printf( __('<strong>Comparing to revision dated </strong> %s, created by: '), wp_post_revision_title( $left_revision ) ); 166 echo get_avatar( $left_revision->post_author, 18 ) . get_the_author_meta( 'display_name', $left_revision->post_author ); 167 ?> 168 </span> <br /> 169 164 170 </th> 165 171 </tr> 166 172 <?php endif; … … 175 181 continue; // There is no difference between left and right 176 182 $identical = false; 177 183 } else { 178 add_filter( "_wp_post_revision_field_$field", ' htmlspecialchars' );184 add_filter( "_wp_post_revision_field_$field", 'wp_kses_post' ); 179 185 $content = apply_filters( "_wp_post_revision_field_$field", $revision->$field, $field ); 180 186 } 181 187 ?> 182 188 183 189 <tr id="revision-field-<?php echo $field; ?>"> 184 <th scope="row"><?php echo esc_html( $field_title ); ?></th>185 190 <td><div class="pre"><?php echo $content; ?></div></td> 186 191 </tr> 187 192 … … 203 208 204 209 </table> 205 210 206 <br class="clear" /> 207 211 <div id="revisions-detail-list"> 208 212 <h3><?php echo $title; ?></h3> 209 213 210 214 <?php … … 216 220 wp_list_post_revisions( $post, $args ); 217 221 218 222 ?> 219 220 223 </div> 224 </div> 221 225 222 226 <?php 223 227 require_once( './admin-footer.php' ); -
wp-admin/css/colors-fresh.css
1350 1350 1351 1351 /* Diff */ 1352 1352 table.diff .diff-deletedline { 1353 background-color: #fdd; 1353 background-color: #c33; 1354 padding:10px; 1355 margin:2px; 1356 -webkit-border-radius: 5px; 1357 border-radius: 5px; 1358 color: #fff; 1359 text-align: center; 1354 1360 } 1361 table.diff .diff-deletedline-leftcol { 1362 border: #c33 dotted 2px; 1363 padding:10px; 1364 margin:2px; 1365 -webkit-border-radius: 5px; 1366 border-radius: 5px; 1367 text-decoration: line-through; 1368 } 1355 1369 1370 table.diff .diff-context { 1371 padding:10px; 1372 margin:2px; 1373 -webkit-border-radius: 5px; 1374 border-radius: 5px; 1375 } 1376 1377 table.diff .diff-context:hover { 1378 background-color: #FFE; 1379 } 1380 1356 1381 table.diff .diff-deletedline del { 1357 background-color: #f 99;1382 background-color: #f33; 1358 1383 } 1359 1384 1360 1385 table.diff .diff-addedline { 1361 background-color: #dfd; 1386 background-color: #3a3; 1387 padding:10px; 1388 margin:2px; 1389 -webkit-border-radius: 5px; 1390 border-radius: 5px; 1391 color: #fff; 1392 text-align: center; 1362 1393 } 1363 1394 1395 table.diff .diff-addedline-leftcol { 1396 border: #3a3 dotted 2px; 1397 padding:10px; 1398 margin:2px; 1399 -webkit-border-radius: 5px; 1400 border-radius: 5px; 1401 } 1402 1364 1403 table.diff .diff-addedline ins { 1365 background-color: # 9f9;1404 background-color: #3f3; 1366 1405 } 1367 1406 1368 1407 #att-info { -
wp-admin/css/wp-admin.css
3436 3436 } 3437 3437 3438 3438 table.diff col.content { 3439 width: 50%;3439 width: auto; 3440 3440 } 3441 3441 3442 3442 table.diff tr { … … 8585 8585 .locale-lt-lt .inline-edit-row fieldset label span.input-text-wrap { 8586 8586 margin-left: 8em; 8587 8587 } 8588 ul.post-revisions img { 8589 float: left; 8590 margin: 2px; 8591 } 8592 ul.post-revisions li { 8593 border-bottom: 1px solid #FFF; 8594 } 8595 ul.post-revisions li a { 8596 line-height: 24px; 8597 } 8598 table#post-revisions tr td.revision-details, span.revision-details { 8599 line-height: 16px; 8600 padding: 0; 8601 height: 30px; 8602 vertical-align: middle;; 8603 } 8604 .form-table #revision th{ 8605 padding-left: 28px; 8606 } 8607 table#post-revisions tr td img { 8608 float: left; 8609 margin: 4px; 8610 } 8611 span.revision-details img { 8612 margin: 1px; 8613 vertical-align: middle; 8614 } 8615 .diff .ltype { 8616 width: 100px; 8617 } 8618 tr#revision-field-post_title td div { 8619 font-size: 150%; 8620 font-weight: bold; 8621 } 8622 @media screen and (min-width: 1200px) { 8623 .revision-compare { 8624 float: right; 8625 width: 70%; 8626 } 8627 #revisions-detail-list { 8628 float: left; 8629 width: 30%; 8630 } 8631 } 8632 No newline at end of file