WP_Style_Engine_CSS_Rules_Store
- Since
- 6.1.0
- Source
wp-includes/style-engine/class-wp-style-engine-css-rules-store.php:19
Core class used as a store for WP_Style_Engine_CSS_Rule objects.
Description
Holds, sanitizes, processes, and prints CSS declarations for the style engine.
Compatibility
- WordPress
- since 6.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 3
$storesWP_Style_Engine_CSS_Rules_Store[]protected static- An array of named WP_Style_Engine_CSS_Rules_Store objects.
$namestringprotected- The store name.
$rulesWP_Style_Engine_CSS_Rule[]protected- An array of CSS Rules objects assigned to the store.
Methods · 8
- get_store()Gets an instance of the store.
- get_stores()Gets an array of all available stores.
- remove_all_stores()Clears all stores from static::$stores.
- set_name()Sets the store name.
- get_name()Gets the store name.
- get_all_rules()Gets an array of all rules.
- add_rule()Gets a WP_Style_Engine_CSS_Rule object by its selector.
- remove_rule()Removes a selector from the store.
Source code
#[AllowDynamicProperties]class WP_Style_Engine_CSS_Rules_Store { /** * An array of named WP_Style_Engine_CSS_Rules_Store objects. * * @static * * @since 6.1.0 * @var WP_Style_Engine_CSS_Rules_Store[] */ protected static $stores = array(); /** * The store name. * * @since 6.1.0 * @var string */ protected $name = ''; /** * An array of CSS Rules objects assigned to the store. * * @since 6.1.0 * @var WP_Style_Engine_CSS_Rule[] */ protected $rules = array(); /** * Gets an instance of the store. * * @since 6.1.0 * * @param string $store_name The name of the store. * @return WP_Style_Engine_CSS_Rules_Store|null */ public static function get_store( $store_name = 'default' ) { if ( ! is_string( $store_name ) || empty( $store_name ) ) { return null; } if ( ! isset( static::$stores[ $store_name ] ) ) { static::$stores[ $store_name ] = new static(); // Set the store name. static::$stores[ $store_name ]->set_name( $store_name ); } return static::$stores[ $store_name ]; } /** * Gets an array of all available stores. * * @since 6.1.0 * * @return WP_Style_Engine_CSS_Rules_Store[] */ public static function get_stores() { return static::$stores; } /** * Clears all stores from static::$stores. * * @since 6.1.0 */ public static function remove_all_stores() { static::$stores = array(); } /** * Sets the store name. * * @since 6.1.0 * * @param string $name The store name. */ public function set_name( $name ) { $this->name = $name; }Changelog
Introduced in 6.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/style-engine/class-wp-style-engine-css-rules-store.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.