WP_Text_Diff_Renderer_Table example

if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) ) {
            require ABSPATH . WPINC . '/wp-diff.php';
        }

        $left_string  = normalize_whitespace( $left_string );
        $right_string = normalize_whitespace( $right_string );

        $left_lines  = explode( "\n", $left_string );
        $right_lines = explode( "\n", $right_string );
        $text_diff   = new Text_Diff( $left_lines$right_lines );
        $renderer    = new WP_Text_Diff_Renderer_Table( $args );
        $diff        = $renderer->render( $text_diff );

        if ( ! $diff ) {
            return '';
        }

        $is_split_view       = ! empty( $args['show_split_view'] );
        $is_split_view_class = $is_split_view ? ' is-split-view' : '';

        $r = "<table class='diff$is_split_view_class'>\n";

        
Home | Imprint | This part of the site doesn't use cookies.