rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -1,8 +1,6 @@
<?php
/**
* WP_Style_Engine_CSS_Declarations
*
* Holds, sanitizes and prints CSS rules declarations
* Style Engine: WP_Style_Engine_CSS_Declarations class
*
* @package WordPress
* @subpackage StyleEngine
@@ -10,9 +8,9 @@
*/
/**
* Class WP_Style_Engine_CSS_Declarations.
* Core class used for style engine CSS declarations.
*
* Holds, sanitizes, processes and prints CSS declarations for the style engine.
* Holds, sanitizes, processes, and prints CSS declarations for the style engine.
*
* @since 6.1.0
*/
@@ -24,7 +22,7 @@ class WP_Style_Engine_CSS_Declarations {
*
* @since 6.1.0
*
* @var array
* @var string[]
*/
protected $declarations = array();
@@ -32,11 +30,13 @@ class WP_Style_Engine_CSS_Declarations {
* Constructor for this object.
*
* If a `$declarations` array is passed, it will be used to populate
* the initial $declarations prop of the object by calling add_declarations().
* the initial `$declarations` prop of the object by calling add_declarations().
*
* @since 6.1.0
*
* @param string[] $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
* @param string[] $declarations Optional. An associative array of CSS definitions,
* e.g. `array( "$property" => "$value", "$property" => "$value" )`.
* Default empty array.
*/
public function __construct( $declarations = array() ) {
$this->add_declarations( $declarations );
@@ -49,7 +49,6 @@ class WP_Style_Engine_CSS_Declarations {
*
* @param string $property The CSS property.
* @param string $value The CSS value.
*
* @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods.
*/
public function add_declaration( $property, $value ) {
@@ -78,7 +77,6 @@ class WP_Style_Engine_CSS_Declarations {
* @since 6.1.0
*
* @param string $property The CSS property.
*
* @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods.
*/
public function remove_declaration( $property ) {
@@ -91,8 +89,7 @@ class WP_Style_Engine_CSS_Declarations {
*
* @since 6.1.0
*
* @param array $declarations An array of declarations.
*
* @param string[] $declarations An array of declarations.
* @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods.
*/
public function add_declarations( $declarations ) {
@@ -107,8 +104,7 @@ class WP_Style_Engine_CSS_Declarations {
*
* @since 6.1.0
*
* @param array $properties An array of properties.
*
* @param string[] $properties Optional. An array of properties. Default empty array.
* @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods.
*/
public function remove_declarations( $properties = array() ) {
@@ -123,7 +119,7 @@ class WP_Style_Engine_CSS_Declarations {
*
* @since 6.1.0
*
* @return array
* @return string[] The declarations array.
*/
public function get_declarations() {
return $this->declarations;
@@ -136,8 +132,8 @@ class WP_Style_Engine_CSS_Declarations {
*
* @param string $property The CSS property.
* @param string $value The value to be filtered.
* @param string $spacer The spacer between the colon and the value. Defaults to an empty string.
*
* @param string $spacer Optional. The spacer between the colon and the value.
* Default empty string.
* @return string The filtered declaration or an empty string.
*/
protected static function filter_declaration( $property, $value, $spacer = '' ) {
@@ -153,9 +149,10 @@ class WP_Style_Engine_CSS_Declarations {
*
* @since 6.1.0
*
* @param bool $should_prettify Whether to add spacing, new lines and indents.
* @param number $indent_count The number of tab indents to apply to the rule. Applies if `prettify` is `true`.
*
* @param bool $should_prettify Optional. Whether to add spacing, new lines and indents.
* Default false.
* @param int $indent_count Optional. The number of tab indents to apply to the rule.
* Applies if `prettify` is `true`. Default 0.
* @return string The CSS declarations.
*/
public function get_declarations_string( $should_prettify = false, $indent_count = 0 ) {
@@ -172,6 +169,7 @@ class WP_Style_Engine_CSS_Declarations {
$declarations_output .= "{$indent}{$filtered_declaration};$suffix";
}
}
return rtrim( $declarations_output );
}
@@ -181,7 +179,6 @@ class WP_Style_Engine_CSS_Declarations {
* @since 6.1.0
*
* @param string $property The CSS property.
*
* @return string The sanitized property name.
*/
protected function sanitize_property( $property ) {