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