Resolves the path to the source template file of the backend.

@param string $filename

@return string
167603
public function getTemplateFileContents($filename)
    {
        $templatePath = rtrim($this->config->get('templatepath', 'backend'), '\\/');
        if (empty($templatepath)) {
            $templatePath = $this->templatesPath;
        }

        return file_get_contents(
            "{$templatePath}/{$this->name}/{$filename}"
        );
    }
1158051
public function get($filename)
    {
        $filename = $this->path($filename);

        if (!(is_file($filename) && stream_is_local($filename))) {
            return null;
        }

        return file_get_contents($filename);
    }
1050763
public function resolve($template, $view = null)
    {
        if (!$template) {
            return '';
        }

        $segments = explode('/', $template);
        $page = end($segments);

        foreach ($this->baseDirectories as $dirs) {
            foreach ($dirs as $dir) {
                if ($t = $this->tryTemplate($dir, $template, $view)) {
                    return $t;
                }

                if ($t = $this->tryTemplate($dir, $template.$this->extension, $view)) {
                    return $t;
                }
            }
        }

        if ($template[0] !== '_') {

            foreach ($this->baseDirectories as $dirs) {
                foreach ($dirs as $dir) {
                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page, $view)) {
                        return $t;
                    }

                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page.$this->extension, $view)) {
                        return $t;
                    }
                }
            }

        }

    }
832732
public function resolveFile($fileName, $rootDir = null)
    {
        if ($rootDir === null) {
            return $this->fileUtils->resolveFile($this->basedir, $fileName);
        } else {
            return $this->fileUtils->resolveFile($rootDir, $fileName);
        }
    }
1157725
public function getTemplateNamesForFilename($filename)
    {
        $map = $this->getMap();
        $matching = array_filter(array_keys($map), function ($path) use ($filename) {
            return $filename[0] === $path[0] && 0 === strpos($filename, $path);
        });

        $templateNames = [];
        foreach ($matching as $match) {
            $namespace = $map[$match];
            $templateNames[] = self::MAIN_NAMESPACE === $namespace
                ? ltrim(substr($filename, strlen($match)), '/\\')
                : '@'.$namespace.substr($filename, strlen($match));
        }

        return $templateNames;
    }
109193
protected function find_handler_path($filename) {
	$filename = strtolower($filename);
	
	if (preg_match('{[^a-z0-9/_-]}', $filename)) {
		return false;
	}
	
	$base_path = \alsvanzelf\fem\ROOT_DIR_APP.$this->handler_base_path.'/';
	$full_path = $base_path.$filename.'.php';
	if (file_exists($full_path) == false) {
		return false;
	}
	
	// sanity check to prevent escaping outside the base dir
	if (strpos($full_path, $base_path) !== 0) {
		return false;
	}
	
	return $full_path;
}
304656
public function GetConfigurationFilePath($fileName) {
        return "APP_ROOT_DIR" . \Puzzlout\Framework\Enums\ApplicationFolderName::AppsFolderName . \Puzzlout\Framework\Helpers\CommonHelper::GetAppName() . '/Config/' . $fileName;
    }
202327
public function filename($filename = null)
    {
        if ($filename === null) {
            return $this->_filename;
        }
        $this->_filename = $filename;
    }
709839
static public function getUploadFilePath($filename)
    {
        if ($filename) {
            $filename = static::getUploadFileRelativePath($filename);
            
            if (static::isRootImageFile($filename)) {
                
                return static::getWebRootPath() . $filename;
            }
            
            $filename = static::getUploadPath() . $filename;
        }
        
        return $filename;
    }
1351630
private function getDispersionPath($fileName)
    {
        $char           = 0;
        $dispersionPath = DIRECTORY_SEPARATOR . 'original_image' . DIRECTORY_SEPARATOR;

        while ($char < 2 && $char < strlen($fileName)) {
            /** @noinspection IsEmptyFunctionUsageInspection */
            if (empty($dispersionPath)) {
                $dispersionPath = DIRECTORY_SEPARATOR . ('.' === $fileName[$char] ? '_' : $fileName[$char]);
            } else {
                $dispersionPath =
                    $this->addDirectorySeparator($dispersionPath) . ('.' === $fileName[$char] ? '_' : $fileName[$char]);
            }

            $char++;
        }

        return $dispersionPath . DIRECTORY_SEPARATOR;
    }
1061933
protected function getTemplateContent($filename)
    {
        $filepath = $this->getTemplateFilePath($filename);

        if (!$filepath) {
            return null;
        }

        $contents = file_get_contents($filepath);

        if (!$contents) {
            return null;
        }

        return $contents;
    }
1361363
public function fetchName(string $filename): ?string
    {
        return str_replace('\\', '/', substr($filename, 0, -1 * (1 + strlen($this->extension))));
    }
898205
public static function get_template_filepath($name, $themename = '') {
        global $CFG, $PAGE;

        if (strpos($name, '/') === false) {
            throw new coding_exception('Templates names must be specified as "componentname/templatename"' .
                                       ' (' . s($name) . ' requested) ');
        }
        list($component, $templatename) = explode('/', $name, 2);
        $component = clean_param($component, PARAM_COMPONENT);
        if (strpos($templatename, '/') !== false) {
            throw new coding_exception('Templates cannot be placed in sub directories (' . s($name) . ' requested)');
        }

        $dirs = self::get_template_directories_for_component($component, $themename);

        foreach ($dirs as $dir) {
            $candidate = $dir . $templatename . '.mustache';
            if (file_exists($candidate)) {
                return $candidate;
            }
        }

        throw new moodle_exception('filenotfound', 'error', '', null, $name);
    }
525271
private function resolveFile($fileName, $pathNames)
    {
        foreach ($pathNames as $pathName) {
            if (file_exists($file = $pathName . DIRECTORY_SEPARATOR . $fileName)) {
                return $file;
            }
        }

        return null;
    }
450575
protected function resolveFilepath( $view ) {
		$view = $this->resolveRelativeFilepath( $view );
		$file = $this->resolveFromCustomFilepath( $view );

		if ( ! $file ) {
			$file = $this->resolveFromThemeFilepath( $view );
		}

		if ( ! $file ) {
			$file = $this->resolveFromAbsoluteFilepath( $view );
		}

		if ( $file ) {
			$file = realpath( $file );
		}

		return $file;
	}
354525
public function get($filename)
    {
        if ($this->exists($filename) && $this->isFile($filename)) {
            return file_get_contents($filename);
        }

        throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
    }
469392
public function getFilePath($fileName)
    {
        if (file_exists(storage_path('app/'.$fileName))) {
            $filePath = storage_path('app/'.$fileName);
        } else {
            $filePath = Storage::disk(config('cms.storage-location', 'local'))->url($fileName);
        }

        return $filePath;
    }