Brisko

Styles extends AbstractEnq
in package

Table of Contents

CORE_CSS  = 'brisko-core'
Theme Base css.
$css_files  : mixed
$style_files  : mixed
__construct()  : mixed
custom_css()  : mixed
Custom Theme styles.
editor_style()  : void
Setup a style based on mod.
enqueue()  : mixed
Enqueue scripts.
enqueue_script()  : void
Setup a style mod.
enqueue_style()  : void
Setup a style based on mod.
enqueue_user_assets()  : mixed
get_style_files()  : mixed
init()  : void
Initialize instance.
register()  : mixed
Register all styles.
setup_theme_editor_styles()  : mixed
element_mod()  : string
Get element space padding or margin.
maybe()  : bool
Check if the 'brisko_elements_loaded' action has been executed.
minified_css()  : false|string
CSS Minifier Compressor.
register_script()  : void
Register a new script.
sanitize_css()  : string
Sanitize CSS.
set_css_files()  : mixed
style_files()  : array<string|int, mixed>
Setup static CSS files.
custom_styles()  : mixed
Custom Theme styles.

Constants

CORE_CSS

Theme Base css.

public mixed CORE_CSS = 'brisko-core'

Properties

Methods

__construct()

public __construct() : mixed
Return values
mixed

custom_css()

Custom Theme styles.

public custom_css() : mixed
Return values
mixed

editor_style()

Setup a style based on mod.

public editor_style(string $asset, string $mod[, bool $default = false ]) : void
Parameters
$asset : string

the registered style name

$mod : string

the theme_mod name example 'enable_bootstrap'

$default : bool = false

true|false if this should be enabled by default.

Return values
void

enqueue()

Enqueue scripts.

public enqueue() : mixed
Return values
mixed

enqueue_script()

Setup a style mod.

public static enqueue_script(string $handle, string $mod[, bool $default = false ]) : void
Parameters
$handle : string

the enqueue handle example 'bootstrap'

$mod : string

the theme_mod name example 'enable_bootstrap'

$default : bool = false

true|false if this should be enabled by default.

Return values
void

enqueue_style()

Setup a style based on mod.

public static enqueue_style(string $handle, false|string $mod[, bool $default = false ]) : void
Parameters
$handle : string

the enqueue handle example 'bootstrap'

$mod : false|string

the theme_mod name example 'enable_bootstrap', use false to override

$default : bool = false

true|false if this should be enabled by default.

Return values
void

enqueue_user_assets()

public enqueue_user_assets() : mixed
Return values
mixed

get_style_files()

public get_style_files([string $style = '' ]) : mixed
Parameters
$style : string = ''
Return values
mixed

init()

Initialize instance.

public init() : void
Return values
void

register()

Register all styles.

public register() : mixed
Return values
mixed

setup_theme_editor_styles()

public setup_theme_editor_styles() : mixed
Return values
mixed

element_mod()

Get element space padding or margin.

protected element_mod([string $theme_mod = 'footer_padding' ][, string $default = '16px' ]) : string
Parameters
$theme_mod : string = 'footer_padding'

.

$default : string = '16px'

.

Return values
string

.

maybe()

Check if the 'brisko_elements_loaded' action has been executed.

protected static maybe() : bool

Determine whether to load theme modifications by default.

This method checks if the 'brisko_elements_loaded' action has been executed. If the action has not been fired, it indicates that the Brisko Elements plugin is not active. In this case, we need to load certain theme modifications like theme styles by default. However, if the action has been fired, it means the plugin is active and can control theme mods, so we return false to prevent default loading.

Return values
bool

Returns true if the 'brisko_elements_loaded' action has NOT been executed, indicating the need to load theme modifications by default. Returns false if the action has been fired, indicating that the plugin can control theme mods, and we should not load them by default.

minified_css()

CSS Minifier Compressor.

protected minified_css() : false|string
Return values
false|string

minified css output.

register_script()

Register a new script.

protected static register_script(string $handle, string $src[, array<string|int, mixed> $deps = [] ][, bool $in_footer = true ]) : void
Parameters
$handle : string

Name of the script. Should be unique.

$src : string

path of the script relative to the Theme directory.

$deps : array<string|int, mixed> = []

An array of registered script handles this script depends on.

$in_footer : bool = true

Whether to enqueue the script before instead of in the .

Tags
see
https://developer.wordpress.org/reference/functions/wp_register_script/
Return values
void

sanitize_css()

Sanitize CSS.

protected sanitize_css(string $css) : string

For now just strip_tags (the WordPress way) and preg_replace to escape < in certain cases but might do full CSS escaping in the future, see: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#rule-4-css-encode-and-strictly-validate-before-inserting-untrusted-data-into-html-style-property-values https://github.com/twigphp/Twig/blob/3.x/src/Extension/EscaperExtension.php#L300-L319 https://github.com/laminas/laminas-escaper/blob/2.8.x/src/Escaper.php#L205-L221 https://plugins.svn.wordpress.org/autoptimize/tags/2.8.0/classes/autoptimizeStyles.php

Parameters
$css : string

the to be sanitized CSS.

Return values
string

sanitized CSS.

set_css_files()

protected set_css_files() : mixed
Return values
mixed

style_files()

Setup static CSS files.

protected style_files([null|string $style = null ]) : array<string|int, mixed>
Parameters
$style : null|string = null

Style handle, e.g., 'bootstrap'.

Return values
array<string|int, mixed>

custom_styles()

Custom Theme styles.

private custom_styles() : mixed
Return values
mixed

Search results