<!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>[52399] trunk: REST API: Support `.` in theme directory names in `WP_REST_Global_Styles_Controller`, `WP_REST_Templates_Controller`, and `WP_REST_Themes_Controller`.</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/52399">52399</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/52399","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>hellofromTonya</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-12-21 04:12:06 +0000 (Tue, 21 Dec 2021)</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'>REST API: Support `.` in theme directory names in `WP_REST_Global_Styles_Controller`, `WP_REST_Templates_Controller`, and `WP_REST_Themes_Controller`.
Regex changes from <a href="https://core.trac.wordpress.org/changeset/52376">[52376]</a> are reverted to restore the original regex patterns. Why? <a href="https://core.trac.wordpress.org/changeset/52376">[52376]</a> used an include characters pattern, which was too limiting. It did not account for localized characters, such as `e`, or other valid directory name characters.
The original theme directory regex pattern, i.e. `[^.\/]+(?:\/[^.\/]+)?` excluded the period `.` character. Removing the `.` character resolves the reported issue by allowing matching for `themes/theme-dirname-1.0/` or `themes/<subdirname>/theme-dirname-1.0/`.
As the pattern used an exclude approach, all characters are valid for matching except for `/`. However, not all characters are cross-platform valid for directory names. For example, the characters `/:<>*?"|` are not valid on Windows OS. The pattern now excludes those characters.
The theme's directory (or subdirectory) name pattern matching is now used in `WP_REST_Global_Styles_Controller`, `WP_REST_Templates_Controller`, and `WP_REST_Themes_Controller`.
Follow-up to <a href="https://core.trac.wordpress.org/changeset/51003">[51003]</a>, <a href="https://core.trac.wordpress.org/changeset/52051">[52051]</a>, <a href="https://core.trac.wordpress.org/changeset/52275">[52275]</a>, <a href="https://core.trac.wordpress.org/changeset/52376">[52376]</a>.
Props costdev, hellofromTonya, spacedmonkey, TimothyBlynJacobs, bijayyadav, kafleg.
Fixes <a href="https://core.trac.wordpress.org/ticket/54596">#54596</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestglobalstylescontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswpresttemplatescontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestthemescontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestglobalstylescontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-global-styles-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestschemasetupphp">trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestthemescontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapiwpRestTemplatesControllerphp">trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php</a></li>
<li><a href="#trunktestsphpunitteststhemethemeDirphp">trunk/tests/phpunit/tests/theme/themeDir.php</a></li>
<li><a href="#trunktestsqunitfixtureswpapigeneratedjs">trunk/tests/qunit/fixtures/wp-api-generated.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/</li>
<li><a href="#trunktestsphpunitdatathemedir1block_theme040indexphp">trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/index.php</a></li>
<li><a href="#trunktestsphpunitdatathemedir1block_theme040page1php">trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/page-1.php</a></li>
<li>trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/parts/</li>
<li><a href="#trunktestsphpunitdatathemedir1block_theme040partslargeheaderhtml">trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/parts/large-header.html</a></li>
<li><a href="#trunktestsphpunitdatathemedir1block_theme040stylecss">trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/style.css</a></li>
<li>trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/templates/</li>
<li><a href="#trunktestsphpunitdatathemedir1block_theme040templatespagelargeheaderhtml">trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/templates/page-large-header.html</a></li>
<li><a href="#trunktestsphpunitdatathemedir1block_theme040themejson">trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/theme.json</a></li>
<li>trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/</li>
<li><a href="#trunktestsphpunitdatathemedir1subdirblock_theme100indexphp">trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/index.php</a></li>
<li><a href="#trunktestsphpunitdatathemedir1subdirblock_theme100stylecss">trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/style.css</a></li>
<li><a href="#trunktestsphpunitdatathemedir1subdirblock_theme100themejson">trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/theme.json</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesrestapiendpointsclasswprestglobalstylescontrollerphp"></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/rest-api/endpoints/class-wp-rest-global-styles-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php 2021-12-21 02:43:18 UTC (rev 52398)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,7 +41,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // List themes global styles.
</span><span class="cx" style="display: block; padding: 0 10px"> register_rest_route(
</span><span class="cx" style="display: block; padding: 0 10px"> $this->namespace,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/' . $this->rest_base . '/themes/(?P<stylesheet>[\/\s%\w\.\(\)\[\]\@_\-]+)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The route.
+ sprintf(
+ '/%s/themes/(?P<stylesheet>%s)',
+ $this->rest_base,
+ // Matches theme's directory: `/themes/<subdirectory>/<theme>/` or `/themes/<theme>/`.
+ // Excludes invalid directory name characters: `/:<>*?"|`.
+ '[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?'
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'methods' => WP_REST_Server::READABLE,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -61,7 +68,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Lists/updates a single global style variation based on the given id.
</span><span class="cx" style="display: block; padding: 0 10px"> register_rest_route(
</span><span class="cx" style="display: block; padding: 0 10px"> $this->namespace,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/' . $this->rest_base . '/(?P<id>[\/\s%\w\.\(\)\[\]\@_\-]+)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/' . $this->rest_base . '/(?P<id>[\/\w-]+)',
</ins><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'methods' => WP_REST_Server::READABLE,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -88,8 +95,8 @@
</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"> * Sanitize the global styles ID or stylesheet to decode endpoint.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * For example, `wp/v2/global-styles/templatetwentytwo%200.4.0`
- * would be decoded to `templatetwentytwo 0.4.0`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * For example, `wp/v2/global-styles/twentytwentytwo%200.4.0`
+ * would be decoded to `twentytwentytwo 0.4.0`.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswpresttemplatescontrollerphp"></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/rest-api/endpoints/class-wp-rest-templates-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php 2021-12-21 02:43:18 UTC (rev 52398)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -68,7 +68,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Lists/updates a single template based on the given id.
</span><span class="cx" style="display: block; padding: 0 10px"> register_rest_route(
</span><span class="cx" style="display: block; padding: 0 10px"> $this->namespace,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/' . $this->rest_base . '/(?P<id>[\/\s%\w\.\(\)\[\]\@_\-]+)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The route.
+ sprintf(
+ '/%s/(?P<id>%s%s)',
+ $this->rest_base,
+ // Matches theme's directory: `/themes/<subdirectory>/<theme>/` or `/themes/<theme>/`.
+ // Excludes invalid directory name characters: `/:<>*?"|`.
+ '([^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)',
+ // Matches the template name.
+ '[\/\w-]+'
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'args' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'id' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -149,7 +158,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Sanitized template ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function _sanitize_template_id( $id ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Decode empty space.
</del><span class="cx" style="display: block; padding: 0 10px"> $id = urldecode( $id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $last_slash_pos = strrpos( $id, '/' );
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestthemescontrollerphp"></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/rest-api/endpoints/class-wp-rest-themes-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php 2021-12-21 02:43:18 UTC (rev 52398)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,7 +16,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class WP_REST_Themes_Controller extends WP_REST_Controller {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const PATTERN = '[^.\/]+(?:\/[^.\/]+)?';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Matches theme's directory: `/themes/<subdirectory>/<theme>/` or `/themes/<theme>/`.
+ * Excludes invalid directory name characters: `/:<>*?"|`.
+ */
+ const PATTERN = '[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?';
</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"> * Constructor.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -56,8 +60,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'args' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'stylesheet' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'description' => __( "The theme's stylesheet. This uniquely identifies the theme." ),
- 'type' => 'string',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'description' => __( "The theme's stylesheet. This uniquely identifies the theme." ),
+ 'type' => 'string',
+ 'sanitize_callback' => array( $this, '_sanitize_stylesheet_callback' ),
</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"> array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,6 +76,18 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sanitize the stylesheet to decode endpoint.
+ *
+ * @since 5.9.0
+ *
+ * @param string $stylesheet The stylesheet name.
+ * @return string Sanitized stylesheet.
+ */
+ public function _sanitize_stylesheet_callback( $stylesheet ) {
+ return urldecode( $stylesheet );
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Checks if a given request has access to read the theme.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.0.0
</span></span></pre></div>
<a id="trunktestsphpunitdatathemedir1block_theme040indexphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/index.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/index.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/index.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,4 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Block theme.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/index.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1block_theme040page1php"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/page-1.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/page-1.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/page-1.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,3 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+echo 'PHP template for page with ID 1';
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/page-1.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1block_theme040partslargeheaderhtml"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/parts/large-header.html</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/parts/large-header.html (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/parts/large-header.html 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,3 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<!-- wp:paragraph -->
+<p>Large Héader Témplaté Part</p>
+<!-- /wp:paragraph -->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/parts/large-header.html
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1block_theme040stylecss"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/style.css (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/style.css 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,7 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/*
+Theme Name: Block Theme [0.4.0]
+Theme URI: https://wordpress.org/
+Description: Has different characters in theme directory name for testing purposes.
+Version: 0.4.0
+Text Domain: block-theme
+*/
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/style.css
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1block_theme040templatespagelargeheaderhtml"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/templates/page-large-header.html</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/templates/page-large-header.html (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/templates/page-large-header.html 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,9 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<!-- wp:template-part {"slug":"header-large-dark","tagName":"header"} /-->
+
+<!-- wp:group {"tagName":"main"} -->
+<main class="wp-block-group">
+<!-- wp:post-content {"layout":{"inherit":true}} /-->
+</main>
+<!-- /wp:group -->
+
+<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/templates/page-large-header.html
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1block_theme040themejson"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/theme.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/theme.json (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/theme.json 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,71 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+{
+ "version": 1,
+ "settings": {
+ "color": {
+ "palette": [
+ {
+ "slug": "light",
+ "name": "Light",
+ "color": "#f5f7f9"
+ },
+ {
+ "slug": "dark",
+ "name": "Dark",
+ "color": "#000"
+ }
+ ],
+ "gradients": [
+ {
+ "name": "Custom gradient",
+ "gradient": "linear-gradient(135deg,rgba(0,0,0) 0%,rgb(0,0,0) 100%)",
+ "slug": "custom-gradient"
+ }
+ ],
+ "custom": false,
+ "customGradient": false
+ },
+ "typography": {
+ "fontSizes": [
+ {
+ "name": "Custom",
+ "slug": "custom",
+ "size": "100px"
+ }
+ ],
+ "customFontSize": false,
+ "customLineHeight": true
+ },
+ "spacing": {
+ "units": [
+ "rem"
+ ],
+ "customPadding": true
+ },
+ "blocks": {
+ "core/paragraph": {
+ "color": {
+ "palette": [
+ {
+ "slug": "light",
+ "name": "Light",
+ "color": "#f5f7f9"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "customTemplates": [
+ {
+ "name": "page-home",
+ "title": "Homepage template"
+ }
+ ],
+ "templateParts": [
+ {
+ "name": "small-header",
+ "title": "Small Header",
+ "area": "header"
+ }
+ ]
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block_theme-[0.4.0]/theme.json
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1subdirblock_theme100indexphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/index.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/index.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/index.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,4 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Block theme.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/index.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1subdirblock_theme100stylecss"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/style.css (rev 0)
+++ trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/style.css 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,7 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/*
+Theme Name: Block Theme [1.0.0] in subdirectory
+Theme URI: https://wordpress.org/
+Description: Has different characters in theme directory name for testing purposes.
+Version: 0.4.0
+Text Domain: block-theme
+*/
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/style.css
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1subdirblock_theme100themejson"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/theme.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/theme.json (rev 0)
+++ trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/theme.json 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,71 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+{
+ "version": 1,
+ "settings": {
+ "color": {
+ "palette": [
+ {
+ "slug": "light",
+ "name": "Light",
+ "color": "#f5f7f9"
+ },
+ {
+ "slug": "dark",
+ "name": "Dark",
+ "color": "#000"
+ }
+ ],
+ "gradients": [
+ {
+ "name": "Custom gradient",
+ "gradient": "linear-gradient(135deg,rgba(0,0,0) 0%,rgb(0,0,0) 100%)",
+ "slug": "custom-gradient"
+ }
+ ],
+ "custom": false,
+ "customGradient": false
+ },
+ "typography": {
+ "fontSizes": [
+ {
+ "name": "Custom",
+ "slug": "custom",
+ "size": "100px"
+ }
+ ],
+ "customFontSize": false,
+ "customLineHeight": true
+ },
+ "spacing": {
+ "units": [
+ "rem"
+ ],
+ "customPadding": true
+ },
+ "blocks": {
+ "core/paragraph": {
+ "color": {
+ "palette": [
+ {
+ "slug": "light",
+ "name": "Light",
+ "color": "#f5f7f9"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "customTemplates": [
+ {
+ "name": "page-home",
+ "title": "Homepage template"
+ }
+ ],
+ "templateParts": [
+ {
+ "name": "small-header",
+ "title": "Small Header",
+ "area": "header"
+ }
+ ]
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/theme.json
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunittestsrestapirestglobalstylescontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-global-styles-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-global-styles-controller.php 2021-12-21 02:43:18 UTC (rev 52398)
+++ trunk/tests/phpunit/tests/rest-api/rest-global-styles-controller.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -98,23 +98,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_register_routes() {
</span><span class="cx" style="display: block; padding: 0 10px"> $routes = rest_get_server()->get_routes();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/wp/v2/global-styles/(?P<id>[\/\s%\w\.\(\)\[\]\@_\-]+)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/wp/v2/global-styles/(?P<id>[\/\w-]+)',
</ins><span class="cx" style="display: block; padding: 0 10px"> $routes,
</span><span class="cx" style="display: block; padding: 0 10px"> 'Single global style based on the given ID route does not exist'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount(
</span><span class="cx" style="display: block; padding: 0 10px"> 2,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $routes['/wp/v2/global-styles/(?P<id>[\/\s%\w\.\(\)\[\]\@_\-]+)'],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $routes['/wp/v2/global-styles/(?P<id>[\/\w-]+)'],
</ins><span class="cx" style="display: block; padding: 0 10px"> 'Single global style based on the given ID route does not have exactly two elements'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/wp/v2/global-styles/themes/(?P<stylesheet>[\/\s%\w\.\(\)\[\]\@_\-]+)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/wp/v2/global-styles/themes/(?P<stylesheet>[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)',
</ins><span class="cx" style="display: block; padding: 0 10px"> $routes,
</span><span class="cx" style="display: block; padding: 0 10px"> 'Theme global styles route does not exist'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertCount(
</span><span class="cx" style="display: block; padding: 0 10px"> 1,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $routes['/wp/v2/global-styles/themes/(?P<stylesheet>[\/\s%\w\.\(\)\[\]\@_\-]+)'],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $routes['/wp/v2/global-styles/themes/(?P<stylesheet>[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)'],
</ins><span class="cx" style="display: block; padding: 0 10px"> 'Theme global styles route does not have exactly one element'
</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">@@ -164,14 +164,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @dataProvider data_get_theme_item_invalid_theme_dirname
</span><span class="cx" style="display: block; padding: 0 10px"> * @covers WP_REST_Global_Styles_Controller::get_theme_item
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 54596
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @param string $theme_dirname Theme directory to test.
+ * @param string $expected Expected error code.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function test_get_theme_item_invalid_theme_dirname( $theme_dirname ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_get_theme_item_invalid_theme_dirname( $theme_dirname, $expected ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( self::$admin_id );
</span><span class="cx" style="display: block; padding: 0 10px"> switch_theme( $theme_dirname );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $request = new WP_REST_Request( 'GET', '/wp/v2/global-styles/themes/' . $theme_dirname );
</span><span class="cx" style="display: block; padding: 0 10px"> $response = rest_get_server()->dispatch( $request );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertErrorResponse( 'rest_no_route', $response, 404 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertErrorResponse( $expected, $response, 404 );
</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"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -181,12 +184,39 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function data_get_theme_item_invalid_theme_dirname() {
</span><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">- 'with |' => array( 'my|theme' ),
- 'with +' => array( 'my+theme' ),
- 'with {}' => array( 'my{theme}' ),
- 'with #' => array( 'my#theme' ),
- 'with !' => array( 'my!theme' ),
- 'multiple invalid chars' => array( 'mytheme-[_(+@)]#! v4.0' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '+' => array(
+ 'theme_dirname' => 'my+theme+',
+ 'expected' => 'rest_theme_not_found',
+ ),
+ ':' => array(
+ 'theme_dirname' => 'my:theme:',
+ 'expected' => 'rest_no_route',
+ ),
+ '<>' => array(
+ 'theme_dirname' => 'my<theme>',
+ 'expected' => 'rest_no_route',
+ ),
+ '*' => array(
+ 'theme_dirname' => 'my*theme*',
+ 'expected' => 'rest_no_route',
+ ),
+ '?' => array(
+ 'theme_dirname' => 'my?theme?',
+ 'expected' => 'rest_no_route',
+ ),
+ '"' => array(
+ 'theme_dirname' => 'my"theme?"',
+ 'expected' => 'rest_no_route',
+ ),
+ '| (invalid on Windows)' => array(
+ 'theme_dirname' => 'my|theme|',
+ 'expected' => 'rest_no_route',
+ ),
+ // Themes deep in subdirectories.
+ '2 subdirectories deep' => array(
+ 'theme_dirname' => 'subdir/subsubdir/mytheme',
+ 'expected' => 'rest_global_styles_not_found',
+ ),
</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">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -194,6 +224,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @dataProvider data_get_theme_item
</span><span class="cx" style="display: block; padding: 0 10px"> * @covers WP_REST_Global_Styles_Controller::get_theme_item
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 54596
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @param string $theme Theme directory to test.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_theme_item( $theme ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( self::$admin_id );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -216,18 +248,34 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function data_get_theme_item() {
</span><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">- 'alphabetic chars' => array( 'mytheme' ),
- 'alphanumeric chars' => array( 'mythemev1' ),
- 'space' => array( 'my theme' ),
- '-' => array( 'my-theme' ),
- '_' => array( 'my_theme' ),
- '.' => array( 'mytheme0.1' ),
- '- and .' => array( 'my-theme-0.1' ),
- 'space and .' => array( 'mytheme v0.1' ),
- 'space, -, _, .' => array( 'my-theme-v0.1' ),
- '[]' => array( 'my[theme]' ),
- '()' => array( 'my(theme)' ),
- '@' => array( 'my@theme' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'alphabetic' => array( 'mytheme' ),
+ 'alphanumeric' => array( 'mythemev1' ),
+ 'àáâãäåæç' => array( 'àáâãäåæç' ),
+ 'space' => array( 'my theme' ),
+ '-_.' => array( 'my_theme-0.1' ),
+ '[]' => array( 'my[theme]' ),
+ '()' => array( 'my(theme)' ),
+ '{}' => array( 'my{theme}' ),
+ '&=#@!$,^~%' => array( 'theme &=#@!$,^~%' ),
+ 'all combined' => array( 'thémé {}&=@!$,^~%[0.1](-_-)' ),
+
+ // Themes in a subdirectory.
+ 'subdir: alphabetic' => array( 'subdir/mytheme' ),
+ 'subdir: alphanumeric in theme' => array( 'subdir/mythemev1' ),
+ 'subdir: alphanumeric in subdir' => array( 'subdirv1/mytheme' ),
+ 'subdir: alphanumeric in both' => array( 'subdirv1/mythemev1' ),
+ 'subdir: àáâãäåæç in theme' => array( 'subdir/àáâãäåæç' ),
+ 'subdir: àáâãäåæç in subdir' => array( 'àáâãäåæç/mythemev1' ),
+ 'subdir: àáâãäåæç in both' => array( 'àáâãäåæç/àáâãäåæç' ),
+ 'subdir: space in theme' => array( 'subdir/my theme' ),
+ 'subdir: space in subdir' => array( 'sub dir/mytheme' ),
+ 'subdir: space in both' => array( 'sub dir/my theme' ),
+ 'subdir: -_. in theme' => array( 'subdir/my_theme-0.1' ),
+ 'subdir: -_. in subdir' => array( 'sub_dir-0.1/mytheme' ),
+ 'subdir: -_. in both' => array( 'sub_dir-0.1/my_theme-0.1' ),
+ 'subdir: all combined in theme' => array( 'subdir/thémé {}&=@!$,^~%[0.1](-_-)' ),
+ 'subdir: all combined in subdir' => array( 'sűbdīr {}&=@!$,^~%[0.1](-_-)/mytheme' ),
+ 'subdir: all combined in both' => array( 'sűbdīr {}&=@!$,^~%[0.1](-_-)/thémé {}&=@!$,^~%[0.1](-_-)' ),
</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">
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestschemasetupphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php 2021-12-21 02:43:18 UTC (rev 52398)
+++ trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -135,8 +135,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/users/(?P<user_id>(?:[\\d]+|me))/application-passwords/(?P<uuid>[\\w\\-]+)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/comments',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/comments/(?P<id>[\\d]+)',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/wp/v2/global-styles/(?P<id>[\/\s%\w\.\(\)\[\]\@_\-]+)',
- '/wp/v2/global-styles/themes/(?P<stylesheet>[\/\s%\w\.\(\)\[\]\@_\-]+)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/wp/v2/global-styles/(?P<id>[\/\w-]+)',
+ '/wp/v2/global-styles/themes/(?P<stylesheet>[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)',
</ins><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/search',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/block-renderer/(?P<name>[a-z0-9-]+/[a-z0-9-]+)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/block-types',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,19 +144,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/block-types/(?P<namespace>[a-zA-Z0-9_-]+)/(?P<name>[a-zA-Z0-9_-]+)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/settings',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/template-parts',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/wp/v2/template-parts/(?P<id>[\/\s%\w\.\(\)\[\]\@_\-]+)',
</del><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/template-parts/(?P<id>[\d]+)/autosaves',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/wp/v2/template-parts/(?P<id>([^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)[\/\w-]+)',
</ins><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/template-parts/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/template-parts/(?P<parent>[\d]+)/revisions',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/template-parts/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/templates',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/wp/v2/templates/(?P<id>[\/\s%\w\.\(\)\[\]\@_\-]+)',
</del><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/templates/(?P<id>[\d]+)/autosaves',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/wp/v2/templates/(?P<id>([^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)[\/\w-]+)',
</ins><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/templates/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/templates/(?P<parent>[\d]+)/revisions',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/templates/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/themes',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/wp/v2/themes/(?P<stylesheet>[^.\/]+(?:\/[^.\/]+)?)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/wp/v2/themes/(?P<stylesheet>[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)',
</ins><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/plugins',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/plugins/(?P<plugin>[^.\/]+(?:\/[^.\/]+)?)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/block-directory/search',
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestthemescontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php 2021-12-21 02:43:18 UTC (rev 52398)
+++ trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1285,20 +1285,91 @@
</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">- * @ticket 54349
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @dataProvider data_get_item_non_subdir_theme
+ * @ticket 54596
+ * @covers WP_REST_Themes_Controller::get_item
+ *
+ * @param string $theme_dir Theme directory to test.
+ * @param string $expected_name Expected theme name.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function test_get_item_subdirectory_theme() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_get_item_non_subdir_theme( $theme_dir, $expected_name ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( self::$admin_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $request = new WP_REST_Request( 'GET', self::$themes_route . '/subdir/theme2' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $request = new WP_REST_Request( 'GET', self::$themes_route . $theme_dir );
</ins><span class="cx" style="display: block; padding: 0 10px"> $response = rest_do_request( $request );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( 200, $response->get_status() );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertSame( 'My Subdir Theme', $response->get_data()['name']['raw'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertSame( $expected_name, $response->get_data()['name']['raw'] );
</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"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Data provider.
+ *
+ * @return array
+ */
+ public function data_get_item_non_subdir_theme() {
+ return array(
+ 'parent theme' => array(
+ 'theme_dir' => '/block-theme',
+ 'expected_name' => 'Block Theme',
+ ),
+ 'child theme' => array(
+ 'theme_dir' => '/block-theme-child',
+ 'expected_name' => 'Block Theme Child Theme',
+ ),
+ 'theme with _-[]. characters' => array(
+ 'theme_dir' => '/block_theme-[0.4.0]',
+ 'expected_name' => 'Block Theme [0.4.0]',
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider data_get_item_subdirectory_theme
</ins><span class="cx" style="display: block; padding: 0 10px"> * @ticket 54349
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @ticket 54596
+ * @covers WP_REST_Themes_Controller::get_item
+ *
+ * @param string $theme_dir Theme directory to test.
+ * @param string $expected_name Expected theme name.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_get_item_subdirectory_theme( $theme_dir, $expected_name ) {
+ wp_set_current_user( self::$admin_id );
+ $request = new WP_REST_Request( 'GET', self::$themes_route . $theme_dir );
+ $response = rest_do_request( $request );
+
+ $this->assertSame(
+ 200,
+ $response->get_status(),
+ 'A 200 OK status was not returned.'
+ );
+ $this->assertSame(
+ $expected_name,
+ $response->get_data()['name']['raw'],
+ 'The actual theme name was not the expected theme name.'
+ );
+ }
+
+ /**
+ * Data provider.
+ *
+ * @return array
+ */
+ public function data_get_item_subdirectory_theme() {
+ return array(
+ 'theme2' => array(
+ 'theme_dir' => '/subdir/theme2',
+ 'expected_name' => 'My Subdir Theme',
+ ),
+ 'theme with _-[]. characters' => array(
+ 'theme_dir' => '/subdir/block_theme-[1.0.0]',
+ 'expected_name' => 'Block Theme [1.0.0] in subdirectory',
+ ),
+ );
+ }
+
+ /**
+ * @ticket 54349
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> public function test_can_support_further_routes() {
</span><span class="cx" style="display: block; padding: 0 10px"> register_rest_route(
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp/v2',
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapiwpRestTemplatesControllerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php 2021-12-21 02:43:18 UTC (rev 52398)
+++ trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -65,7 +65,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'Templates route does not exist'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertArrayHasKey(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '/wp/v2/templates/(?P<id>[\/\s%\w\.\(\)\[\]\@_\-]+)',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/wp/v2/templates/(?P<id>([^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)[\/\w-]+)',
</ins><span class="cx" style="display: block; padding: 0 10px"> $routes,
</span><span class="cx" style="display: block; padding: 0 10px"> 'Single template based on the given ID route does not exist'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -209,6 +209,119 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @dataProvider data_get_item_with_valid_theme_dirname
+ * @covers WP_REST_Templates_Controller::get_item
+ * @ticket 54596
+ *
+ * @param string $theme_dir Theme directory to test.
+ * @param string $template Template to test.
+ * @param array $args Arguments to create the 'wp_template" post.
+ */
+ public function test_get_item_with_valid_theme_dirname( $theme_dir, $template, array $args ) {
+ wp_set_current_user( self::$admin_id );
+ switch_theme( $theme_dir );
+
+ // Set up template post.
+ $args['post_type'] = 'wp_template';
+ $args['tax_input'] = array(
+ 'wp_theme' => array(
+ get_stylesheet(),
+ ),
+ );
+ $post = self::factory()->post->create_and_get( $args );
+ wp_set_post_terms( $post->ID, get_stylesheet(), 'wp_theme' );
+
+ $request = new WP_REST_Request( 'GET', "/wp/v2/templates/{$theme_dir}//{$template}" );
+ $response = rest_get_server()->dispatch( $request );
+ $data = $response->get_data();
+ unset( $data['content'] );
+ unset( $data['_links'] );
+
+ $this->assertSameSetsWithIndex(
+ array(
+ 'id' => "{$theme_dir}//{$template}",
+ 'theme' => $theme_dir,
+ 'slug' => $template,
+ 'source' => 'custom',
+ 'origin' => null,
+ 'type' => 'wp_template',
+ 'description' => $args['post_excerpt'],
+ 'title' => array(
+ 'raw' => $args['post_title'],
+ 'rendered' => $args['post_title'],
+ ),
+ 'status' => 'publish',
+ 'wp_id' => $post->ID,
+ 'has_theme_file' => false,
+ 'is_custom' => true,
+ 'author' => self::$admin_id,
+ ),
+ $data
+ );
+ }
+
+ /**
+ * Data provider.
+ *
+ * @return array
+ */
+ public function data_get_item_with_valid_theme_dirname() {
+ $theme_root_dir = DIR_TESTDATA . '/themedir1/';
+ return array(
+ 'template parts: parent theme' => array(
+ 'theme_dir' => 'themedir1/block-theme',
+ 'template' => 'small-header',
+ 'args' => array(
+ 'post_name' => 'small-header',
+ 'post_title' => 'Small Header Template',
+ 'post_content' => file_get_contents( $theme_root_dir . '/block-theme/parts/small-header.html' ),
+ 'post_excerpt' => 'Description of small header template.',
+ ),
+ ),
+ 'template: parent theme' => array(
+ 'theme_dir' => 'themedir1/block-theme',
+ 'template' => 'page-home',
+ 'args' => array(
+ 'post_name' => 'page-home',
+ 'post_title' => 'Home Page Template',
+ 'post_content' => file_get_contents( $theme_root_dir . 'block-theme/templates/page-home.html' ),
+ 'post_excerpt' => 'Description of page home template.',
+ ),
+ ),
+ 'template: child theme' => array(
+ 'theme_dir' => 'themedir1/block-theme-child',
+ 'template' => 'page-1',
+ 'args' => array(
+ 'post_name' => 'page-1',
+ 'post_title' => 'Page 1 Template',
+ 'post_content' => file_get_contents( $theme_root_dir . 'block-theme-child/templates/page-1.html' ),
+ 'post_excerpt' => 'Description of page 1 template.',
+ ),
+ ),
+ 'template part: subdir with _-[]. characters' => array(
+ 'theme_dir' => 'themedir1/block_theme-[0.4.0]',
+ 'template' => 'large-header',
+ 'args' => array(
+ 'post_name' => 'large-header',
+ 'post_title' => 'Large Header Template Part',
+ 'post_content' => file_get_contents( $theme_root_dir . 'block_theme-[0.4.0]/parts/large-header.html' ),
+ 'post_excerpt' => 'Description of large header template.',
+ ),
+ ),
+ 'template: subdir with _-[]. characters' => array(
+ 'theme_dir' => 'themedir1/block_theme-[0.4.0]',
+ 'template' => 'page-large-header',
+ 'args' => array(
+ 'post_name' => 'page-large-header',
+ 'post_title' => 'Page Large Template',
+ 'post_content' => file_get_contents( $theme_root_dir . 'block_theme-[0.4.0]/templates/page-large-header.html' ),
+ 'post_excerpt' => 'Description of page large template.',
+ ),
+ ),
+ );
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * @ticket 54507
</span><span class="cx" style="display: block; padding: 0 10px"> * @dataProvider get_template_ids_to_sanitize
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="trunktestsphpunitteststhemethemeDirphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/theme/themeDir.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/theme/themeDir.php 2021-12-21 02:43:18 UTC (rev 52398)
+++ trunk/tests/phpunit/tests/theme/themeDir.php 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -163,6 +163,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'REST Theme',
</span><span class="cx" style="display: block; padding: 0 10px"> 'Block Theme',
</span><span class="cx" style="display: block; padding: 0 10px"> 'Block Theme Child Theme',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Block Theme [0.4.0]',
+ 'Block Theme [1.0.0] in subdirectory',
</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"> sort( $theme_names );
</span></span></pre></div>
<a id="trunktestsqunitfixtureswpapigeneratedjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/qunit/fixtures/wp-api-generated.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/qunit/fixtures/wp-api-generated.js 2021-12-21 02:43:18 UTC (rev 52398)
+++ trunk/tests/qunit/fixtures/wp-api-generated.js 2021-12-21 04:12:06 UTC (rev 52399)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5140,7 +5140,7 @@
</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">- "/wp/v2/templates/(?P<id>[\\/\\s%\\w\\.\\(\\)\\[\\]\\@_\\-]+)": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "/wp/v2/templates/(?P<id>([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w-]+)": {
</ins><span class="cx" style="display: block; padding: 0 10px"> "namespace": "wp/v2",
</span><span class="cx" style="display: block; padding: 0 10px"> "methods": [
</span><span class="cx" style="display: block; padding: 0 10px"> "GET",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5792,7 +5792,7 @@
</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">- "/wp/v2/template-parts/(?P<id>[\\/\\s%\\w\\.\\(\\)\\[\\]\\@_\\-]+)": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "/wp/v2/template-parts/(?P<id>([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w-]+)": {
</ins><span class="cx" style="display: block; padding: 0 10px"> "namespace": "wp/v2",
</span><span class="cx" style="display: block; padding: 0 10px"> "methods": [
</span><span class="cx" style="display: block; padding: 0 10px"> "GET",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9424,7 +9424,7 @@
</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">- "/wp/v2/global-styles/themes/(?P<stylesheet>[\\/\\s%\\w\\.\\(\\)\\[\\]\\@_\\-]+)": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "/wp/v2/global-styles/themes/(?P<stylesheet>[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)": {
</ins><span class="cx" style="display: block; padding: 0 10px"> "namespace": "wp/v2",
</span><span class="cx" style="display: block; padding: 0 10px"> "methods": [
</span><span class="cx" style="display: block; padding: 0 10px"> "GET"
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9444,7 +9444,7 @@
</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">- "/wp/v2/global-styles/(?P<id>[\\/\\s%\\w\\.\\(\\)\\[\\]\\@_\\-]+)": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "/wp/v2/global-styles/(?P<id>[\\/\\w-]+)": {
</ins><span class="cx" style="display: block; padding: 0 10px"> "namespace": "wp/v2",
</span><span class="cx" style="display: block; padding: 0 10px"> "methods": [
</span><span class="cx" style="display: block; padding: 0 10px"> "GET",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9668,7 +9668,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "self": "http://example.org/index.php?rest_route=/wp/v2/themes"
</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">- "/wp/v2/themes/(?P<stylesheet>[^.\\/]+(?:\\/[^.\\/]+)?)": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "/wp/v2/themes/(?P<stylesheet>[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)": {
</ins><span class="cx" style="display: block; padding: 0 10px"> "namespace": "wp/v2",
</span><span class="cx" style="display: block; padding: 0 10px"> "methods": [
</span><span class="cx" style="display: block; padding: 0 10px"> "GET"
</span></span></pre>
</div>
</div>
</body>
</html>