ResourceLocator

class OC\Template\ResourceLocator
Source:lib/private/Template/ResourceLocator.php#33

Properties

protected static property OC\Template\ResourceLocator::$theme
Source:lib/private/Template/ResourceLocator.php#34
protected static property OC\Template\ResourceLocator::$mapping
Source:lib/private/Template/ResourceLocator.php#36
protected static property OC\Template\ResourceLocator::$serverroot
Source:lib/private/Template/ResourceLocator.php#37
protected static property OC\Template\ResourceLocator::$thirdpartyroot
Source:lib/private/Template/ResourceLocator.php#38
protected static property OC\Template\ResourceLocator::$webroot
Source:lib/private/Template/ResourceLocator.php#39
protected static property OC\Template\ResourceLocator::$resources
Source:lib/private/Template/ResourceLocator.php#41
protected static property OC\Template\ResourceLocator::$logger
Source:lib/private/Template/ResourceLocator.php#44
Type:\OCP\ILogger

Methods

public OC\Template\ResourceLocator::__construct($logger, $theme, $core_map, $party_map)
Source:

lib/private/Template/ResourceLocator.php#52

Parameters:
  • $logger (OCP\ILogger)
  • $theme (string)
  • $core_map (array)
  • $party_map (array)
public abstract OC\Template\ResourceLocator::doFind($resource)
Source:

lib/private/Template/ResourceLocator.php#64

Parameters:
  • $resource (string)
public abstract OC\Template\ResourceLocator::doFindTheme($resource)
Source:

lib/private/Template/ResourceLocator.php#69

Parameters:
  • $resource (string)
public OC\Template\ResourceLocator::find($resources)
Finds the resources and adds them to the list
Source:

lib/private/Template/ResourceLocator.php#76

Parameters:
  • $resources (array)
protected OC\Template\ResourceLocator::appendIfExist($root, $file, $webRoot=null)
append the $file resource if exist at $root
Source:

lib/private/Template/ResourceLocator.php#105

Parameters:
  • $root (string) path to check
  • $file (string) the filename
  • $webRoot (string | null) base for path, default map $root to $webRoot
Returns:

bool True if the resource was found, false otherwise

protected OC\Template\ResourceLocator::findWebRoot($root)
Attempt to find the webRoot
traverse the potential web roots upwards in the path

example:
- root: /srv/www/apps/myapp
- available mappings: [‘/srv/www’]

First we check if a mapping for /srv/www/apps/myapp is available,
then /srv/www/apps, /srv/www/apps, /srv/www, ... until we find a
valid web root
Source:

lib/private/Template/ResourceLocator.php#129

Parameters:
  • $root (string)
Returns:

string | null The web root or null on failure

protected OC\Template\ResourceLocator::append($root, $file, $webRoot=null, $throw=true)
append the $file resource at $root
Source:

lib/private/Template/ResourceLocator.php#166

Parameters:
  • $root (string) path to check
  • $file (string) the filename
  • $webRoot (string | null) base for path, default map $root to $webRoot
  • $throw (bool) Throw an exception, when the route does not exist
Throws:

\OC\Template\ResourceNotFoundException Only thrown when $throw is true and the resource is missing

public OC\Template\ResourceLocator::getResources()
Returns the list of all resources that should be loaded
Source:lib/private/Template/ResourceLocator.php#199
Returns:array