Sort:  

Thanks. Tried to write code as secure as I can. All my fears belong to simplexml_load_string and htmlspecialchars now. But my knowledge about vulnerabilities are very limited. Just always escaping and validate user data.

You did quite a good job with the security, I made a GitHub issue regarding recommendations on how to improve it even more!