Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F44414382
Assets.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
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 sanity 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
Tue, Aug 18, 23:08 (23 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3928303
Default Alt Text
Assets.php (1 KB)
Attached To
Mode
rGROVE Auth Grove
Attached
Detach File
Event Timeline
Log In to Comment