The concept is this:
You may want to test locally in a location like: index.php
Then you upload live to: index.php
We want to create the menus with absolute urls so they can be in pages other than the root without updating the links. So we allow you to set a remote root and local root separately... so in my case I would have used: "/domainname/" for my local root and "/" as my remote root. That way it would work in either even though the roots are different.
The code basically checks to see if the local root exists, if it does, it uses that, if it doesn't, it uses the remote root.