public function __construct($file, $cacheTime = null, $cacheId = null, $compileId = null, $includePath = null)
 {
     global $THEME;
     $name = explode(':', $file, 2);
     // this is a mahara special resource, resolving path
     if (count($name) == 2) {
         list($file, $includePath) = $this->resolveFileName($name, $includePath);
     }
     parent::__construct($file, null, null, null, $includePath);
 }
 /**
  * Convert a Mahara plugin template file path into a normal template file path with extra search paths.
  *
  * @param string $pluginfile The plugintype, name, and name of file, e.g. "blocktype:clippy:index.tpl"
  * @param int $cacheTime Not used.
  * @param int $cacheId Not used.
  * @param int $compileId Not used.
  * @param array $includePath The paths to look in.
  * @throws MaharaException
  */
 public function __construct($file, $cacheTime = null, $cacheId = null, $compileId = null, $includePath = null)
 {
     global $THEME;
     $parts = explode(':', $file, 3);
     if (count($parts) !== 3) {
         throw new SystemException("Invalid template path \"{$file}\"");
     }
     // Keep the original string for logging purposes
     $dwooref = $file;
     list($plugintype, $pluginname, $file) = $parts;
     // Since we use $plugintype as part of a file path, we should whitelist it
     $plugintype = strtolower($plugintype);
     if (!in_array($plugintype, plugin_types())) {
         throw new SystemException("Invalid plugintype in Dwoo template \"{$dwooref}\"");
     }
     // Get the relative path for this particular plugin
     require_once get_config('docroot') . $plugintype . '/lib.php';
     $pluginpath = call_static_method(generate_class_name($plugintype), 'get_theme_path', $pluginname);
     // Because this is a plugin template file, we don't want to include any accidental matches against
     // core template files with the same name.
     $includePath = array();
     // First look for a local override.
     $includePath[] = get_config('docroot') . "local/theme/{$pluginpath}/templates";
     // Then look for files in a custom theme
     foreach ($THEME->inheritance as $theme) {
         $includePath[] = get_config('docroot') . "theme/{$theme}/{$pluginpath}/templates";
     }
     // Lastly look for files in the plugin itself
     foreach ($THEME->inheritance as $theme) {
         $includePath[] = get_config('docroot') . "{$pluginpath}/theme/{$theme}/templates";
         // For legacy purposes also look for the template file loose under the theme directory.
         $includePath[] = get_config('docroot') . "{$pluginpath}/theme/{$theme}";
     }
     // Now, we instantiate this as a standard Dwoo_Template_File class.
     // We're passing in $file, which is the relative path to the file, and
     // $includePath, which is an array of directories to search for $file in.
     // We let Dwoo figure out which one actually has it.
     parent::__construct($file, null, null, null, $includePath);
 }