XOOPS  2.6.0
Xoops\Core\Assets Class Reference

Public Member Functions

 __construct ()
 
 copyFileAssets ($from_path, $pattern, $output)
 
 getUrlToAssets ($type, $assets, $filters= 'default', $target=null)
 
 registerAssetReference ($name, $assets, $filters=null)
 
 setDebug ($debug)
 

Protected Member Functions

 readAssetsPrefs ()
 
 saveAssetsPrefs ($assets_prefs)
 

Private Attributes

 $assetManager = null
 
 $assetsPrefsCacheKey = 'system/assets/prefs'
 
 $assetsPrefsFilename = 'var/configs/system_assets_prefs.yml'
 
 $debug = false
 
 $default_asset_refs
 
 $default_filters
 
 $default_output
 
 $filterInterface = '\Assetic\Filter\FilterInterface'
 

Detailed Description

Definition at line 36 of file Assets.php.

Constructor & Destructor Documentation

Xoops\Core\Assets::__construct ( )

__construct

Returns
void

Definition at line 105 of file Assets.php.

References Xoops\Core\Assets\readAssetsPrefs(), Xoops\Core\Assets\registerAssetReference(), and Xoops\Core\Assets\setDebug().

Here is the call graph for this function:

Member Function Documentation

Xoops\Core\Assets::copyFileAssets (   $from_path,
  $pattern,
  $output 
)

copyFileAssets - copy files to the appropriate asset directory.

Copying is normally only needed for fonts or images when they are referenced by a relative url in stylesheet, or are located outside of the web root.

Parameters
string$from_pathpath to files to copy
string$patternglob pattern to match files to be copied
string$outputoutput type (css, fonts, images, js)
Returns
mixed boolean false if target directory is not writable, otherwise integer count of files copied

Definition at line 431 of file Assets.php.

References $count, $oldUmask, $status, $xoops, and Xoops\getInstance().

Here is the call graph for this function:

Xoops\Core\Assets::getUrlToAssets (   $type,
  $assets,
  $filters = 'default',
  $target = null 
)

getUrlToAssets

Create an asset file from a list of assets

Parameters
string$typetype of asset, css or js
array$assetslist of source files to process
string | array$filterseither a comma separated list of known namsed filters or an array of named filters and/or filter object
string$targettarget path, will default to assets directory
Returns
string URL to asset file

Definition at line 202 of file Assets.php.

References Xoops\Core\Assets\$assetManager, $filter, $target, $type, $xoops, and Xoops\getInstance().

Here is the call graph for this function:

Xoops\Core\Assets::readAssetsPrefs ( )
protected

readAssetsPrefs - read configured asset preferences

Returns
array of assets preferences

Definition at line 123 of file Assets.php.

References $file, $mtime, $xoops, Xoops\getInstance(), Xoops\Core\Yaml\read(), and Xoops\Core\Assets\saveAssetsPrefs().

Referenced by Xoops\Core\Assets\__construct().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Assets::registerAssetReference (   $name,
  $assets,
  $filters = null 
)

Add an asset reference to the asset manager

Parameters
string$namethe name of the reference to be added
mixed$assetsa string asset path, or an array of asset paths, may include wildcard
string | array$filterseither a comma separated list of known named filters or an array of named filters and/or filter object
Returns
boolean true if asset registers, false on error

Definition at line 344 of file Assets.php.

References $filter, $name, $xoops, and Xoops\getInstance().

Referenced by Xoops\Core\Assets\__construct().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Assets::saveAssetsPrefs (   $assets_prefs)
protected

saveAssetsPrefs - record array of assets preferences in config file, and update cache

Parameters
array$assets_prefsarray of asset preferences to save
Returns
void

Definition at line 175 of file Assets.php.

References $xoops, Xoops\getInstance(), and Xoops\Core\Yaml\save().

Referenced by Xoops\Core\Assets\readAssetsPrefs().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Assets::setDebug (   $debug)

setDebug enable debug mode, will skip filters prefixed with '?'

Parameters
boolean$debugtrue to enable debug mode
Returns
void

Definition at line 328 of file Assets.php.

References Xoops\Core\Assets\$debug.

Referenced by Xoops\Core\Assets\__construct().

Here is the caller graph for this function:

Member Data Documentation

Xoops\Core\Assets::$assetManager = null
private

Definition at line 83 of file Assets.php.

Referenced by Xoops\Core\Assets\getUrlToAssets().

Xoops\Core\Assets::$assetsPrefsCacheKey = 'system/assets/prefs'
private

Definition at line 93 of file Assets.php.

Xoops\Core\Assets::$assetsPrefsFilename = 'var/configs/system_assets_prefs.yml'
private

Definition at line 88 of file Assets.php.

Xoops\Core\Assets::$debug = false
private

Definition at line 41 of file Assets.php.

Referenced by Xoops\Core\Assets\setDebug().

Xoops\Core\Assets::$default_asset_refs
private
Initial value:
= array(
array(
'name' => 'jquery',
'assets' => array('media/jquery/jquery.js'),
'filters' => null,
),
array(
'name' => 'jqueryui',
'assets' => array('media/jquery/ui/jquery-ui.js'),
'filters' => null,
),
array(
'name' => 'jgrowl',
'assets' => array('media/jquery/plugins/jquery.jgrowl.js'),
'filters' => null,
),
)

Definition at line 62 of file Assets.php.

Xoops\Core\Assets::$default_filters
private
Initial value:
= array(
'css' => 'cssimport,cssembed,?cssmin',
'js' => '?jsmin',
)

Definition at line 46 of file Assets.php.

Xoops\Core\Assets::$default_output
private
Initial value:
= array(
'css' => 'css/*.css',
'js' => 'js/*.js',
)

Definition at line 54 of file Assets.php.

Xoops\Core\Assets::$filterInterface = '\Assetic\Filter\FilterInterface'
private

Definition at line 99 of file Assets.php.


The documentation for this class was generated from the following file: