bradyvercher / gistpress

WordPress plugin to add Gist oEmbed and shortcode support with caching.
GNU General Public License v2.0
143 stars 28 forks source link

Mute warnings thrown by LoadHTML() #80

Open Dan0sz opened 2 years ago

Dan0sz commented 2 years ago

Mute warnings for invalid HTML tags.

Description

I only added libxml_use_internal_errors(true); right above the LoadHTML() to mute any warnings it throws.

Motivation and Context

In its current state, the plugin fills the log with warnings like these:

PHP message: PHP Warning: DOMDocument::loadHTML(): Tag template invalid in Entity, line: 12

How Has This Been Tested?

Didn't feel it was necessary.

Screenshots (if appropriate):

Types of changes

Checklist:

bradyvercher commented 2 years ago

Thanks @Dan0sz! If you can make a few updates, I'll go ahead and get this merged:

  1. Can you add some spaces around the argument to conform to the WordPress coding standards?
  2. I'm thinking this may need to be reversed after any DOM processing so it doesn't cause unintended side effects in other plugins. So add libxml_use_internal_errors( false ); toward the end of that function.
  3. Can you submit the PR against the develop branch?
salcode commented 11 months ago

I've opened a new PR (#82) that implements @bradyvercher's requested changes.