Locate a definition file

@param   string $filename The name of the XML file

@return  string|null  The path, if found, null else
428602
public function locate($filename)
    {
        $basename = preg_replace('~\.[^.]+$~', '', basename($filename));

        if (isset($this->map[$basename])) {
            return $this->root . '/' . $this->map[$basename];
        }

        return null;
    }
10262
public function isFile($filename)
    {
        $absolutePath = $this->parser->absoluteFilePath($filename);

        return file_exists($absolutePath) && is_file($absolutePath) ? $absolutePath : null;
    }
898446
static public function getUploadFileRelativePath($filename)
    {
        if ($filename) {
            $filename = str_replace('\\', '/', $filename);
            
            $filename = str_replace(static::getUploadUrl(), '', $filename);
            
            $filename = trim(str_replace(static::getUploadPath(), '', $filename), '/');
            
            if (strpos($filename, 'http') === 0) {
                $filename = str_replace(static::getRootUrl(), '', $filename);
            }
        }
        
        return $filename;
    }
1075284
protected function locateFile($file)
    {
        $this->locateFile && $file = call_user_func($this->locateFile, $file);

        return $file;
    }
1163816
protected static function trimRootPath( $fileName )
	{
		$rootPath	= realpath( getEnv( 'DOCUMENT_ROOT' ) );
		if( strlen( trim( $fileName ) ) && $rootPath )
			$fileName	= preg_replace( "/^".preg_quote( $rootPath.'/', '/' )."/", "", $fileName );
		return $fileName;
	}
1272167
public function getFilePath($fileName = null)
    {
        if ($fileName === null) {
            $fileName = $this->fileName;
        }

        return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName;
    }
1214636
private function extractIdentifier( $filename )
    {
        // Regex to split up the file name into id, attributes and extension
        $regex = '(
            (?:' . preg_quote( $this->properties['location'] ) . ')
            (?P<id>.*)
            (?P<attr>(?:-[^-=]+=[^-]+)*)
            -? # This is added if no attributes are supplied. For whatever reason...
            (?P<ext>' . preg_quote( $this->options->extension ) . ')
        )Ux';

        if ( preg_match( $regex, $filename, $matches ) !== 1 )
        {
            // @TODO: Should this be an exception?
            return array(
                'id'         => '',
                'attributes' => '',
                'extension'  => $this->options->extension,
            );
        }
        else
        {
            // Successfully split
            return array(
                'id'         => $matches['id'],
                'attributes' => $matches['attr'],
                'extension'  => $matches['ext'],
            );
        }
    }
506807
public function getPathFromFile($filename)
	{
		$i = strrpos($filename, self::getSlash());

		if ($i!== false)
		{
			return substr($filename, 0, $i);
		}
		else
		{
			return $filename;
		}
	}
649672
public function findDefinition(string $name)
    {
        $name = $this->normalizeDefinitionName($name);

        foreach ($this->definitions as $definition) {
            if ($definition->getName() === $name) {
                return $definition;
            }
        }

        return null;
    }
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 . ' ].');
    }
1007151
public function getFilePath($filename)
    {
        $filename = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $filename);

        if (is_file($filename)) {
            return realpath($filename);
        } else {
            $viewsDirectories = array_merge([
                PATH_KERNEL . 'Views' . DIRECTORY_SEPARATOR,
                PATH_FRAMEWORK . 'Views' . DIRECTORY_SEPARATOR,
            ], $this->filePaths);

            $viewsDirectories = array_unique($viewsDirectories);
            $viewsDirectories = array_reverse($viewsDirectories);

            $controllerSubDir = services('controller')->getParameter() . DIRECTORY_SEPARATOR;

            foreach ($viewsDirectories as $viewsDirectory) {
                $filename = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $filename);

                // Find specific view file for mobile version
                if (services('userAgent')->isMobile()) {
                    // Find without controller parameter as sub directory
                    if (is_file($filePath = $viewsDirectory . $filename . '.mobile.phtml')) {
                        return realpath($filePath);
                        break;
                    }

                    // Find without controller parameter as sub directory
                    if (is_file($filePath = $viewsDirectory . $controllerSubDir . $filename . '.mobile.phtml')) {
                        return realpath($filePath);
                        break;
                    }
                }

                // Find without controller parameter as sub directory
                if (is_file($filePath = $viewsDirectory . $filename . '.phtml')) {
                    return realpath($filePath);
                    break;
                }

                // Find without controller parameter as sub directory
                if (is_file($filePath = $viewsDirectory . $controllerSubDir . $filename . '.phtml')) {
                    return realpath($filePath);
                    break;
                }
            }
        }

        return false;
    }
636708
public static function load( $fileName )
	{
		$parser	= new XML_DOM_Parser();
		$xml	= FS_File_Reader::load( $fileName );
		$tree	= $parser->parse( $xml );
		return $tree;
	}
1078522
protected function findSchemaFile($fileName)
    {
        // check if we got a specific schema file we have to use, otherwise use the default one
        $this->schemaFile = realpath(__DIR__ . '/../../../../../') . DIRECTORY_SEPARATOR . self::DEFAULT_XML_SCHEMA;
        $fileName = pathinfo($fileName, PATHINFO_FILENAME);
        if (isset($this->schemaFiles[$fileName])) {
            $this->schemaFile = $this->schemaFiles[$fileName];
        }
    }
604007
protected function getFullPath($fileName)
    {
        if (!is_string($fileName)) {
            throw new \InvalidArgumentException('the given path is invalid');
        }

        $fileName = trim($fileName);

        if (realpath($fileName) && !(basename($fileName) === $fileName)) {
            return realpath($fileName);
        }

        $fullName = implode(DIRECTORY_SEPARATOR, array($this->configurationFileDir, $fileName));

        if (file_exists($fullName)) {
            return realpath($fullName);
        }

        throw new \InvalidArgumentException('The specified path \'' . $fullName . '\' does not exist');
    }
359561
protected function getXsltUriFromFilename($filename)
    {
        // Windows requires an additional / after the scheme. If not provided then errno 22 (I/O Error: Invalid
        // Argument) will be raised. Thanks to @FnTmLV for finding the cause. See issue #284 for more information.
        // An exception to the above is when running from a Phar file; in this case the stream is handled as if on
        // linux; see issue #713 for more information on this exception.
        if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' && ! \Phar::running()) {
            $filename = '/' . $filename;
        }

        return 'file://' . $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;
    }
407887
protected static function getXmlFilename($filename) {
        if ( strpos($filename, '/') === false ) {
            $filename = APP_PATH."build/{$filename}";
        }
        if ( strpos($filename, '.xml') === false ) {
            $filename .= ".xml";
        }
        return $filename;
    }