Ticket #23396: version-4.2.diff
File version-4.2.diff, 17.1 KB (added by , 12 years ago) |
---|
-
wp-includes/post-template.php
1301 1301 return false; 1302 1302 1303 1303 /* translators: revision date format, see http://php.net/date */ 1304 $datef = _x( ' j F, Y @ G:i', 'revision date format');1304 $datef = _x( 'D, M jS @ G:i a', 'revision date format' ); 1305 1305 /* translators: 1: date */ 1306 1306 $autosavef = __( '%1$s [Autosave]' ); 1307 1307 /* translators: 1: date */ 1308 1308 $currentf = __( '%1$s [Current Revision]' ); 1309 1309 1310 $author = get_the_author_meta( 'display_name', $revision->post_author ); 1311 1310 1312 $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); 1311 1313 if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) 1312 $date = "<a href='$link'>$ date</a>";1314 $date = "<a href='$link'>$author : $date</a>"; 1313 1315 1314 1316 if ( !wp_is_post_revision( $revision ) ) 1315 1317 $date = sprintf( $currentf, $date ); … … 1386 1388 continue; 1387 1389 1388 1390 $date = wp_post_revision_title( $revision ); 1389 $name = get_the_author_meta( 'display_name', $revision->post_author ); 1391 $datelinktodiff = sprintf( '<a href="revision.php?action=diff&post_type=post&left=%d&right=%d">%s</a>', 1392 $revision->ID, $post->ID, wp_post_revision_title( $revision, false ) ); 1390 1393 1394 $name = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor.'; 1395 $avatar = get_avatar( $revision->post_author, 22 ); 1391 1396 if ( 'form-table' == $format ) { 1392 if ( $left )1393 $left_checked = $left == $revision->ID ? ' checked="checked"' : '';1394 else1395 $left_checked = $right_checked ? ' checked="checked"' : ''; // [sic] (the next one)1396 $right_checked = $right == $revision->ID ? ' checked="checked"' : '';1397 1397 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 1402 else 1403 1403 $actions = ''; 1404 1404 1405 1405 $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"; 1406 $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='checkbox' name='revisionstocompare[]' value='$revision->ID' /></th>\n"; 1407 $rows .= "\t<td>$avatar $date</td>\n"; 1409 1408 $rows .= "\t<td>$name</td>\n"; 1410 $rows .= "\t<td class='action-links'>$actions</td>\n";1411 1409 $rows .= "</tr>\n"; 1412 1410 } else { 1413 $title = sprintf( $titlef, $date , $name );1411 $title = sprintf( $titlef, $datelinktodiff, $name ); 1414 1412 $rows .= "\t<li>$title</li>\n"; 1415 1413 } 1416 1414 } 1417 1415 1418 1416 if ( 'form-table' == $format ) : ?> 1419 1420 <form action="revision.php" method="get"> 1421 1417 <form action="revision.php" method="get" id='revision-list-form'> 1418 <hr /> 1422 1419 <div class="tablenav"> 1423 <div class="alignleft"> 1424 <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Compare Revisions' ); ?>" /> 1420 <div class='revision-post-list-title'><?php _e( 'Pick two revisions to compare' ) ?></div> 1421 <div class="alignright"> 1422 <input type="submit" class="button-secondary compare-revisions no-js" value="<?php esc_attr_e( 'Compare Revisions' ); ?>" /> 1425 1423 <input type="hidden" name="action" value="diff" /> 1426 1424 <input type="hidden" name="post_type" value="<?php echo esc_attr($post->post_type); ?>" /> 1427 1425 </div> 1428 1426 </div> 1429 1427 1430 <br class="clear" />1431 1432 1428 <table class="widefat post-revisions" cellspacing="0" id="post-revisions"> 1433 1429 <col /> 1434 <col /> 1435 <col style="width: 33%" /> 1436 <col style="width: 33%" /> 1437 <col style="width: 33%" /> 1438 <thead> 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> 1445 </tr> 1446 </thead> 1430 <col style="width: 40%" /> 1431 <col style="width: 59%" /> 1447 1432 <tbody> 1448 1433 1449 1434 <?php echo $rows; ?> -
wp-includes/js/wp-list-revisions.js
6 6 var i, checkCount = 0, side; 7 7 for ( i = 0; i < inputs.length; i++ ) { 8 8 checkCount += inputs[i].checked ? 1 : 0; 9 side = inputs[i].getAttribute('name');10 if ( ! inputs[i].checked &&11 ( 'left' == side && 1 > checkCount || 'right' == side && 1 < checkCount && ( ! inputs[i-1] || ! inputs[i-1].checked ) ) &&12 ! ( inputs[i+1] && inputs[i+1].checked && 'right' == inputs[i+1].getAttribute('name') ) )13 inputs[i].style.visibility = 'hidden';14 else if ( 'left' == side || 'right' == side )15 inputs[i].style.visibility = 'visible';16 9 } 10 11 if ( 2 == checkCount ) { 12 document.getElementById('revision-list-form').submit(); 13 } 14 17 15 } 18 16 pr.onclick(); 19 17 } -
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 class='diff-addedline-indicator'>+</td><td class='diff-addedline'>{$line}</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 class='diff-deletedline-indicator'>-</td><td class='diff-deletedline'>{$line}</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 class='context-indicator'></td><td class='diff-context'>{$line}</td>"; 122 122 } 123 123 124 124 /** … … 142 142 $r = ''; 143 143 foreach ($lines as $line) { 144 144 if ( $encode ) 145 $line = htmlspecialchars( $line );145 $line = wp_kses_post( $line ); 146 146 $r .= '<tr>' . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n"; 147 147 } 148 148 return $r; … … 160 160 $r = ''; 161 161 foreach ($lines as $line) { 162 162 if ( $encode ) 163 $line = htmlspecialchars( $line );163 $line = ( $line ); 164 164 $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . "</tr>\n"; 165 165 } 166 166 return $r; … … 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 183 $this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n"; 184 184 } … … 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 -
wp-includes/pluggable.php
1743 1743 return $r; 1744 1744 } 1745 1745 endif; 1746 function wp_text_diff_with_count( $left_string, $right_string, $args = null ) { 1747 $defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' ); 1748 $args = wp_parse_args( $args, $defaults ); 1749 1750 if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) ) 1751 require( ABSPATH . WPINC . '/wp-diff.php' ); 1752 1753 $left_string = normalize_whitespace( $left_string ); 1754 $right_string = normalize_whitespace( $right_string ); 1755 1756 $left_lines = explode( "\n", $left_string ); 1757 $right_lines = explode( "\n", $right_string) ; 1758 1759 $text_diff = new Text_Diff($left_lines, $right_lines ); 1760 $linesadded = $text_diff->countAddedLines(); 1761 $linesdeleted = $text_diff->countDeletedLines(); 1762 1763 $renderer = new WP_Text_Diff_Renderer_Table(); 1764 $diff = $renderer->render( $text_diff ); 1765 1766 if ( !$diff ) 1767 return ''; 1768 1769 $r = "<table class='diff'>\n"; 1770 $r .= "<col class='ltype' /><col class='content' /><col class='ltype' /><col class='content' />"; 1771 1772 if ( $args['title'] || $args['title_left'] || $args['title_right'] ) 1773 $r .= "<thead>"; 1774 if ( $args['title'] ) 1775 $r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n"; 1776 if ( $args['title_left'] || $args['title_right'] ) { 1777 $r .= "<tr class='diff-sub-title'>\n"; 1778 $r .= "\t<td id=\"left\"></td><th>$args[title_left]</th>\n"; 1779 $r .= "\t<td id=\"right\"></td><th>$args[title_right]</th>\n"; 1780 $r .= "</tr>\n"; 1781 } 1782 if ( $args['title'] || $args['title_left'] || $args['title_right'] ) 1783 $r .= "</thead>\n"; 1784 1785 $r .= "<tbody>\n$diff\n</tbody>\n"; 1786 $r .= "</table>"; 1787 1788 return array( 'html' => $r, 'linesadded' => $linesadded, 'linesdeleted' => $linesdeleted ); 1789 } 1790 No newline at end of file -
wp-admin/revision.php
11 11 12 12 wp_enqueue_script('list-revisions'); 13 13 14 wp_reset_vars( array('revision', 'left', 'right', 'action'));14 wp_reset_vars( array( 'revision', 'left', 'right', 'action' ) ); 15 15 16 16 $revision_id = absint($revision); 17 17 $left = absint($left); … … 19 19 20 20 $redirect = 'edit.php'; 21 21 22 if ( isset( $_GET['revisionstocompare'] ) ) { 23 $revisionstocompare = $_GET['revisionstocompare']; 24 $left = absint( $revisionstocompare[1] ); 25 $right = absint( $revisionstocompare[0] ); 26 } 27 28 22 29 switch ( $action ) : 23 30 case 'restore' : 24 31 if ( !$revision = wp_get_post_revision( $revision_id ) ) … … 93 100 break; 94 101 95 102 $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>'; 96 $h2 = sprintf( __( 'Compar e Revisions of “%1$s”' ), $post_title );103 $h2 = sprintf( __( 'Comparing revisions of %1$s' ), $post_title ); 97 104 $title = __( 'Revisions' ); 98 105 99 106 $left = $left_revision->ID; … … 135 142 $redirect = 'edit.php'; 136 143 137 144 if ( !empty($redirect) ) { 145 $redirect = remove_query_arg( 'revisionstocompare', $redirect ); 138 146 wp_redirect( $redirect ); 139 147 exit; 140 148 } … … 146 154 $parent_file = $submenu_file = 'edit.php'; 147 155 148 156 require_once( './admin-header.php' ); 149 150 157 ?> 151 158 152 159 <div class="wrap"> 153 154 160 <h2 class="long-header"><?php echo $h2; ?></h2> 155 161 <hr /> 156 162 <table class="form-table ie-fixed"> 157 <col class="th" />158 163 <?php if ( 'diff' == $action ) : ?> 159 164 <tr id="revision"> 160 <th scope="row"></th>161 165 <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> 166 <table width="100%" cellspacing="0" cellpadding="0"> 167 <tr> 168 <td width="50%"> 169 <?php printf('<div class="revision-type-left">%s</div><div class="revision-avatar-left">%s</div><div class="revision-title-left">%s</div>', 170 __('Older'), 171 get_avatar( $left_revision->post_author, 22 ), 172 wp_post_revision_title( $left_revision ) 173 ); ?> 174 </td> 175 <td width="50%"> 176 <?php printf('<div class="revision-type-right">%s</div><div class="revision-title-right">%s</div><div class="revision-avatar-right">%s</div>', 177 __('Newer'), 178 wp_post_revision_title( $right_revision ), 179 get_avatar( $right_revision->post_author, 22 ) 180 ); ?> 181 </td> 182 </tr> 183 </table> 164 184 </th> 165 185 </tr> 166 186 <?php endif; 167 187 168 188 // use get_post_to_edit filters? 169 189 $identical = true; 190 $linesadded=0; 191 $linesdeleted=0; 170 192 foreach ( _wp_post_revision_fields() as $field => $field_title ) : 171 193 if ( 'diff' == $action ) { 172 194 $left_content = apply_filters( "_wp_post_revision_field_$field", $left_revision->$field, $field ); 173 195 $right_content = apply_filters( "_wp_post_revision_field_$field", $right_revision->$field, $field ); 174 if ( !$content = wp_text_diff ( $left_content, $right_content ) )196 if ( !$content = wp_text_diff_with_count( $left_content, $right_content ) ) 175 197 continue; // There is no difference between left and right 198 $htmlcontent = $content[ 'html' ]; 199 $linesadded += $content[ 'linesadded' ]; 200 $linesdeleted += $content[ 'linesdeleted' ]; 201 176 202 $identical = false; 177 203 } else { 178 add_filter( "_wp_post_revision_field_$field", ' htmlspecialchars' );179 $ content = apply_filters( "_wp_post_revision_field_$field", $revision->$field, $field );204 add_filter( "_wp_post_revision_field_$field", 'wp_kses_post' ); 205 $htmlcontent = apply_filters( "_wp_post_revision_field_$field", $revision->$field, $field ); 180 206 } 207 181 208 ?> 182 209 183 210 <tr id="revision-field-<?php echo $field; ?>"> 184 <th scope="row"><?php echo esc_html( $field_title ); ?></th> 185 <td><div class="pre"><?php echo $content; ?></div></td> 211 <td><div class="pre"><?php echo $htmlcontent; ?></div></td> 186 212 </tr> 187 213 188 214 <?php 189 215 190 216 endforeach; 217 ?> 218 <div class="revision-summary-area"> 219 <div class="revisions-header-deleted"><?php echo (0 != $linesdeleted ? '-' : '' ) . $linesdeleted; ?></div> 220 <div class="revisions-header-added"><?php echo (0 != $linesadded ? '+' : '' ) . $linesadded; ?></div> 221 </div> 222 <?php 191 223 192 224 if ( 'diff' == $action && $identical ) : 193 225 … … 205 237 206 238 <br class="clear" /> 207 239 208 <h3><?php echo $title; ?></h3>209 210 240 <?php 211 241 212 242 $args = array( 'format' => 'form-table', 'parent' => true, 'right' => $right, 'left' => $left ); -
wp-admin/css/colors-fresh.css
1350 1350 1351 1351 /* Diff */ 1352 1352 table.diff .diff-deletedline { 1353 background-color: #fdd; 1353 color: #D4362F; 1354 text-decoration: line-through; 1354 1355 } 1355 1356 1357 table.diff .diff-deletedline-indicator, .revisions-header-deleted { 1358 color: #D4362F; 1359 text-align: right; 1360 } 1361 .revision-summary-area { /*move the diff summary to the upper right*/ 1362 position: absolute; 1363 top: 20px; 1364 right: 20px; 1365 } 1366 .revisions-header-deleted, .revisions-header-added { 1367 float: right; 1368 font-size: 1.6em; 1369 font-weight: bold; 1370 padding: 3px; 1371 } 1372 1373 .revision-post-list-title { 1374 float: left; 1375 font-weight: bold; 1376 font-size: 16px; 1377 line-height: 24px; 1378 color: #676767; 1379 } 1380 1356 1381 table.diff .diff-deletedline del { 1357 1382 background-color: #f99; 1358 1383 } 1359 1384 1360 1385 table.diff .diff-addedline { 1361 background-color: #dfd;1386 color: #00A100; 1362 1387 } 1363 1388 1389 table.diff .diff-addedline-indicator, .revisions-header-added { 1390 color: #00A100; /* dark green for + (added) symbol and header diffs */ 1391 } 1392 1393 table.diff li { 1394 margin-left: 12px; /*add some left margin to li's in the diff or they hand outside the box*/ 1395 } 1396 1364 1397 table.diff .diff-addedline ins { 1365 1398 background-color: #9f9; 1366 1399 } -
wp-admin/css/wp-admin.css
4411 4411 .form-table td { 4412 4412 margin-bottom: 9px; 4413 4413 padding: 8px 10px; 4414 line-height: 2 0px;4414 line-height: 24px; 4415 4415 font-size: 12px; 4416 4416 } 4417 4417 … … 8585 8585 .locale-lt-lt .inline-edit-row fieldset label span.input-text-wrap { 8586 8586 margin-left: 8em; 8587 8587 } 8588 .revision-title-left { 8589 float: left; 8590 font-size: 1.1em; 8591 } 8592 8593 .revision-title-right { 8594 float: right; 8595 font-size: 1.1em; 8596 padding-right: 5px; 8597 } 8598 8599 .revision-type-left { 8600 float: right; 8601 font-size: 1.4em; 8602 color: #999; 8603 } 8604 8605 .revision-type-right { 8606 float: left; 8607 font-size: 1.4em; 8608 color: #999; 8609 padding-left: 30px; 8610 } 8611 8612 .revision-avatar-left { 8613 float: left; 8614 margin-left: 5px; 8615 margin-right: 5px; 8616 } 8617 8618 .revision-avatar-right { 8619 float: right; 8620 margin-right: 5px; 8621 margin-left: 5px; 8622 } 8623 8624 .form-table tr#revision th { 8625 vertical-align: top; 8626 text-align: left; 8627 padding-top: 10px; 8628 padding-bottom: 10px; 8629 padding-right: 10px; 8630 padding-left: 0; 8631 width: 200px; 8632 } 8633 8634 .form-table tr#revision td { 8635 font-size: 12px; 8636 line-height: 24px; 8637 margin-bottom: 9px; 8638 padding-top: 8px; 8639 padding-bottom: 8px; 8640 padding-right: 10px; 8641 padding-left: 0; 8642 } 8643 8644 .form-table tr#revision-field-post_content .pre { 8645 margin: 0; 8646 padding: 0; 8647 } 8648 8649 .form-table tr#revision-field-post_content td { 8650 font-size: 12px; 8651 line-height: 24px; 8652 margin-bottom: 9px; 8653 padding: 8px 10px; 8654 } 8655 8656 8657 .form-table tr#revision-field-post_content td.diff-addedline-indicator { 8658 padding-left: 30px; 8659 } 8660 table.post-revisions a { 8661 line-height: 24px; 8662 } 8663 table.post-revisions img { 8664 float: left; 8665 margin-right: 5px; 8666 }