After some more successful testing the method of getting the remote page title in the 'Likes and Replies' plugin has been updated.
While the previous
preg_replace() method worked it could be a little unreliable if there was any issues with the code or the title contained certain special characters.
Now, the code to get the page title is just the following:
$dom = new DOMDocument(); $dom->loadHTMLFile($liked_url); $liked_title = $dom->getElementsByTagName('title')->item('0')->nodeValue;
Much cleaner and more reliable.
All examples I had seen to do this used
@$dom->... where the @ operator is added to PHP expressions to ignore any errors generated. If you have a custom error handler that still gets called.
As I don't have a custom error handler and, frankly, would like to see any errors that are generated, I've removed the @ so as not to suppress them.
As always, the changes have been pushed to the GitHub repository.