PHP 클래스 Craft\MinimeeService

상속: extends craft\BaseApplicationComponent
파일 보기 프로젝트 열기: johndwells/craft.minimee

보호된 프로퍼티들

프로퍼티 타입 설명
$_assets the trigger we use for our own resources
$_cacheBase css or js
$_cacheTimestamp a concat of all asset filenames together
$_deprecatedSettingsMap static array of settings, a merge of DB and filesystem settings
$_pluginSettings instance of Minimee_SettingsModel
$_settings max timestamp of all assets
$_type array of Minimee_AssetModelInterface

공개 메소드들

메소드 설명
deleteExpiredCache ( ) : void Based on the cache's hashed base, attempts to delete any older versions of same name.
init ( ) : void During startup, fetch settings from our plugin / config
makePathToStorageFolder ( ) : String
makeTagsByType ( String $type, Array $assets = [] ) : String Generate the HTML tag based on type
makeTwigMarkupFromHtml ( $html ) : Twig_Markup Wrapper for how we must return a twig option rather than raw HTML
run ( String $type, Array $assets, Array $settings = [] ) : Array | Bool Main service function that encapsulates an entire Minimee run

보호된 메소드들

메소드 설명
abort ( String $e, String $level = LogLevel::Error ) : Bool Internal function used when aborting due to error
appendToCacheBase ( String $name ) : Void Append an asset's name to the cacheBase
cacheExists ( ) : Bool Checks if the cache exists.
checkHeaders ( ) : this Validate all assets prior to run.
createCache ( ) : boolean Creates cache of assets.
ensureCacheExists ( ) : MinimeeService Fetch or creates cache.
flightcheck ( ) : this Perform pre-flight checks to ensure we can run.
getAssets ( ) : Array
getCacheBase ( ) : string
getCacheTimestamp ( ) : String
getPluginSettings ( ) : Array get our plugin / config settings
getSettings ( ) : Minimee_SettingsModel
getType ( ) : String
initPluginSettings ( ) : Void Fetch settings from our plugin / config
isCombineEnabled ( ) : boolean | null Return whether we should combine our cache or not
isUrl ( $string ) : boolean Determine if string is valid URL
makeCacheFilename ( ) : String Returns a complete cache filename.
makeHashOfCacheBase ( ) : String
makePathToCacheFilename ( ) : String
makePathToHashOfCacheBase ( ) : String
makeReturn ( ) : String
makeUrlToCacheFilename ( ) : String
minifyAsset ( Minimee_BaseAssetModel $asset ) : String Given an asset, fetches and returns minified contents.
minifyCssAsset ( Minimee_BaseAssetModel $asset ) : String Method to (maybe) minify CSS asset
minifyJsAsset ( Minimee_BaseAssetModel $asset ) : String Method to (maybe) minify JS asset
onCreateCache ( $event ) : Void Raise our 'onCreateCache' event
reset ( ) : this Safely resets service to prepare for a clean run.
setAssets ( Array $assets ) : this
setCacheBase ( String $name ) : MinimeeService
setCacheTimestamp ( String $timestamp ) : MinimeeService
setMaxCacheTimestamp ( craft\DateTime $lastTimeModified ) : MinimeeService
setPluginSettings ( $settings = [] ) : Void set plugin / config settings
setRuntimeSettings ( Array $settingsOverrides ) : MinimeeService Configure our service based off the settings in plugin, allowing plugin settings to be overridden at runtime.
setSettings ( craft\Minimee_ISettingsModel $settings ) : MinimeeService Manually pass in an instance of Minimee_ISettingsModel.
setType ( String $type ) : this
supportLegacyNamesAtRuntime ( Array $runtimeSettings = [] ) : Array Handle backwards-compat for 'cssTagTemplate' and 'jsTagTemplate' setting names.
supportLegacyNamesFromConfig ( Array $settings = [] ) : Array Handle backwards-compat for 'cssTagTemplate' and 'jsTagTemplate' setting names.

메소드 상세

abort() 보호된 메소드

Internal function used when aborting due to error
protected abort ( String $e, String $level = LogLevel::Error ) : Bool
$e String
$level String
리턴 Bool

appendToCacheBase() 보호된 메소드

Append an asset's name to the cacheBase
protected appendToCacheBase ( String $name ) : Void
$name String
리턴 Void

cacheExists() 보호된 메소드

Checks if the cache exists.
protected cacheExists ( ) : Bool
리턴 Bool

checkHeaders() 보호된 메소드

Validate all assets prior to run.
protected checkHeaders ( ) : this
리턴 this

createCache() 보호된 메소드

Creates cache of assets.
protected createCache ( ) : boolean
리턴 boolean

deleteExpiredCache() 공개 메소드

Based on the cache's hashed base, attempts to delete any older versions of same name.
public deleteExpiredCache ( ) : void
리턴 void

ensureCacheExists() 보호된 메소드

Fetch or creates cache.
protected ensureCacheExists ( ) : MinimeeService
리턴 MinimeeService

flightcheck() 보호된 메소드

Perform pre-flight checks to ensure we can run.
protected flightcheck ( ) : this
리턴 this

getAssets() 보호된 메소드

protected getAssets ( ) : Array
리턴 Array

getCacheBase() 보호된 메소드

protected getCacheBase ( ) : string
리턴 string

getCacheTimestamp() 보호된 메소드

protected getCacheTimestamp ( ) : String
리턴 String

getPluginSettings() 보호된 메소드

get our plugin / config settings
protected getPluginSettings ( ) : Array
리턴 Array

getSettings() 보호된 메소드

protected getSettings ( ) : Minimee_SettingsModel
리턴 Minimee_SettingsModel

getType() 보호된 메소드

protected getType ( ) : String
리턴 String

init() 공개 메소드

During startup, fetch settings from our plugin / config
public init ( ) : void
리턴 void

initPluginSettings() 보호된 메소드

Fetch settings from our plugin / config
protected initPluginSettings ( ) : Void
리턴 Void

isCombineEnabled() 보호된 메소드

Return whether we should combine our cache or not
protected isCombineEnabled ( ) : boolean | null
리턴 boolean | null

isUrl() 보호된 메소드

Determine if string is valid URL
protected isUrl ( $string ) : boolean
리턴 boolean TRUE if yes, FALSE if no

makeCacheFilename() 보호된 메소드

If a "Resource" cache, format is: hashOfCacheBase.type e.g. asdf1234.css Otherwise, format is: hashOfCacheBase.timestamp.type e.g. asdf1234.12345678.css
protected makeCacheFilename ( ) : String
리턴 String

makeHashOfCacheBase() 보호된 메소드

protected makeHashOfCacheBase ( ) : String
리턴 String

makePathToCacheFilename() 보호된 메소드

protected makePathToCacheFilename ( ) : String
리턴 String

makePathToHashOfCacheBase() 보호된 메소드

protected makePathToHashOfCacheBase ( ) : String
리턴 String

makePathToStorageFolder() 공개 메소드

public makePathToStorageFolder ( ) : String
리턴 String

makeReturn() 보호된 메소드

protected makeReturn ( ) : String
리턴 String

makeTagsByType() 공개 메소드

Generate the HTML tag based on type
public makeTagsByType ( String $type, Array $assets = [] ) : String
$type String
$assets Array
리턴 String

makeTwigMarkupFromHtml() 공개 메소드

Wrapper for how we must return a twig option rather than raw HTML
public makeTwigMarkupFromHtml ( $html ) : Twig_Markup
리턴 Twig_Markup

makeUrlToCacheFilename() 보호된 메소드

protected makeUrlToCacheFilename ( ) : String
리턴 String

minifyAsset() 보호된 메소드

Given an asset, fetches and returns minified contents.
protected minifyAsset ( Minimee_BaseAssetModel $asset ) : String
$asset Minimee_BaseAssetModel
리턴 String

minifyCssAsset() 보호된 메소드

Method to (maybe) minify CSS asset
protected minifyCssAsset ( Minimee_BaseAssetModel $asset ) : String
$asset Minimee_BaseAssetModel
리턴 String

minifyJsAsset() 보호된 메소드

Method to (maybe) minify JS asset
protected minifyJsAsset ( Minimee_BaseAssetModel $asset ) : String
$asset Minimee_BaseAssetModel
리턴 String

onCreateCache() 보호된 메소드

Raise our 'onCreateCache' event
protected onCreateCache ( $event ) : Void
리턴 Void

reset() 보호된 메소드

Safely resets service to prepare for a clean run.
protected reset ( ) : this
리턴 this

run() 공개 메소드

Main service function that encapsulates an entire Minimee run
public run ( String $type, Array $assets, Array $settings = [] ) : Array | Bool
$type String
$assets Array
$settings Array
리턴 Array | Bool

setAssets() 보호된 메소드

protected setAssets ( Array $assets ) : this
$assets Array
리턴 this

setCacheBase() 보호된 메소드

protected setCacheBase ( String $name ) : MinimeeService
$name String
리턴 MinimeeService

setCacheTimestamp() 보호된 메소드

protected setCacheTimestamp ( String $timestamp ) : MinimeeService
$timestamp String
리턴 MinimeeService

setMaxCacheTimestamp() 보호된 메소드

protected setMaxCacheTimestamp ( craft\DateTime $lastTimeModified ) : MinimeeService
$lastTimeModified craft\DateTime
리턴 MinimeeService

setPluginSettings() 보호된 메소드

set plugin / config settings
protected setPluginSettings ( $settings = [] ) : Void
리턴 Void

setRuntimeSettings() 보호된 메소드

Configure our service based off the settings in plugin, allowing plugin settings to be overridden at runtime.
protected setRuntimeSettings ( Array $settingsOverrides ) : MinimeeService
$settingsOverrides Array
리턴 MinimeeService

setSettings() 보호된 메소드

Manually pass in an instance of Minimee_ISettingsModel.
protected setSettings ( craft\Minimee_ISettingsModel $settings ) : MinimeeService
$settings craft\Minimee_ISettingsModel
리턴 MinimeeService

setType() 보호된 메소드

protected setType ( String $type ) : this
$type String
리턴 this

supportLegacyNamesAtRuntime() 보호된 메소드

Remove in 1.x release!
protected supportLegacyNamesAtRuntime ( Array $runtimeSettings = [] ) : Array
$runtimeSettings Array
리턴 Array

supportLegacyNamesFromConfig() 보호된 메소드

Remove in 1.x release!
protected supportLegacyNamesFromConfig ( Array $settings = [] ) : Array
$settings Array
리턴 Array

프로퍼티 상세

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

the trigger we use for our own resources
protected $_assets

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

css or js
protected $_cacheBase

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

a concat of all asset filenames together
protected $_cacheTimestamp

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

static array of settings, a merge of DB and filesystem settings
protected $_deprecatedSettingsMap

$_pluginSettings 보호되어 있는 정적으로 프로퍼티

instance of Minimee_SettingsModel
protected static $_pluginSettings

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

max timestamp of all assets
protected $_settings

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

array of Minimee_AssetModelInterface
protected $_type