PHP 클래스 AssetManager

You can access this class instance via: Yii::app()->getAssetManager() or Yii::app()->assetManager.
상속: extends CAssetManager
파일 보기 프로젝트 열기: openeyes/openeyes 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$isAjaxRequest boolean Is the current request an AJAX request.
$isPrintRequest boolean Is the current request a print request.
$scriptMapping

보호된 프로퍼티들

프로퍼티 타입 설명
$cacheBuster CacheBuster CacheBuster component reference.
$clientScript ClientScript ClientScript component reference.
$css array Pre-registered css files.
$cssPriority integer Default starting css priority.
$js array Pre-registered script files.
$jsPriority integer Default starting script priority.

공개 메소드들

메소드 설명
adjustScriptMapping ( ) Adjust the the client script mapping (for javascript and css files assets).
createUrl ( string $path = null, string $basePathAlias = null, $bustCache = true ) : string Creates an absolute URL to a published asset. Eg: '/path/to/hash/asset.gif?cachebusted'.
getClientScript ( ) : ClientScript
getPublishedPath ( string $path = '', null | string $alias = null ) : string Returns the absolute filesystem path to the published asset.
getPublishedPathOfAlias ( string $alias = null ) : string Returns the published asset path for a given asset directory alias.
init ( ) Initializes the component.
registerCoreCssFile ( string $style = '', null | integer $priority = null, OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL $output = self::OUTPUT_ALL, boolean $preRegister = true ) Register a core style.
registerCoreScript ( string $script = '' ) Register a core (framework) script.
registerCssFile ( string $style = '', null | string | false $basePathAlias = null, null | integer $priority = null, $output = self::OUTPUT_ALL, boolean $preRegister = true ) Register an application style.
registerFiles ( ) Register all assets that were preregistered by priority. This method is required to output the assets in the page.
registerScriptFile ( string $script = '', [type] $basePathAlias = null, [type] $priority = null, $output = self::OUTPUT_ALL, boolean $preRegister = true ) Register an application script.
reset ( )
setCacheBuster ( CacheBuster $cacheBuster ) Set the CacheBuster reference.
setClientScript ( ClientScript $clientScript ) Set the ClientScript reference.

보호된 메소드들

메소드 설명
addOrderedCssFile ( string $path, integer $priority = 200, $output = self::OUTPUT_ALL ) (Pre)register a CSS file with a priority to allow ordering.
addOrderedScriptFile ( string $path, integer $priority = 200, $output = self::OUTPUT_ALL ) (Pre)register a JS file with a priority to allow ordering.
canOutput ( OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL $output = null ) : boolean Determines whether an asset should be output for the current request.
registerOrderedCssFiles ( ) Registers all CSS files that were preregistered by priority.
registerOrderedScriptFiles ( ) Registers all JS files that were preregistered by priority.
sort ( array &$arr ) Sorts an array by priority.

메소드 상세

addOrderedCssFile() 보호된 메소드

(Pre)register a CSS file with a priority to allow ordering.
protected addOrderedCssFile ( string $path, integer $priority = 200, $output = self::OUTPUT_ALL )
$path string
$priority integer

addOrderedScriptFile() 보호된 메소드

(Pre)register a JS file with a priority to allow ordering.
protected addOrderedScriptFile ( string $path, integer $priority = 200, $output = self::OUTPUT_ALL )
$path string
$priority integer

adjustScriptMapping() 공개 메소드

If a Yii widget is being used in an Ajax request, all dependent scripts and stylesheets will be outputted in the response. This method ensures the core scripts and stylesheets are not outputted in an Ajax response.
public adjustScriptMapping ( )

canOutput() 보호된 메소드

Determines whether an asset should be output for the current request.
protected canOutput ( OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL $output = null ) : boolean
$output OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL The output type.
리턴 boolean Whether the asset should be output.

createUrl() 공개 메소드

Creates an absolute URL to a published asset. Eg: '/path/to/hash/asset.gif?cachebusted'.
public createUrl ( string $path = null, string $basePathAlias = null, $bustCache = true ) : string
$path string The path to the asset. Eg: 'img/cat.gif'
$basePathAlias string The alias path to the base location of the asset. Eg: 'application.modules.mymodule.assets'
리턴 string The absolute path to the published asset.

getClientScript() 공개 메소드

public getClientScript ( ) : ClientScript
리턴 ClientScript

getPublishedPath() 공개 메소드

Returns the absolute filesystem path to the published asset.
public getPublishedPath ( string $path = '', null | string $alias = null ) : string
$path string Relative path to asset.
$alias null | string Alias path to the base location of the asset.
리턴 string The absolute path.

getPublishedPathOfAlias() 공개 메소드

Returns the published asset path for a given asset directory alias.
public getPublishedPathOfAlias ( string $alias = null ) : string
$alias string The alias to the assets.
리턴 string The publish assets path.

init() 공개 메소드

Initializes the component.
public init ( )

registerCoreCssFile() 공개 메소드

Register a core style.
public registerCoreCssFile ( string $style = '', null | integer $priority = null, OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL $output = self::OUTPUT_ALL, boolean $preRegister = true )
$style string The core style string to be registered. Eg: 'dir/file.css'
$priority null | integer The priority for the asset. Higher priority styles will be outputted in the page first.
$output OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL The output type.
$preRegister boolean Pre-register the asset (if set to false, priority will be ignored)

registerCoreScript() 공개 메소드

Register a core (framework) script.
public registerCoreScript ( string $script = '' )
$script string The core script to be registered. Eg: 'jquery'

registerCssFile() 공개 메소드

Register an application style.
public registerCssFile ( string $style = '', null | string | false $basePathAlias = null, null | integer $priority = null, $output = self::OUTPUT_ALL, boolean $preRegister = true )
$style string The style path. Eg: 'css/style.css'
$basePathAlias null | string | false The alias for the basepath. Eg: 'application.modules.mymodule.assets'
$priority null | integer The priority for the asset. Higher priority styles will be outputted in the page first.
$preRegister boolean Pre-register the asset (if set to false, priority and output will be ignored)

registerFiles() 공개 메소드

Register all assets that were preregistered by priority. This method is required to output the assets in the page.
public registerFiles ( )

registerOrderedCssFiles() 보호된 메소드

Registers all CSS files that were preregistered by priority.
protected registerOrderedCssFiles ( )

registerOrderedScriptFiles() 보호된 메소드

Registers all JS files that were preregistered by priority.

registerScriptFile() 공개 메소드

Register an application script.
public registerScriptFile ( string $script = '', [type] $basePathAlias = null, [type] $priority = null, $output = self::OUTPUT_ALL, boolean $preRegister = true )
$script string The script path. Eg: 'js/script.js'
$basePathAlias [type]
$priority [type]
$preRegister boolean Pre-register the asset (if set to false, priority and output will be ignored)

reset() 공개 메소드

public reset ( )

setCacheBuster() 공개 메소드

Set the CacheBuster reference.
public setCacheBuster ( CacheBuster $cacheBuster )
$cacheBuster CacheBuster The CacheBuster instance.

setClientScript() 공개 메소드

Set the ClientScript reference.
public setClientScript ( ClientScript $clientScript )
$clientScript ClientScript The ClientScript instance.

sort() 보호된 메소드

Sorts an array by priority.
protected sort ( array &$arr )
$arr array The array to sort.

프로퍼티 상세

$cacheBuster 보호되어 있는 프로퍼티

CacheBuster component reference.
protected CacheBuster $cacheBuster
리턴 CacheBuster

$clientScript 보호되어 있는 프로퍼티

ClientScript component reference.
protected ClientScript $clientScript
리턴 ClientScript

$css 보호되어 있는 프로퍼티

Pre-registered css files.
protected array $css
리턴 array

$cssPriority 보호되어 있는 프로퍼티

Default starting css priority.
protected int $cssPriority
리턴 integer

$isAjaxRequest 공개적으로 프로퍼티

Is the current request an AJAX request.
public bool $isAjaxRequest
리턴 boolean

$isPrintRequest 공개적으로 프로퍼티

Is the current request a print request.
public bool $isPrintRequest
리턴 boolean

$js 보호되어 있는 프로퍼티

Pre-registered script files.
protected array $js
리턴 array

$jsPriority 보호되어 있는 프로퍼티

Default starting script priority.
protected int $jsPriority
리턴 integer

$scriptMapping 공개적으로 정적으로 프로퍼티

public static $scriptMapping