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
199                      * htmlspecialchars. Use this filter to remove or change the processing. Passes a context
200                      * indicating if the line is added, deleted or unchanged.
201                      *
202                      * @since 4.1.0
203                      *
204                      * @param string $processed_line The processed diffed line.
205                      * @param string $line           The unprocessed diffed line.
206                      * @param string $context        The line context. Values are 'added', 'deleted' or 'unchanged'.
207                      */
208                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' );
209                }
210
211                if ( $this->_show_split_view ) {
212                     $r .= '<tr>' . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
213                } else {
214                     $r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n";
215                }
216           }
217           return $r;
 
Line Code
225       * @return string
226       */
227      public function _deleted( $lines, $encode = true ) {
228           $r = '';
229           foreach ( $lines as $line ) {
230                if ( $encode ) {
231                     $processed_line = htmlspecialchars( $line );
232
233                     /** This filter is documented in wp-includes/wp-diff.php */
234                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' );
235                }
236                if ( $this->_show_split_view ) {
237                     $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . "</tr>\n";
238                } else {
239                     $r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n";
240                }
241           }
242           return $r;
243      }
 
Line Code
250       * @return string
251       */
252      public function _context( $lines, $encode = true ) {
253           $r = '';
254           foreach ( $lines as $line ) {
255                if ( $encode ) {
256                     $processed_line = htmlspecialchars( $line );
257
258                     /** This filter is documented in wp-includes/wp-diff.php */
259                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' );
260                }
261                if ( $this->_show_split_view ) {
262                     $r .= '<tr>' . $this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n";
263                } else {
264                     $r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n";
265                }
266           }
267           return $r;
268      }