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
167                      * htmlspecialchars. Use this filter to remove or change the processing. Passes a context
168                      * indicating if the line is added, deleted or unchanged.
169                      *
170                      * @since 4.1.0
171                      *
172                      * @param string $processed_line The processed diffed line.
173                      * @param string $line           The unprocessed diffed line.
174                      * @param string $context        The line context. Values are 'added', 'deleted' or 'unchanged'.
175                      */
176                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' );
177                }
178
179                if ( $this->_show_split_view ) {
180                     $r .= '<tr>' . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
181                } else {
182                     $r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n";
183                }
184           }
185           return $r;
 
Line Code
193       * @return string
194       */
195      public function _deleted( $lines, $encode = true ) {
196           $r = '';
197           foreach ( $lines as $line ) {
198                if ( $encode ) {
199                     $processed_line = htmlspecialchars( $line );
200
201                     /** This filter is documented in wp-includes/wp-diff.php */
202                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' );
203                }
204                if ( $this->_show_split_view ) {
205                     $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . "</tr>\n";
206                } else {
207                     $r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n";
208                }
209           }
210           return $r;
211      }
 
Line Code
218       * @return string
219       */
220      public function _context( $lines, $encode = true ) {
221           $r = '';
222           foreach ( $lines as $line ) {
223                if ( $encode ) {
224                     $processed_line = htmlspecialchars( $line );
225
226                     /** This filter is documented in wp-includes/wp-diff.php */
227                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' );
228                }
229                if ( $this->_show_split_view ) {
230                     $r .= '<tr>' . $this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n";
231                } else {
232                     $r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n";
233                }
234           }
235           return $r;
236      }