Skip to content

Commit c1a9015

Browse files
author
KokkieH
committed
PHPUnit Test Reporter: Improve single result rendering
Props kokkieh, bor0. Closes WordPress#897. git-svn-id: https://meta.svn.wordpress.org/sites/trunk@15181 74240141-8908-4e6f-9713-ba540dce6ec7
1 parent 2e548f0 commit c1a9015

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/single-result.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
$parent = get_post( $report->post_parent );
3737
if ( $parent ) :
3838
?>
39-
<p><a href="<?php echo esc_url( get_permalink( $parent ) ); ?>">&larr; <?php echo esc_html( $parent->post_name ) . ': ' . apply_filters( 'the_title', get_the_title( $parent ) ); ?></a></p>
39+
<p><a href="<?php echo esc_url( get_permalink( $parent ) ); ?>">&larr; <?php echo esc_html( $parent->post_name ) . ': ' . esc_html( $parent->post_title ); ?></a></p>
4040
<?php endif; ?>
4141

4242
<p><a href="<?php echo esc_url( get_permalink( $report->ID ) ); ?>" title="<?php echo esc_attr( $status_title ); ?>" class="<?php echo esc_attr( 'ptr-status-badge ptr-status-badge-' . strtolower( $status ) ); ?>"><?php echo esc_html( $status ); ?></a></p>

‎wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/phpunit-test-reporter.php‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@
2727
add_action( 'get_post_metadata', array( 'PTR\Display', 'filter_get_post_metadata' ), 10, 4 );
2828
add_action( 'body_class', array( 'PTR\Display', 'filter_body_class' ) );
2929
add_action( 'post_class', array( 'PTR\Display', 'filter_post_class' ) );
30-
add_action( 'the_content', array( 'PTR\Display', 'filter_the_content' ) );
30+
// This callback discards its $content input and returns a freshly rendered report,
31+
// so it must run after every shortcode-parsing pass or that generated markup — which
32+
// contains esc_html'd, submitter-controlled data — gets fed back to the parser.
33+
// Core's do_shortcode is at priority 11; a late priority (99) also runs after any
34+
// third-party shortcode filter registered above that. add_filter (not add_action) as
35+
// the returned value is used.
36+
add_filter( 'the_content', array( 'PTR\Display', 'filter_the_content' ), 99 );
3137
add_action( 'rest_api_init', array( 'PTR\RestAPI', 'register_routes' ) );
3238
add_action( 'load-edit.php', 'ptr_load_edit_php' );
3339

0 commit comments

Comments
 (0)