PHP Class WP_Customize_Custom_CSS_Setting, wordpress

See also: WP_Customize_Setting
Since: 4.7.0
Inheritance: extends WP_Customize_Setting
Show file Open project: johnpbloch/wordpress Class Usage Examples

Public Properties

Property Type Description
$capability string Capability required to edit this setting.
$stylesheet string Stylesheet
$transport string Setting Transport
$type string The setting type.

Public Methods

Method Description
__construct ( WP_Customize_Manager $manager, string $id, array $args = [] ) WP_Customize_Custom_CSS_Setting constructor.
filter_previewed_wp_get_custom_css ( string $css, string $stylesheet ) : string Filter wp_get_custom_css for applying the customized value.
preview ( ) : boolean Add filter to preview post value.
update ( string $css ) : integer | false Store the CSS setting value in the custom_css custom post type for the stylesheet.
validate ( string $css ) : true | WP_Error Validate CSS.
value ( ) : string Fetch the value of the setting. Will return the previewed value when preview() is called.

Private Methods

Method Description
is_possible_content_error ( string $css ) : boolean Find "content:" within a string.
validate_balanced_characters ( string $opening_char, string $closing_char, string $css ) : boolean Ensure there are a balanced number of paired characters.
validate_count_unclosed_comments ( string $css ) : integer Count unclosed CSS Comments.
validate_equal_characters ( string $char, string $css ) : boolean Ensure there are an even number of paired characters.

Method Details

__construct() public method

WP_Customize_Custom_CSS_Setting constructor.
Since: 4.7.0
public __construct ( WP_Customize_Manager $manager, string $id, array $args = [] )
$manager WP_Customize_Manager The Customize Manager class.
$id string An specific ID of the setting. Can be a theme mod or option name.
$args array Setting arguments.

filter_previewed_wp_get_custom_css() public method

This is used in the preview when wp_get_custom_css() is called for rendering the styles.
See also: wp_get_custom_css()
Since: 4.7.0
public filter_previewed_wp_get_custom_css ( string $css, string $stylesheet ) : string
$css string Original CSS.
$stylesheet string Current stylesheet.
return string CSS.

preview() public method

Add filter to preview post value.
Since: 4.7.9
public preview ( ) : boolean
return boolean False when preview short-circuits due no change needing to be previewed.

update() public method

Store the CSS setting value in the custom_css custom post type for the stylesheet.
Since: 4.7.0
public update ( string $css ) : integer | false
$css string The input value.
return integer | false The post ID or false if the value could not be saved.

validate() public method

Checks for imbalanced braces, brackets, and comments. Notifications are rendered when the customizer state is saved.
Since: 4.7.0
public validate ( string $css ) : true | WP_Error
$css string The input string.
return true | WP_Error True if the input was validated, otherwise WP_Error.

value() public method

Fetch the value of the setting. Will return the previewed value when preview() is called.
See also: WP_Customize_Setting::value()
Since: 4.7.0
public value ( ) : string
return string

Property Details

$capability public property

Capability required to edit this setting.
Since: 4.7.0
public string $capability
return string

$stylesheet public property

Stylesheet
Since: 4.7.0
public string $stylesheet
return string

$transport public property

Setting Transport
Since: 4.7.0
public string $transport
return string

$type public property

The setting type.
Since: 4.7.0
public string $type
return string