Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F484263
CelerityResourcesOnDisk.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
CelerityResourcesOnDisk.php
View Options
<?php
/**
* Defines the location of static resources on disk.
*/
abstract
class
CelerityResourcesOnDisk
extends
CelerityResources
{
abstract
public
function
getPathToResources
();
public
function
getResourceData
(
$name
)
{
return
Filesystem
::
readFile
(
$this
->
getPathToResources
().
'/'
.
$name
);
}
public
function
findBinaryResources
()
{
return
$this
->
findResourcesWithSuffixes
(
$this
->
getBinaryFileSuffixes
());
}
public
function
findTextResources
()
{
return
$this
->
findResourcesWithSuffixes
(
$this
->
getTextFileSuffixes
());
}
protected
function
getBinaryFileSuffixes
()
{
return
array
(
'png'
,
'jpg'
,
'gif'
,
'swf'
,
);
}
protected
function
getTextFileSuffixes
()
{
return
array
(
'js'
,
'css'
,
);
}
private
function
findResourcesWithSuffixes
(
array
$suffixes
)
{
$root
=
$this
->
getPathToResources
();
$finder
=
id
(
new
FileFinder
(
$root
))
->
withType
(
'f'
)
->
withFollowSymlinks
(
true
)
->
setGenerateChecksums
(
true
);
foreach
(
$suffixes
as
$suffix
)
{
$finder
->
withSuffix
(
$suffix
);
}
$raw_files
=
$finder
->
find
();
$results
=
array
();
foreach
(
$raw_files
as
$path
=>
$hash
)
{
$readable
=
Filesystem
::
readablePath
(
$path
,
$root
);
$results
[
$readable
]
=
$hash
;
}
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, May 7, 3:44 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
89877
Default Alt Text
CelerityResourcesOnDisk.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment