process_text_diff_html

Contextually filters a diffed line.

Description

apply_filters( 'process_text_diff_html', (String) $processed_line, (String) $line, (string) $added ); 

Filters TextDiff processing of diffed line. By default, diffs are processed with htmlspecialchars. Use this filter to remove or change the processing. Passes a context indicating if the line is added, deleted or unchanged.

Parameters (3)

0. $processed_line (String)
The processed diffed line.
1. $line (String)
The unprocessed diffed line.
2. $added (string) => 'added'
Null The line context. Values are added,, deleted or unchanged..

Usage

To run the hook, copy the example below.
  1. $processed_line = apply_filters( 'process_text_diff_html', $processed_line, $line, $added ); 
  2.  
  3. if ( !empty( $processed_line ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the process_text_diff_html callback 
  2. function filter_process_text_diff_html( $processed_line, $line, $added ) { 
  3. // make filter magic happen here... 
  4. return $processed_line
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'process_text_diff_html', 'filter_process_text_diff_html', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'process_text_diff_html', 'filter_process_text_diff_html', 10, 3 ); 

Defined (3)

The filter is defined in the following location(s).

/wp-includes/class-wp-text-diff-renderer-table.php  
  1. $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' ); 
  1. $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' ); 
  1. $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' );