There is something here that I don't get. How this line:

```php
JURI::root() . 'templates/' . $doc->template . '/favicons/';
```

Will return a url that will find the images at:
code/favicons/mstile-310x310.png

???