pfefferle / wordpress-webmention

A Webmention plugin for WordPress
https://wordpress.org/plugins/webmention/
MIT License
117 stars 31 forks source link

Minor refactor of webmention_extract_urls in functions.php #446

Closed shawfactor closed 9 months ago

shawfactor commented 9 months ago

id suggest on line 305 of

this would be a more appropriate, full proof, and efficient check for $content would be

// If no content is provided, or if it is not html and therefore won't contain urls $content = trim($content);

if (empty($content) or ($content == strip_tags(wp_strip_all_tags))){

return array();

}

I would also suggest a sanity check that $doc is a type DOMDocument before:

$xpath = new DOMXPath( $doc );

on line 316

as get_dom_document can return a WP_Error and that generates a fatal error which is not ideal