Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56957751
Assets.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Assets.php
View Options
<?php
namespace
AuthGrove\Assets
;
class
Assets
{
const
ASSETS_DIRECTORY
=
'resources/assets/'
;
/**
* Gets application root directory
*
* @return string
*/
static
public
function
getRootDirectory
()
{
// We're in app/Assets, so we need to get twice to the parent directory.
return
dirname
(
dirname
(
__DIR__
));
}
static
public
function
getAssetsDirectory
()
{
return
static
::
getRootDirectory
()
.
'/'
.
static
::
ASSETS_DIRECTORY
;
}
static
private
function
getAssetExtension
(
$type
)
{
return
$type
;
}
static
public
function
getAssetFilename
(
$type
,
$name
)
{
return
static
::
getAssetsDirectory
()
.
"$type/$name."
.
static
::
getAssetExtension
(
$type
)
;
}
/**
* Checks the resource has a valid format for coherence and to avoid
* exploits trying to load an arbitrary resource URL.
*
* @param $name string The resource name
* @return bool true if the resource name is valid; otherwise, false.
*/
static
public
function
isValidAssetName
(
$name
)
{
return
preg_match
(
'/^[A-Za-z0-9
\-
_]*$/'
,
$name
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 13, 17:44 (3 d, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4258129
Default Alt Text
Assets.php (1 KB)
Attached To
Mode
rGROVE Auth Grove
Attached
Detach File
Event Timeline
Log In to Comment