Make WordPress Core


Ignore:
Timestamp:
11/19/2014 11:20:07 PM (12 years ago)
Author:
johnbillion
Message:

Introduce two new filters to the post revisions screen:

  • process_text_diff_html for contextually filtering a diffed line. Allows for the line to be processed in a different manner to the default htmlspecialchars.
  • revision_text_diff_options for filtering the options passed to wp_text_diff() when viewing a post revision.

Fixes #24908
Props adamsilverstein

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/revision.php

    r30353 r30396  
    7474                $content_to = apply_filters( "_wp_post_revision_field_$field", $compare_to->$field, $field, $compare_to, 'to' );
    7575
    76                 $diff = wp_text_diff( $content_from, $content_to, array( 'show_split_view' => true ) );
     76                $args = array(
     77                        'show_split_view' => false
     78                );
     79                /**
     80                 * Filter revisions text diff options.
     81                 *
     82                 * Filter the options passed to `wp_text_diff()` when viewing a post revision.
     83                 *
     84                 * @since 4.1.0
     85                 *
     86                 * @param array   $args {
     87                 *     Associative array of options to pass to `wp_text_diff()`.
     88                 *
     89                 *     @type bool $show_split_view False for split view (two columns), true for
     90                 *                                 un-split view (single column). Default false.
     91                 * }
     92                 * @param string  $field        The current revision field.
     93                 * @param WP_Post $compare_from The revision post to compare from.
     94                 * @param WP_Post $compare_to   The revision post to compare to.
     95                 */
     96                $args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to );
     97                $diff = wp_text_diff( $content_from, $content_to, $args );
    7798
    7899                if ( ! $diff && 'post_title' === $field ) {
Note: See TracChangeset for help on using the changeset viewer.