Ticket #24908: 24908.4.diff
File 24908.4.diff, 3.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/revision.php
73 73 /** This filter is documented in wp-admin/includes/revision.php */ 74 74 $content_to = apply_filters( "_wp_post_revision_field_$field", $compare_to->$field, $field, $compare_to, 'to' ); 75 75 76 $diff = wp_text_diff( $content_from, $content_to, array( 'show_split_view' => true ) ); 76 $wp_text_diff_options = array( 'show_split_view' => false ); 77 /** 78 * Filter revisions text diff options. 79 * 80 * Filter the options passed to wp_text_diff. 81 * 82 * @param array $args { 83 * Associative array of options to pass to wp_text_diff. 84 * 85 * @type bool wp_text_diff_options False for split (two columns), true for 86 * not split (single column). Default false. 87 * } 88 * 89 * @since 4.1.0 90 * 91 */ 92 $wp_text_diff_options = apply_filters( 'wp_text_diff_options', $wp_text_diff_options ); 93 $diff = wp_text_diff( $content_from, $content_to, $wp_text_diff_options ); 77 94 78 95 if ( ! $diff && 'post_title' === $field ) { 79 96 // It's a better user experience to still show the Title, even if it didn't change. -
src/wp-includes/wp-diff.php
153 153 public function _added( $lines, $encode = true ) { 154 154 $r = ''; 155 155 foreach ($lines as $line) { 156 if ( $encode ) 157 $line = htmlspecialchars( $line ); 156 if ( $encode ) { 157 $processed_line = htmlspecialchars( $line ); 158 159 /** 160 * Contextually filter a diffed line. 161 * 162 * Filters TextDiff processing of diffed line. By default, diffs are processed with 163 * htmlspecialchars. Use this filter to remove or change the processing. Passes a context 164 * indicating if the line is added, deleted or unchanged. 165 * 166 * @since 4.1.0 167 * 168 * @param String $processed_line The processed diffed line. 169 * @param String $line The unprocessed diffed line. 170 * @param string null The line context. Values are 'added', 'deleted' or 'context' (unchanged). 171 */ 172 $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' ); 173 } 174 158 175 if ( $this->_show_split_view ) { 159 176 $r .= '<tr>' . $this->emptyLine() . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n"; 160 177 } else { … … 176 193 $r = ''; 177 194 foreach ($lines as $line) { 178 195 if ( $encode ) 179 $line = htmlspecialchars( $line ); 196 /** This filter is documented in /wp-includes/wp-diff.php */ 197 $line = apply_filters( 'process_text_diff_html', htmlspecialchars( $line ), $line, 'deleted' ); 180 198 if ( $this->_show_split_view ) { 181 199 $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . $this->emptyLine() . "</tr>\n"; 182 200 } else { … … 199 217 $r = ''; 200 218 foreach ($lines as $line) { 201 219 if ( $encode ) 202 $line = htmlspecialchars( $line ); 220 /** This filter is documented in /wp-includes/wp-diff.php */ 221 $line = apply_filters( 'process_text_diff_html', htmlspecialchars( $line ), $line, 'context' ); 203 222 if ( $this->_show_split_view ) { 204 223 $r .= '<tr>' . $this->contextLine( $line ) . $this->emptyLine() . $this->contextLine( $line ) . "</tr>\n"; 205 224 } else {