Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5984165
FileManager.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
FileManager.php
View Options
<?php
/**
* @private
*/
class
Less_FileManager
{
/**
* Get the full absolute path and uri of the import
* @see less-node/FileManager.getPath https://github.com/less/less.js/blob/v2.5.3/lib/less-node/file-manager.js#L70
* @param string $filename
* @param null|array $currentFileInfo
* @return null|array{0:string,1:string}
*/
public
static
function
getFilePath
(
$filename
,
$currentFileInfo
)
{
if
(
!
$filename
)
{
return
;
}
$import_dirs
=
[];
if
(
Less_Environment
::
isPathRelative
(
$filename
)
)
{
// if the path is relative, the file should be in the current directory
if
(
$currentFileInfo
)
{
$import_dirs
[
$currentFileInfo
[
'currentDirectory'
]
]
=
$currentFileInfo
[
'uri_root'
];
}
}
else
{
// otherwise, the file should be relative to the server root
if
(
$currentFileInfo
)
{
$import_dirs
[
$currentFileInfo
[
'entryPath'
]
]
=
$currentFileInfo
[
'entryUri'
];
}
// if the user supplied entryPath isn't the actual root
$import_dirs
[
$_SERVER
[
'DOCUMENT_ROOT'
]
]
=
''
;
}
// always look in user supplied import directories
$import_dirs
=
array_merge
(
$import_dirs
,
Less_Parser
::
$options
[
'import_dirs'
]
);
foreach
(
$import_dirs
as
$rootpath
=>
$rooturi
)
{
if
(
is_callable
(
$rooturi
)
)
{
$res
=
$rooturi
(
$filename
);
if
(
$res
&&
is_string
(
$res
[
0
]
)
)
{
return
[
Less_Environment
::
normalizePath
(
$res
[
0
]
),
Less_Environment
::
normalizePath
(
$res
[
1
]
??
dirname
(
$filename
)
)
];
}
}
elseif
(
!
empty
(
$rootpath
)
)
{
$path
=
rtrim
(
$rootpath
,
'/
\\
'
)
.
'/'
.
ltrim
(
$filename
,
'/
\\
'
);
if
(
file_exists
(
$path
)
)
{
return
[
Less_Environment
::
normalizePath
(
$path
),
Less_Environment
::
normalizePath
(
dirname
(
$rooturi
.
$filename
)
)
];
}
if
(
file_exists
(
$path
.
'.less'
)
)
{
return
[
Less_Environment
::
normalizePath
(
$path
.
'.less'
),
Less_Environment
::
normalizePath
(
dirname
(
$rooturi
.
$filename
.
'.less'
)
)
];
}
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 23:13 (1 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a0/68/67c2694bf2de6539755d70950534
Default Alt Text
FileManager.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment