contextLine example


    public function _context( $lines$encode = true ) {
        $r = '';
        foreach ( $lines as $line ) {
            if ( $encode ) {
                $processed_line = htmlspecialchars( $line );

                /** This filter is documented in wp-includes/wp-diff.php */
                $line = apply_filters( 'process_text_diff_html', $processed_line$line, 'unchanged' );
            }
            if ( $this->_show_split_view ) {
                $r .= '<tr>' . $this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n";
            } else {
                $r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n";
            }
        }
        return $r;
    }

    /** * Process changed lines to do word-by-word diffs for extra highlighting. * * (TRAC style) sometimes these lines can actually be deleted or added rows. * We do additional processing to figure that out * * @since 2.6.0 * * @param array $orig * @param array $final * @return string */
protected function _deleted($lines) {
    foreach ($lines as $line) {
      $this->rows[] = array_merge($this->deletedLine(Html::escape($line))$this->emptyLine());
    }
  }

  /** * {@inheritdoc} */
  protected function _context($lines) {
    foreach ($lines as $line) {
      $this->rows[] = array_merge($this->contextLine(Html::escape($line))$this->contextLine(Html::escape($line)));
    }
  }

  /** * {@inheritdoc} */
  protected function _changed($orig$closing) {
    $orig = array_map('\Drupal\Component\Utility\Html::escape', $orig);
    $closing = array_map('\Drupal\Component\Utility\Html::escape', $closing);
    $diff = new WordLevelDiff($orig$closing);
    $del = $diff->orig();
    
Home | Imprint | This part of the site doesn't use cookies.