<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[55719] trunk/src/wp-includes: Docs: Correct and improve inline docs relating to the style engine.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/55719">55719</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/55719","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>johnbillion</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-05-03 23:55:50 +0000 (Wed, 03 May 2023)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Docs: Correct and improve inline docs relating to the style engine.
See <a href="https://core.trac.wordpress.org/ticket/57840">#57840</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesstyleengineclasswpstyleenginecssdeclarationsphp">trunk/src/wp-includes/style-engine/class-wp-style-engine-css-declarations.php</a></li>
<li><a href="#trunksrcwpincludesstyleengineclasswpstyleenginecssrulephp">trunk/src/wp-includes/style-engine/class-wp-style-engine-css-rule.php</a></li>
<li><a href="#trunksrcwpincludesstyleengineclasswpstyleenginecssrulesstorephp">trunk/src/wp-includes/style-engine/class-wp-style-engine-css-rules-store.php</a></li>
<li><a href="#trunksrcwpincludesstyleengineclasswpstyleengineprocessorphp">trunk/src/wp-includes/style-engine/class-wp-style-engine-processor.php</a></li>
<li><a href="#trunksrcwpincludesstyleengineclasswpstyleenginephp">trunk/src/wp-includes/style-engine/class-wp-style-engine.php</a></li>
<li><a href="#trunksrcwpincludesstyleenginephp">trunk/src/wp-includes/style-engine.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesstyleengineclasswpstyleenginecssdeclarationsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/style-engine/class-wp-style-engine-css-declarations.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/style-engine/class-wp-style-engine-css-declarations.php 2023-05-03 23:53:19 UTC (rev 55718)
+++ trunk/src/wp-includes/style-engine/class-wp-style-engine-css-declarations.php 2023-05-03 23:55:50 UTC (rev 55719)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,7 +24,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @var array
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @var string[]
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected $declarations = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,7 +36,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string[] $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string[] $declarations An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function __construct( $declarations = array() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->add_declarations( $declarations );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,7 +49,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $property The CSS property.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $value The CSS value.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add_declaration( $property, $value ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,7 +77,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $property The CSS property.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function remove_declaration( $property ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -91,8 +89,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $declarations An array of declarations.
- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string[] $declarations An array of declarations.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add_declarations( $declarations ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -107,8 +104,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $properties An array of properties.
- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string[] $properties An array of properties.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function remove_declarations( $properties = array() ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -123,7 +119,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string[] The declarations array.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_declarations() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->declarations;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -137,7 +133,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $property The CSS property.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $value The value to be filtered.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $spacer The spacer between the colon and the value. Defaults to an empty string.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return string The filtered declaration or an empty string.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function filter_declaration( $property, $value, $spacer = '' ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -153,9 +148,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @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`.
- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param bool $should_prettify Whether to add spacing, new lines and indents.
+ * @param int $indent_count The number of tab indents to apply to the rule. Applies if `prettify` is `true`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string The CSS declarations.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_declarations_string( $should_prettify = false, $indent_count = 0 ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -181,7 +175,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $property The CSS property.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return string The sanitized property name.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function sanitize_property( $property ) {
</span></span></pre></div>
<a id="trunksrcwpincludesstyleengineclasswpstyleenginecssrulephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/style-engine/class-wp-style-engine-css-rule.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/style-engine/class-wp-style-engine-css-rule.php 2023-05-03 23:53:19 UTC (rev 55718)
+++ trunk/src/wp-includes/style-engine/class-wp-style-engine-css-rule.php 2023-05-03 23:55:50 UTC (rev 55719)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -43,7 +43,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $selector The CSS selector.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string[]|WP_Style_Engine_CSS_Declarations $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string[]|WP_Style_Engine_CSS_Declarations $declarations An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`,
</ins><span class="cx" style="display: block; padding: 0 10px"> * or a WP_Style_Engine_CSS_Declarations object.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function __construct( $selector = '', $declarations = array() ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -57,7 +57,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $selector The CSS selector.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Style_Engine_CSS_Rule Returns the object to allow chaining of methods.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function set_selector( $selector ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -72,7 +71,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array|WP_Style_Engine_CSS_Declarations $declarations An array of declarations (property => value pairs),
</span><span class="cx" style="display: block; padding: 0 10px"> * or a WP_Style_Engine_CSS_Declarations object.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Style_Engine_CSS_Rule Returns the object to allow chaining of methods.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add_declarations( $declarations ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -118,9 +116,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @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`.
- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param bool $should_prettify Whether to add spacing, new lines and indents.
+ * @param int $indent_count The number of tab indents to apply to the rule. Applies if `prettify` is `true`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_css( $should_prettify = false, $indent_count = 0 ) {
</span></span></pre></div>
<a id="trunksrcwpincludesstyleengineclasswpstyleenginecssrulesstorephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/style-engine/class-wp-style-engine-css-rules-store.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/style-engine/class-wp-style-engine-css-rules-store.php 2023-05-03 23:53:19 UTC (rev 55718)
+++ trunk/src/wp-includes/style-engine/class-wp-style-engine-css-rules-store.php 2023-05-03 23:55:50 UTC (rev 55719)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,7 +51,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $store_name The name of the store.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Style_Engine_CSS_Rules_Store|void
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function get_store( $store_name = 'default' ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,7 +93,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $name The store name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function set_name( $name ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -130,8 +128,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $selector The CSS selector.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
- * @return WP_Style_Engine_CSS_Rule|void Returns a WP_Style_Engine_CSS_Rule object, or null if the selector is empty.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return WP_Style_Engine_CSS_Rule|void Returns a WP_Style_Engine_CSS_Rule object, or void if the selector is empty.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add_rule( $selector ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $selector = trim( $selector );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -155,7 +152,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $selector The CSS selector.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function remove_rule( $selector ) {
</span></span></pre></div>
<a id="trunksrcwpincludesstyleengineclasswpstyleengineprocessorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/style-engine/class-wp-style-engine-processor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/style-engine/class-wp-style-engine-processor.php 2023-05-03 23:53:19 UTC (rev 55718)
+++ trunk/src/wp-includes/style-engine/class-wp-style-engine-processor.php 2023-05-03 23:55:50 UTC (rev 55719)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,7 +41,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Style_Engine_CSS_Rules_Store $store The store to add.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Style_Engine_Processor Returns the object to allow chaining methods.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add_store( $store ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -65,7 +64,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Style_Engine_CSS_Rule|WP_Style_Engine_CSS_Rule[] $css_rules A single, or an array of, WP_Style_Engine_CSS_Rule objects from a store or otherwise.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Style_Engine_Processor Returns the object to allow chaining methods.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add_rules( $css_rules ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,7 +94,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @type bool $optimize Whether to optimize the CSS output, e.g., combine rules. Default is `false`.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type bool $prettify Whether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined.
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return string The computed CSS.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_css( $options = array() ) {
</span></span></pre></div>
<a id="trunksrcwpincludesstyleengineclasswpstyleenginephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/style-engine/class-wp-style-engine.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/style-engine/class-wp-style-engine.php 2023-05-03 23:53:19 UTC (rev 55718)
+++ trunk/src/wp-includes/style-engine/class-wp-style-engine.php 2023-05-03 23:55:50 UTC (rev 55719)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,7 +16,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This class is final and should not be extended.
</span><span class="cx" style="display: block; padding: 0 10px"> * This class is for internal Core usage and is not supposed to be used by extenders (plugins and/or themes).
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This is a low-level API that may need to do breaking changes. Please, use wp_style_engine_get_styles instead.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This is a low-level API that may need to do breaking changes. Please, use wp_style_engine_get_styles() instead.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -229,13 +229,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Util: Extracts the slug in kebab case from a preset string, e.g., "heavenly-blue" from 'var:preset|color|heavenlyBlue'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Util: Extracts the slug in kebab case from a preset string, e.g., `heavenly-blue` from `var:preset|color|heavenlyBlue`.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $style_value A single CSS preset value.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $property_key The CSS property that is the second element of the preset string. Used for matching.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return string The slug, or empty string if not found.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function get_slug_from_preset_value( $style_value, $property_key ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -247,17 +246,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Util: Generates a CSS var string, e.g., var(--wp--preset--color--background) from a preset string such as `var:preset|space|50`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Util: Generates a CSS var string, e.g., `var(--wp--preset--color--background)` from a preset string such as `var:preset|space|50`.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $style_value A single css preset value.
- * @param string[] $css_vars An associate array of css var patterns used to generate the var string.
- *
- * @return string The css var, or an empty string if no match for slug found.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $style_value A single CSS preset value.
+ * @param string[] $css_vars An associate array of CSS var patterns used to generate the var string.
+ * @return string The CSS var, or an empty string if no match for slug found.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function get_css_var_value( $style_value, $css_vars ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( $css_vars as $property_key => $css_var_pattern ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $css_vars as $property_key => $css_var_pattern ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $slug = static::get_slug_from_preset_value( $style_value, $property_key );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( static::is_valid_style_value( $slug ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $var = strtr(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -276,7 +274,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $style_value A single CSS preset value.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return bool
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function is_valid_style_value( $style_value ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -290,9 +287,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $store_name A valid store key.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $css_selector When a selector is passed, the function will return a full CSS rule `$selector { ...rules }`, otherwise a concatenated string of properties and values.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string[] $css_declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
- *
- * @return void.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string[] $css_declarations An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`.
+ * @return void
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function store_css_rule( $store_name, $css_selector, $css_declarations ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $store_name ) || empty( $css_selector ) || empty( $css_declarations ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -307,8 +303,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $store_name A store key.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
- * @return WP_Style_Engine_CSS_Rules_Store
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return WP_Style_Engine_CSS_Rules_Store|null
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function get_store( $store_name ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return WP_Style_Engine_CSS_Rules_Store::get_store( $store_name );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -324,14 +319,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $options {
</span><span class="cx" style="display: block; padding: 0 10px"> * Optional. An array of options. Default empty array.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to var( --wp--preset--* ) values. Default `false`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to `var( --wp--preset--* )` values. Default false.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @type string $selector Optional. When a selector is passed, the value of `$css` in the return value will comprise a full CSS rule `$selector { ...$css_declarations }`,
</span><span class="cx" style="display: block; padding: 0 10px"> * otherwise, the value will be a concatenated string of CSS declarations.
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return array {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string $classnames Classnames separated by a space.
- * @type string[] $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string[] $classnames Array of class names.
+ * @type string[] $declarations An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function parse_block_styles( $block_styles, $options ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -364,14 +358,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Returns classnames, and generates classname(s) from a CSS preset property pattern, e.g., '`var:preset|<PRESET_TYPE>|<PRESET_SLUG>`'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns classnames, and generates classname(s) from a CSS preset property pattern, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $style_value A single raw style value or css preset property from the $block_styles array.
- * @param array $style_definition A single style definition from BLOCK_STYLE_DEFINITIONS_METADATA.
- *
- * @return array|string[] An array of CSS classnames, or empty array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $style_value A single raw style value or CSS preset property from the `$block_styles` array.
+ * @param array $style_definition A single style definition from BLOCK_STYLE_DEFINITIONS_METADATA.
+ * @return string[] An array of CSS classnames, or empty array if there are none.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function get_classnames( $style_value, $style_definition ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $style_value ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -407,15 +400,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $style_value A single raw style value from $block_styles array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param mixed $style_value A single raw style value from $block_styles array.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $style_definition A single style definition from BLOCK_STYLE_DEFINITIONS_METADATA.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $options {
</span><span class="cx" style="display: block; padding: 0 10px"> * Optional. An array of options. Default empty array.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to var( --wp--preset--* ) values. Default `false`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g.,
+ * `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to `var( --wp--preset--* )` values.
+ * Default false.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
- * @return string[] An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string[] An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function get_css_declarations( $style_value, $style_definition, $options = array() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $style_definition['value_func'] ) && is_callable( $style_definition['value_func'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -473,21 +467,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Style value parser that returns a CSS definition array comprising style properties
</span><span class="cx" style="display: block; padding: 0 10px"> * that have keys representing individual style properties, otherwise known as longhand CSS properties.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * e.g., "$style_property-$individual_feature: $value;", which could represent the following:
- * "border-{top|right|bottom|left}-{color|width|style}: {value};" or,
- * "border-image-{outset|source|width|repeat|slice}: {value};"
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Example:
+ *
+ * "$style_property-$individual_feature: $value;"
+ *
+ * Which could represent the following:
+ *
+ * "border-{top|right|bottom|left}-{color|width|style}: {value};"
+ *
+ * or:
+ *
+ * "border-image-{outset|source|width|repeat|slice}: {value};"
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $style_value A single raw style value from $block_styles array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $style_value A single raw style value from `$block_styles` array.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $individual_property_definition A single style definition from BLOCK_STYLE_DEFINITIONS_METADATA representing an individual property of a CSS property, e.g., 'top' in 'border-top'.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $options {
</span><span class="cx" style="display: block; padding: 0 10px"> * Optional. An array of options. Default empty array.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to var( --wp--preset--* ) values. Default `false`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to `var( --wp--preset--* )` values. Default false.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
- * @return string[] An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string[] An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function get_individual_property_css_declarations( $style_value, $individual_property_definition, $options = array() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_array( $style_value ) || empty( $style_value ) || empty( $individual_property_definition['path'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -526,13 +528,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Returns compiled CSS from css_declarations.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns compiled CSS from CSS declarations.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string[] $css_declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string[] $css_declarations An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $css_selector When a selector is passed, the function will return a full CSS rule `$selector { ...rules }`, otherwise a concatenated string of properties and values.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return string A compiled CSS string.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function compile_css( $css_declarations, $css_selector ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -559,10 +560,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $options {
</span><span class="cx" style="display: block; padding: 0 10px"> * Optional. An array of options. Default empty array.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type bool $optimize Whether to optimize the CSS output, e.g., combine rules. Default is `false`.
- * @type bool $prettify Whether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string|null $context An identifier describing the origin of the style object, e.g., 'block-supports' or 'global-styles'. Default is 'block-supports'.
+ * When set, the style engine will attempt to store the CSS rules.
+ * @type bool $optimize Whether to optimize the CSS output, e.g., combine rules. Default is `false`.
+ * @type bool $prettify Whether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return string A compiled stylesheet from stored CSS rules.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function compile_stylesheet_from_css_rules( $css_rules, $options = array() ) {
</span></span></pre></div>
<a id="trunksrcwpincludesstyleenginephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/style-engine.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/style-engine.php 2023-05-03 23:53:19 UTC (rev 55718)
+++ trunk/src/wp-includes/style-engine.php 2023-05-03 23:55:50 UTC (rev 55719)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,7 +10,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Global public interface method to generate styles from a single style object, e.g.,
</span><span class="cx" style="display: block; padding: 0 10px"> * the value of a block's attributes.style object or the top level styles in theme.json.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,9 +18,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Example usage:
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * $styles = wp_style_engine_get_styles( array( 'color' => array( 'text' => '#cccccc' ) ) );
- * // Returns `array( 'css' => 'color: #cccccc', 'declarations' => array( 'color' => '#cccccc' ), 'classnames' => 'has-color' )`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * $styles = wp_style_engine_get_styles( array( 'color' => array( 'text' => '#cccccc' ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns:
+ *
+ * array( 'css' => 'color: #cccccc', 'declarations' => array( 'color' => '#cccccc' ), 'classnames' => 'has-color' )
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access public
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,14 +33,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string|null $context An identifier describing the origin of the style object, e.g., 'block-supports' or 'global-styles'. Default is `null`.
</span><span class="cx" style="display: block; padding: 0 10px"> * When set, the style engine will attempt to store the CSS rules, where a selector is also passed.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to var( --wp--preset--* ) values. Default `false`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to `var( --wp--preset--* )` values. Default `false`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @type string $selector Optional. When a selector is passed, the value of `$css` in the return value will comprise a full CSS rule `$selector { ...$css_declarations }`,
</span><span class="cx" style="display: block; padding: 0 10px"> * otherwise, the value will be a concatenated string of CSS declarations.
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return array {
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $css A CSS ruleset or declarations block formatted to be placed in an HTML `style` attribute or tag.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string[] $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string[] $declarations An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @type string $classnames Classnames separated by a space.
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,13 +75,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Returns compiled CSS from a collection of selectors and declarations.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Useful for returning a compiled stylesheet from any collection of CSS selector + declarations.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Useful for returning a compiled stylesheet from any collection of CSS selector + declarations.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Example usage:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * $css_rules = array( array( 'selector' => '.elephant-are-cool', 'declarations' => array( 'color' => 'gray', 'width' => '3em' ) ) );
- * $css = wp_style_engine_get_stylesheet_from_css_rules( $css_rules );
- * // Returns `.elephant-are-cool{color:gray;width:3em}`.
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * $css_rules = array( array( 'selector' => '.elephant-are-cool', 'declarations' => array( 'color' => 'gray', 'width' => '3em' ) ) );
+ * $css = wp_style_engine_get_stylesheet_from_css_rules( $css_rules );
+ *
+ * Returns:
+ *
+ * .elephant-are-cool{color:gray;width:3em}
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $css_rules {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -88,7 +93,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type array ...$0 {
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $selector A CSS selector.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string[] $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string[] $declarations An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $options {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -99,7 +104,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @type bool $optimize Whether to optimize the CSS output, e.g., combine rules. Default is `false`.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type bool $prettify Whether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined.
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return string A string of compiled CSS declarations, or empty string.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_style_engine_get_stylesheet_from_css_rules( $css_rules, $options = array() ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -146,7 +150,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @type bool $optimize Whether to optimize the CSS output, e.g., combine rules. Default is `false`.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type bool $prettify Whether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined.
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return string A compiled CSS string.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_style_engine_get_stylesheet_from_context( $context, $options = array() ) {
</span></span></pre>
</div>
</div>
</body>
</html>