Converting XeLaTeX to Wiki formatting with PHP

So, the need came up for me to dump data from my XeLaTeX environment into a Wiki, but I want to continue to master the the document in TeXShop, but the wiki needs to stay up to date, so the only thing for it is to create an exporter. So that’s exactly what I did. There are two distinguishing features in comparison to other solutions is I provide solutions for both my custom imgfig macro and includegraphics, using a base directory (though you have to get the graphics there yourself). The second is I support includes, which I use in my documents frequently. It’s currently pretty light on various syntax and doesn’t yet support math or recursive includes, but I’ll add that soon. I also want to support pushing the data into the wiki itself in subsequent versions. But for now the format is:
php latex2wiki.php [tex file] [graphics directory url]
Go grab it here.