From f54337c8b83199a79d271e54d0c3677ef83cc142 Mon Sep 17 00:00:00 2001 From: Brady Vercher Date: Thu, 16 Jan 2020 15:01:42 -0800 Subject: [PATCH] Update the method for stripping unnecessary elements added by DOMDocument. See #63 --- includes/class-gistpress.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/includes/class-gistpress.php b/includes/class-gistpress.php index db3d9c0..c92acba 100644 --- a/includes/class-gistpress.php +++ b/includes/class-gistpress.php @@ -412,9 +412,6 @@ public function get_gist_html( $url, array $args ) { $this->debug_log( '' . __( 'Raw Key (Transient & Post Meta):', 'gistpress' ) . ' ' . $raw_key, $shortcode_hash ); $this->debug_log( '' . __( 'Processed Output Key (Transient):', 'gistpress' ) . ' ' . $transient_key, $shortcode_hash ); - // Strip unnecessary elements from HTML output. - $html = preg_replace( '/^/i', '', str_ireplace( array( '', '', '', '' ), '', $html ) ); - return $html; } @@ -466,7 +463,7 @@ public function process_gist_html( $html, array $args ) { $html = '' . $html; $dom = new DOMDocument(); - $dom->loadHTML( $html ); + $dom->loadHTML( $html, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED ); $lines = $dom->getElementsByTagName( 'tr' );