CONTRIB-4696 Support distributed 3rd part lib xml

Since Moodle 2.6 we have split the old, unique thirdpartylibs.xml
file, distributing it along codebase for plugins having their own libs.

This patch addresses:

- Support those distributed xml files.
- Do it conditionally, so it will continue working against old branches.
- Fix a existing problem about some paths being generated wrongly in the past.
- Debug information about any incorrect path defined in the xml files

NOTE that this pull request also includes 2 more commits:

- General cleanup of code.
- Simple change to the definition of our globals so we can use them in more places (other, incoming, Sniffs).