Changeset 23506 for trunk/wp-includes/wp-diff.php
- Timestamp:
- 02/28/2013 03:14:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/wp-diff.php
r22118 r23506 61 61 62 62 /** 63 * Should we show the split view or not 64 * 65 * @var string 66 * @access protected 67 * @since 3.6.0 68 */ 69 var $_show_split_view = true; 70 71 /** 63 72 * Constructor - Call parent constructor with params array. 64 73 * … … 71 80 function __construct( $params = array() ) { 72 81 parent::__construct( $params ); 82 if ( isset( $params[ 'show_split_view' ] ) ) 83 $this->_show_split_view = $params[ 'show_split_view' ]; 73 84 } 74 85 … … 99 110 */ 100 111 function addedLine( $line ) { 101 return "<td>+</td><td class='diff-addedline'>{$line}</td>"; 112 return "<td class='diff-addedline'>{$line}</td>"; 113 102 114 } 103 115 … … 109 121 */ 110 122 function deletedLine( $line ) { 111 return "<td >-</td><tdclass='diff-deletedline'>{$line}</td>";123 return "<td class='diff-deletedline'>{$line}</td>"; 112 124 } 113 125 … … 119 131 */ 120 132 function contextLine( $line ) { 121 return "<td > </td><tdclass='diff-context'>{$line}</td>";133 return "<td class='diff-context'>{$line}</td>"; 122 134 } 123 135 … … 128 140 */ 129 141 function emptyLine() { 130 return '<td colspan="2"> </td>';142 return '<td> </td>'; 131 143 } 132 144 … … 143 155 foreach ($lines as $line) { 144 156 if ( $encode ) 145 $line = htmlspecialchars( $line ); 146 $r .= '<tr>' . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n"; 157 $line = wp_kses_post( $line ); 158 if ( $this->_show_split_view ) { 159 $r .= '<tr>' . $this->emptyLine() . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n"; 160 } else { 161 $r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n"; 162 } 147 163 } 148 164 return $r; … … 161 177 foreach ($lines as $line) { 162 178 if ( $encode ) 163 $line = htmlspecialchars( $line ); 164 $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . "</tr>\n"; 179 $line = wp_kses_post( $line ); 180 if ( $this->_show_split_view ) { 181 $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . $this->emptyLine() . "</tr>\n"; 182 } else { 183 $r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n"; 184 } 185 165 186 } 166 187 return $r; … … 179 200 foreach ($lines as $line) { 180 201 if ( $encode ) 181 $line = htmlspecialchars( $line ); 182 $r .= '<tr>' . 183 $this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n"; 202 $line = wp_kses_post( $line ); 203 if ( $this->_show_split_view ) { 204 $r .= '<tr>' . $this->contextLine( $line ) . $this->emptyLine() . $this->contextLine( $line ) . "</tr>\n"; 205 } else { 206 $r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n"; 207 } 184 208 } 185 209 return $r; … … 265 289 $r .= $this->_deleted( array($orig_line), false ); 266 290 } else { // A true changed row. 267 $r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->addedLine( $final_line ) . "</tr>\n"; 291 if ( $this->_show_split_view ) { 292 $r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->emptyLine() . $this->addedLine( $final_line ) . "</tr>\n"; 293 } else { 294 $r .= '<tr>' . $this->deletedLine( $orig_line ) . "</tr><tr>" . $this->addedLine( $final_line ) . "</tr>\n"; 295 } 268 296 } 269 297 }
Note: See TracChangeset
for help on using the changeset viewer.