Menu Adam R Brown

WP hooks navigation: Home/browse • Actions index • Filters index

Source View: process_text_diff_html

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 3 times in this file.

Line Code
204                      * htmlspecialchars. Use this filter to remove or change the processing. Passes a context
205                      * indicating if the line is added, deleted or unchanged.
206                      *
207                      * @since 4.1.0
208                      *
209                      * @param string $processed_line The processed diffed line.
210                      * @param string $line           The unprocessed diffed line.
211                      * @param string $context        The line context. Values are 'added', 'deleted' or 'unchanged'.
212                      */
213                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' );
214                }
215
216                if ( $this->_show_split_view ) {
217                     $r .= '<tr>' . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
218                } else {
219                     $r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n";
220                }
221           }
222           return $r;
 
Line Code
230       * @return string
231       */
232      public function _deleted( $lines, $encode = true ) {
233           $r = '';
234           foreach ( $lines as $line ) {
235                if ( $encode ) {
236                     $processed_line = htmlspecialchars( $line );
237
238                     /** This filter is documented in wp-includes/wp-diff.php */
239                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' );
240                }
241                if ( $this->_show_split_view ) {
242                     $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . "</tr>\n";
243                } else {
244                     $r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n";
245                }
246           }
247           return $r;
248      }
 
Line Code
255       * @return string
256       */
257      public function _context( $lines, $encode = true ) {
258           $r = '';
259           foreach ( $lines as $line ) {
260                if ( $encode ) {
261                     $processed_line = htmlspecialchars( $line );
262
263                     /** This filter is documented in wp-includes/wp-diff.php */
264                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' );
265                }
266                if ( $this->_show_split_view ) {
267                     $r .= '<tr>' . $this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n";
268                } else {
269                     $r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n";
270                }
271           }
272           return $r;
273      }