mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REST API: Support
.
in theme directory names in `WP_REST_Global_Sty…
…les_Controller`, `WP_REST_Templates_Controller`, and `WP_REST_Themes_Controller`. Regex changes from [52376] are reverted to restore the original regex patterns. Why? [52376] used an include characters pattern, which was too limiting. It did not account for localized characters, such as `é`, 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 [51003], [52051], [52275], [52376]. Props costdev, hellofromTonya, spacedmonkey, TimothyBlynJacobs, bijayyadav, kafleg. Fixes #54596. git-svn-id: https://develop.svn.wordpress.org/trunk@52399 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information
1 parent
b161cfc
commit e1f5600
Showing
18 changed files
with
493 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
/** | ||
* Block theme. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
echo 'PHP template for page with ID 1'; |
3 changes: 3 additions & 0 deletions
3
tests/phpunit/data/themedir1/block_theme-[0.4.0]/parts/large-header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- wp:paragraph --> | ||
<p>Large Héader Témplaté Part</p> | ||
<!-- /wp:paragraph --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
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 | ||
*/ |
9 changes: 9 additions & 0 deletions
9
tests/phpunit/data/themedir1/block_theme-[0.4.0]/templates/page-large-header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- 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"} /--> |
71 changes: 71 additions & 0 deletions
71
tests/phpunit/data/themedir1/block_theme-[0.4.0]/theme.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"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" | ||
} | ||
] | ||
} |
4 changes: 4 additions & 0 deletions
4
tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
/** | ||
* Block theme. | ||
*/ |
7 changes: 7 additions & 0 deletions
7
tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
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 | ||
*/ |
71 changes: 71 additions & 0 deletions
71
tests/phpunit/data/themedir1/subdir/block_theme-[1.0.0]/theme.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"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" | ||
} | ||
] | ||
} |
Oops, something went wrong.