Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters 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
176                      * htmlspecialchars. Use this filter to remove or change the processing. Passes a context
177                      * indicating if the line is added, deleted or unchanged.
178                      *
179                      * @since 4.1.0
180                      *
181                      * @param string $processed_line The processed diffed line.
182                      * @param string $line           The unprocessed diffed line.
183                      * @param string $context        The line context. Values are 'added', 'deleted' or 'unchanged'.
184                      */
185                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' );
186                }
187
188                if ( $this->_show_split_view ) {
189                     $r .= '<tr>' . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
190                } else {
191                     $r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n";
192                }
193           }
194           return $r;
 
Line Code
202       * @return string
203       */
204      public function _deleted( $lines, $encode = true ) {
205           $r = '';
206           foreach ( $lines as $line ) {
207                if ( $encode ) {
208                     $processed_line = htmlspecialchars( $line );
209
210                     /** This filter is documented in wp-includes/wp-diff.php */
211                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' );
212                }
213                if ( $this->_show_split_view ) {
214                     $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . "</tr>\n";
215                } else {
216                     $r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n";
217                }
218           }
219           return $r;
220      }
 
Line Code
227       * @return string
228       */
229      public function _context( $lines, $encode = true ) {
230           $r = '';
231           foreach ( $lines as $line ) {
232                if ( $encode ) {
233                     $processed_line = htmlspecialchars( $line );
234
235                     /** This filter is documented in wp-includes/wp-diff.php */
236                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' );
237                }
238                if ( $this->_show_split_view ) {
239                     $r .= '<tr>' . $this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n";
240                } else {
241                     $r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n";
242                }
243           }
244           return $r;
245      }