PHP Class WPLessPlugin

Author: oncletom
Inheritance: extends WPPluginToolkitPlugin
Show file Open project: oncletom/wp-less Class Usage Examples

Public Properties

Property Type Description
$match_pattern used to match stylesheet files to process them as pure CSS

Protected Properties

Property Type Description
$compiler null | WPLessCompiler
$is_filters_registered boolean
$is_hooks_registered boolean

Public Methods

Method Description
__construct ( WPLessConfiguration $configuration )
addImportDir ( string $dir ) Proxy method
addVariable ( $name, $value ) Proxy method
dispatch ( ) Dispatches all events of the plugin
filterStylesheetUri ( string $css, WPLessStylesheet $stylesheet ) : string Correct Stylesheet URI
getCompiler ( )
getImportDir ( ) : array Proxy method
getStyles ( ) : WP_Styles Returns WordPress Styles manager
install ( ) Performs plugin install actions
instantiateCompiler ( )
processEditorStylesheets ( string $mce_css ) : string Compile editor stylesheets registered via add_editor_style()
processStylesheet ( string $handle, $force = false ) : WPLessStylesheet Process a single stylesheet
processStylesheets ( $force = false ) Process all stylesheets to compile just in time
registerFunction ( $name, $callback ) Proxy method
setImportDir ( array $dirs ) Proxy method
setVariables ( array $variables ) Proxy method
uninstall ( ) Performs plugin uninstall actions
unregisterFunction ( $name ) Proxy method

Protected Methods

Method Description
_filterStylesheetUri ( array $matches ) : string Returns a proper url() CSS key with absolute paths if needed
getLessCompilerPath ( ) Load the parent compiler class. This is provided via lessc.inc.php for both the lessphp and less.php implementations
getQueuedStylesToProcess ( ) : array Find any style to process
registerHooks ( ) Method to register hooks (and do it only once)

Method Details

__construct() public method

public __construct ( WPLessConfiguration $configuration )
$configuration WPLessConfiguration

_filterStylesheetUri() protected method

Returns a proper url() CSS key with absolute paths if needed
protected _filterStylesheetUri ( array $matches ) : string
$matches array Expects at least 0, 'uri' and 'quote' keys
return string

addImportDir() public method

Proxy method
See also: lessc::addImportDir()
Since: 1.5.0
public addImportDir ( string $dir )
$dir string

addVariable() public method

Proxy method
See also: http://leafo.net/lessphp/docs/#setting_variables_from_php
Since: 1.4
public addVariable ( $name, $value )

dispatch() public method

Dispatches all events of the plugin
Since: 1.3
Author: oncletom
public dispatch ( )

filterStylesheetUri() public method

It enables the cache without loosing reference to URI
Since: 1.2
Author: oncletom
public filterStylesheetUri ( string $css, WPLessStylesheet $stylesheet ) : string
$css string parsed CSS
$stylesheet WPLessStylesheet
return string parsed and fixed CSS

getCompiler() public method

public getCompiler ( )

getImportDir() public method

Proxy method
See also: WPLessCompiler::getImportDir()
Since: 1.5.0
public getImportDir ( ) : array
return array

getLessCompilerPath() protected method

Load the parent compiler class. This is provided via lessc.inc.php for both the lessphp and less.php implementations
Since: 1.7.1
Author: fabrizim
protected getLessCompilerPath ( )

getQueuedStylesToProcess() protected method

Find any style to process
Since: 1.0
Author: oncletom
protected getQueuedStylesToProcess ( ) : array
return array styles to process

getStyles() public method

Returns WordPress Styles manager
Since: 1.0
Author: oncletom
public getStyles ( ) : WP_Styles
return WP_Styles styles instance

install() public method

Performs plugin install actions
Since: 1.5
public install ( )

instantiateCompiler() public method

public instantiateCompiler ( )

processEditorStylesheets() public method

Compile editor stylesheets registered via add_editor_style()
public processEditorStylesheets ( string $mce_css ) : string
$mce_css string Comma separated list of CSS file URLs
return string $mce_css New comma separated list of CSS file URLs

processStylesheet() public method

Process a single stylesheet
Since: 1.1
Author: oncletom
public processStylesheet ( string $handle, $force = false ) : WPLessStylesheet
$handle string
$force boolean If set to true, rebuild all stylesheets, without considering they are updated or not
return WPLessStylesheet

processStylesheets() public method

Process all stylesheets to compile just in time
Since: 1.0
Author: oncletom
public processStylesheets ( $force = false )
$force boolean If set to true, rebuild all stylesheets, without considering they are updated or not

registerFunction() public method

Proxy method
See also: http://leafo.net/lessphp/docs/#custom_functions
Since: 1.4.2
public registerFunction ( $name, $callback )

registerHooks() protected method

Method to register hooks (and do it only once)
Since: 1.1
Author: oncletom
protected registerHooks ( )

setImportDir() public method

Proxy method
See also: lessc::setImportDir()
Since: 1.5.0
public setImportDir ( array $dirs )
$dirs array

setVariables() public method

Proxy method
See also: http://leafo.net/lessphp/docs/#setting_variables_from_php
Since: 1.4
public setVariables ( array $variables )
$variables array

uninstall() public method

Performs plugin uninstall actions
Since: 1.5
public uninstall ( )

unregisterFunction() public method

Proxy method
See also: lessc::unregisterFunction()
Since: 1.4.2
public unregisterFunction ( $name )

Property Details

$compiler protected property

protected null|WPLessCompiler $compiler
return null | WPLessCompiler

$is_filters_registered protected property

protected bool $is_filters_registered
return boolean

$is_hooks_registered protected property

protected bool $is_hooks_registered
return boolean

$match_pattern public static property

used to match stylesheet files to process them as pure CSS
public static $match_pattern