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
149                      * htmlspecialchars. Use this filter to remove or change the processing. Passes a context
150                      * indicating if the line is added, deleted or unchanged.
151                      *
152                      * @since 4.1.0
153                      *
154                      * @param String $processed_line The processed diffed line.
155                      * @param String $line           The unprocessed diffed line.
156                       * @param string null            The line context. Values are 'added', 'deleted' or 'unchanged'.
157                      */
158                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' );
159                }
160
161                if ( $this->_show_split_view ) {
162                     $r .= '<tr>' . $this->emptyLine() . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
163                } else {
164                     $r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n";
165                }
166           }
167           return $r;
 
Line Code
175       * @return string
176       */
177      public function _deleted( $lines, $encode = true ) {
178           $r = '';
179           foreach ($lines as $line) {
180                if ( $encode ) {
181                     $processed_line = htmlspecialchars( $line );
182
183                     /** This filter is documented in wp-includes/wp-diff.php */
184                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' );
185                }
186                if ( $this->_show_split_view ) {
187                     $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . $this->emptyLine() . "</tr>\n";
188                } else {
189                     $r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n";
190                }
191
192           }
193           return $r;
 
Line Code
201       * @return string
202       */
203      public function _context( $lines, $encode = true ) {
204           $r = '';
205           foreach ($lines as $line) {
206                if ( $encode ) {
207                     $processed_line = htmlspecialchars( $line );
208
209                     /** This filter is documented in wp-includes/wp-diff.php */
210                     $line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' );
211                }
212                if (  $this->_show_split_view ) {
213                     $r .= '<tr>' . $this->contextLine( $line ) . $this->emptyLine() . $this->contextLine( $line )  . "</tr>\n";
214                } else {
215                     $r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n";
216                }
217           }
218           return $r;
219      }