owncloud/core — pull request #6879 by ringmaster (2014-01-21 21:33:19+00:00)
Title: Allow addScript to add routed scripts

Util::addScript() can be used to add scripts only if the script exists as a file.

When creating a new route to a dynamically generated javascript file from an app, Util::addScript() can be used to queue the script for output, but because the template class checks for the existence of the script as a file, and the script is virtual due to the nature of it being routed, the script file isn't found and the template class errors out.

These commits also check the router for a URL that matches the file added via Util::addScript() after the existing checks to see if the file exists in the filesystem. It allows apps to use Util::addScript() to add a script to the output that is generated by PHP via the router.

-----
in app's routes.php:
```php
/** @var OC_Route $route */
$this->create('my_app_js', '/js/custom.js')
->action(create_function('',"require_once __DIR__ . '/../js/custom.php';"));
```

in app's app.php:
```php
OCP\Util::addScript('may_app', 'custom');
```