Asset
Table of Contents
Constants
- HEADER_END_TAG = "\"*/"
- HEADER_START_TAG = "; /* Start:\""
- SOURCE_MAP_TAG = "\n//# sourceMappingURL="
- version = 1
Methods
- addCss() : bool
- Add some css to asset.
- addCssKernelInfo() : void
- Add information about kernel module css.
- addJs() : bool
- Add some js to asset.
- addJsKernelInfo() : void
- Add information about kernel js modules.
- addString() : bool
- Add string asset.
- canMoveJsToBody() : bool
- canUseMinifiedAssets() : bool|null
- compositeTarget() : bool
- Set composite mode for set.
- disableOptimizeCss() : void
- Stop optimizing css
- disableOptimizeJs() : void
- Stop optimizing js
- enableOptimizeCss() : void
- Start optimizing css
- enableOptimizeJs() : void
- Start optimizing js
- fixCssIncludes() : mixed
- Replace path to includes in css.
- getAssetInfo() : array<string|int, mixed>
- Return information about target assets.
- getAssetPath() : string
- Remove from file path any parametrs.
- getAssetTime() : bool|string
- Get time for current asset.
- getCss() : string
- Return css or page.
- getFullAssetPath() : string|null
- Gets asset path.
- getInstance() : Asset
- Singleton instance.
- getJs() : string
- Return JS page assets.
- getLocationByName() : AssetLocation
- Convert location for new format.
- getShowHeadString() : bool
- Return true if ShowHeadString exist in page.
- getStrings() : string
- Return strings assets.
- getTarget() : mixed
- getTargetList() : array<string|int, mixed>
- Return list of all targets on the page.
- getTargetName() : string
- groupCss() : void
- Group some css modules.
- groupJs() : void
- Group some js modules.
- gzipEnabled() : bool|null
- Returns gzip enabled or not.
- insertCss() : string
- Insert inline css.
- insertJs() : string
- insert inline js.
- isKernelCSS() : array<string|int, mixed>|bool
- Return information about file and check is it in kernel pack.
- isKernelJS() : array<string|int, mixed>|bool
- Return information about file and check is it in kernel pack.
- moveJs() : void
- Move js kernel module to BODY.
- optimizeCss() : bool
- optimizeJs() : bool
- replaceUrlCss() : string
- Replace path to includes in line.
- setAjax() : Asset
- Set Ajax mode and restart instance
- setJsToBody() : void
- Enables or disables the moving of all scripts to the body.
- setMaxCss() : void
- setMode() : void
- Set mode for current target.
- setShowBodyScript() : void
- Return true if ShowHeadBodyScript exist in page.
- setShowHeadScript() : void
- Set ShowHeadScript in page or not.
- setShowHeadString() : void
- Set ShowHeadString in page or not.
- setUnique() : bool
- Sets unique mode for set.
- setXhtml() : void
- showFilesList() : string
- Insert JS code to sets assets included in page.
- sliceKernel() : bool
- startSet() : bool
- Temporary fix for update system. Need to delete later.
- startTarget() : bool
- Start new target for asset.
- stopTarget() : bool
- Stop current target.
- write() : bool
- Write optimized css, js files or info file.
Constants
HEADER_END_TAG
public
mixed
HEADER_END_TAG
= "\"*/"
HEADER_START_TAG
public
mixed
HEADER_START_TAG
= "; /* Start:\""
SOURCE_MAP_TAG
public
mixed
SOURCE_MAP_TAG
= "\n//# sourceMappingURL="
version
public
mixed
version
= 1
Methods
addCss()
Add some css to asset.
public
addCss(string $path[, bool $additional = false ]) : bool
Parameters
- $path : string
-
Path to css file.
- $additional : bool = false
-
Is additional file.
Return values
booladdCssKernelInfo()
Add information about kernel module css.
public
addCssKernelInfo([string $module = '' ][, array<string|int, mixed> $css = [] ][, array<string|int, mixed> $settings = [] ]) : void
Parameters
- $module : string = ''
-
Module name.
- $css : array<string|int, mixed> = []
-
Css files.
- $settings : array<string|int, mixed> = []
-
Settings.
addJs()
Add some js to asset.
public
addJs(string $path[, bool $additional = false ]) : bool
Parameters
- $path : string
-
Path to js file.
- $additional : bool = false
-
Is additional file.
Return values
booladdJsKernelInfo()
Add information about kernel js modules.
public
addJsKernelInfo([string $module = '' ][, array<string|int, mixed> $js = [] ][, array<string|int, mixed> $settings = [] ]) : void
Parameters
- $module : string = ''
-
Module name.
- $js : array<string|int, mixed> = []
-
Js files.
- $settings : array<string|int, mixed> = []
-
Settings.
addString()
Add string asset.
public
addString(string $str[, bool $unique = false ][, string $location = AssetLocation::AFTER_JS_KERNEL ][, null $mode = null ]) : bool
Parameters
- $str : string
-
Added string.
- $unique : bool = false
-
Check string for unique.
- $location : string = AssetLocation::AFTER_JS_KERNEL
-
Where string wheel be showed.
- $mode : null = null
-
Composite mode.
Return values
boolcanMoveJsToBody()
public
canMoveJsToBody() : bool
Return values
boolcanUseMinifiedAssets()
public
static canUseMinifiedAssets() : bool|null
Return values
bool|nullcompositeTarget()
Set composite mode for set.
public
compositeTarget([string $id = '' ]) : bool
Parameters
- $id : string = ''
-
Target ID.
Return values
booldisableOptimizeCss()
Stop optimizing css
public
disableOptimizeCss() : void
disableOptimizeJs()
Stop optimizing js
public
disableOptimizeJs() : void
enableOptimizeCss()
Start optimizing css
public
enableOptimizeCss() : void
enableOptimizeJs()
Start optimizing js
public
enableOptimizeJs() : void
fixCssIncludes()
Replace path to includes in css.
public
static fixCssIncludes(string $content, string $path) : mixed
Parameters
- $content : string
-
Content for replacing path.
- $path : string
-
Path to correct.
getAssetInfo()
Return information about target assets.
public
getAssetInfo(string $id, mixed $mode) : array<string|int, mixed>
Parameters
- $id : string
-
Asset ID.
- $mode : mixed
-
Composite mode.
Return values
array<string|int, mixed>getAssetPath()
Remove from file path any parametrs.
public
static getAssetPath(string $src) : string
Parameters
- $src : string
-
Path to asset file.
Return values
string —path whithout ?xxx.
getAssetTime()
Get time for current asset.
public
static getAssetTime([string $file = '' ]) : bool|string
Parameters
- $file : string = ''
-
File path.
Return values
bool|stringgetCss()
Return css or page.
public
getCss([int $type = AssetShowTargetType::ALL ]) : string
Parameters
- $type : int = AssetShowTargetType::ALL
-
Target type.
Tags
Return values
stringgetFullAssetPath()
Gets asset path.
public
getFullAssetPath(mixed $sourcePath) : string|null
if allowed use minified assets
Parameters
- $sourcePath : mixed
Tags
Return values
string|nullgetInstance()
Singleton instance.
public
static getInstance() : Asset
Return values
AssetgetJs()
Return JS page assets.
public
getJs([int $type = AssetShowTargetType::ALL ]) : string
Parameters
- $type : int = AssetShowTargetType::ALL
-
Target type.
Tags
Return values
stringgetLocationByName()
Convert location for new format.
public
static getLocationByName(mixed $location) : AssetLocation
Parameters
- $location : mixed
-
AssetLocation.
Return values
AssetLocationgetShowHeadString()
Return true if ShowHeadString exist in page.
public
getShowHeadString() : bool
Return values
boolgetStrings()
Return strings assets.
public
getStrings([string $location = AssetLocation::AFTER_JS_KERNEL ]) : string
Parameters
- $location : string = AssetLocation::AFTER_JS_KERNEL
-
Location.
Return values
stringgetTarget()
public
getTarget() : mixed
Return values
mixed —Return current set
getTargetList()
Return list of all targets on the page.
public
getTargetList([string $type = 'CSS' ]) : array<string|int, mixed>
Parameters
- $type : string = 'CSS'
-
Target type CSS or JS.
Return values
array<string|int, mixed> —Return set list with subsets.
getTargetName()
public
getTargetName() : string
Return values
string —- Return current set name
groupCss()
Group some css modules.
public
groupCss([string $from = '' ][, string $to = '' ]) : void
Parameters
- $from : string = ''
-
Module name for packing.
- $to : string = ''
-
Module name for pack.
groupJs()
Group some js modules.
public
groupJs([string $from = '' ][, string $to = '' ]) : void
Parameters
- $from : string = ''
-
Module name for packing.
- $to : string = ''
-
Module name for pack.
gzipEnabled()
Returns gzip enabled or not.
public
static gzipEnabled() : bool|null
Return values
bool|nullinsertCss()
Insert inline css.
public
insertCss(string $css[, mixed $label = false ][, bool $inline = false ]) : string
Parameters
- $css : string
-
Content or file name.
- $label : mixed = false
-
Additional info.
- $inline : bool = false
-
Show inline.
Return values
stringinsertJs()
insert inline js.
public
insertJs(string $js[, mixed $label = '' ][, bool $inline = false ]) : string
Parameters
- $js : string
-
Contet or file path.
- $label : mixed = ''
-
Additional info.
- $inline : bool = false
-
Show inline.
Return values
stringisKernelCSS()
Return information about file and check is it in kernel pack.
public
isKernelCSS(string $css) : array<string|int, mixed>|bool
Parameters
- $css : string
-
File path.
Return values
array<string|int, mixed>|boolisKernelJS()
Return information about file and check is it in kernel pack.
public
isKernelJS(string $js) : array<string|int, mixed>|bool
Parameters
- $js : string
-
File path.
Return values
array<string|int, mixed>|boolmoveJs()
Move js kernel module to BODY.
public
moveJs([string $module = '' ]) : void
Parameters
- $module : string = ''
-
Module name.
optimizeCss()
public
optimizeCss() : bool
Return values
booloptimizeJs()
public
optimizeJs() : bool
Return values
boolreplaceUrlCss()
Replace path to includes in line.
public
static replaceUrlCss(string $url, string $quote, string $path) : string
Parameters
- $url : string
-
Url of css files.
- $quote : string
-
Quote.
- $path : string
-
Path to css.
Return values
string —replaced.
setAjax()
Set Ajax mode and restart instance
public
setAjax() : Asset
Return values
AssetsetJsToBody()
Enables or disables the moving of all scripts to the body.
public
setJsToBody(bool $flag) : void
Parameters
- $flag : bool
-
True or False.
setMaxCss()
public
setMaxCss(int $value) : void
Parameters
- $value : int
-
Count of css files showed inline fore IE.
setMode()
Set mode for current target.
public
setMode([int $mode = AssetMode::STANDARD ]) : void
Parameters
- $mode : int = AssetMode::STANDARD
-
Set current composite mode.
setShowBodyScript()
Return true if ShowHeadBodyScript exist in page.
public
setShowBodyScript([bool $value = true ]) : void
Parameters
- $value : bool = true
-
Set ShowHeadBodyScript is set on page.
setShowHeadScript()
Set ShowHeadScript in page or not.
public
setShowHeadScript([bool $value = true ]) : void
Parameters
- $value : bool = true
-
Set ShowHeadScript is set on page.
setShowHeadString()
Set ShowHeadString in page or not.
public
setShowHeadString([bool $value = true ]) : void
Parameters
- $value : bool = true
-
Set ShowHeadSting is set on page.
setUnique()
Sets unique mode for set.
public
setUnique([string $setID = '' ][, string $uniqueID = '' ]) : bool
Parameters
- $setID : string = ''
-
Target ID.
- $uniqueID : string = ''
-
Unique type.
Return values
boolsetXhtml()
public
setXhtml(bool $value) : void
Parameters
- $value : bool
-
Use xhtml html style.
showFilesList()
Insert JS code to sets assets included in page.
public
showFilesList() : string
Return values
stringsliceKernel()
public
sliceKernel() : bool
Return values
boolstartSet()
Temporary fix for update system. Need to delete later.
public
startSet([string $id = '' ][, int $mode = AssetMode::ALL ]) : bool
Parameters
- $id : string = ''
-
Target ID.
- $mode : int = AssetMode::ALL
-
Composite Mode.
Return values
boolstartTarget()
Start new target for asset.
public
startTarget([string $id = '' ][, int $mode = AssetMode::ALL ]) : bool
Parameters
- $id : string = ''
-
Target ID.
- $mode : int = AssetMode::ALL
-
Composite mode.
Return values
boolstopTarget()
Stop current target.
public
stopTarget([string $id = '' ]) : bool
Parameters
- $id : string = ''
-
Target ID.
Return values
boolwrite()
Write optimized css, js files or info file.
public
write(string $filePath, string $content[, bool $gzip = true ]) : bool
Parameters
- $filePath : string
-
Path for optimized css, js or info file.
- $content : string
-
File contents.
- $gzip : bool = true
-
For disabled gzip.