Use DOM for more reliable concatenation / minification

I found the scraping process used to concatenate scripts and styles a little unreliable, particularly in the case where the main WP install is in its own directory and the content directory is not named `wp-content`.

In the end I re-wrote the method using PHP DOM manipulation (instead of regular expressions) to grab the appropriate `<link>` and `<script>` elements, process them and replace them in the page with links to the concatenated files. The file is pulled in using the URL of the resource, rather than the absolute filepath (which can vary with the install structure) and concatenated.

I have done some quick testing with different options using an (S)FTP CDN, which seems to work, but it probably needs more testing for other CDN methods.