<!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>[51021] trunk: Block Editor: Add support for the pattern directory.</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/51021">51021</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/51021","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>ryelle</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-05-26 01:10:57 +0000 (Wed, 26 May 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'>Block Editor: Add support for the pattern directory.
Add an endpoint for fetching block patterns from WordPress.org, and load the block patterns from this new API. Remove the block patterns that have already been moved to WordPress.org/patterns.
Props ryelle, iandunn, youknowriad, timothyblynjacobs.
Fixes <a href="https://core.trac.wordpress.org/ticket/53246">#53246</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesblockpatternsphp">trunk/src/wp-includes/block-patterns.php</a></li>
<li><a href="#trunksrcwpincludesdefaultfiltersphp">trunk/src/wp-includes/default-filters.php</a></li>
<li><a href="#trunksrcwpincludesrestapiphp">trunk/src/wp-includes/rest-api.php</a></li>
<li><a href="#trunksrcwpsettingsphp">trunk/src/wp-settings.php</a></li>
<li><a href="#trunktestsphpunittestsblocksblockeditorphp">trunk/tests/phpunit/tests/blocks/block-editor.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestschemasetupphp">trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestpatterndirectorycontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php</a></li>
<li>trunk/tests/phpunit/data/blocks/pattern-directory/</li>
<li><a href="#trunktestsphpunitdatablockspatterndirectorybrowsealljson">trunk/tests/phpunit/data/blocks/pattern-directory/browse-all.json</a></li>
<li><a href="#trunktestsphpunitdatablockspatterndirectorybrowsecategory2json">trunk/tests/phpunit/data/blocks/pattern-directory/browse-category-2.json</a></li>
<li><a href="#trunktestsphpunitdatablockspatterndirectorybrowsekeyword11json">trunk/tests/phpunit/data/blocks/pattern-directory/browse-keyword-11.json</a></li>
<li><a href="#trunktestsphpunitdatablockspatterndirectorysearchbuttonjson">trunk/tests/phpunit/data/blocks/pattern-directory/search-button.json</a></li>
<li><a href="#trunktestsphpunittestsrestapirestpatterndirectorycontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesblockpatternsheadingphp">trunk/src/wp-includes/block-patterns/heading.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternslargeheaderleftphp">trunk/src/wp-includes/block-patterns/large-header-left.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternslargeheadertextbuttonphp">trunk/src/wp-includes/block-patterns/large-header-text-button.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternsmediatextarquitecturephp">trunk/src/wp-includes/block-patterns/media-text-arquitecture.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternsmediatextartphp">trunk/src/wp-includes/block-patterns/media-text-art.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternsmediatextnaturephp">trunk/src/wp-includes/block-patterns/media-text-nature.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternsquotephp">trunk/src/wp-includes/block-patterns/quote.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternstexttwocolumnstitleoffsetphp">trunk/src/wp-includes/block-patterns/text-two-columns-title-offset.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternstexttwocolumnstitlephp">trunk/src/wp-includes/block-patterns/text-two-columns-title.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternstexttwocolumnsphp">trunk/src/wp-includes/block-patterns/text-two-columns.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternsthreecolumnsmediatextphp">trunk/src/wp-includes/block-patterns/three-columns-media-text.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternsthreecolumnstextphp">trunk/src/wp-includes/block-patterns/three-columns-text.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternsthreeimagesgalleryphp">trunk/src/wp-includes/block-patterns/three-images-gallery.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternstwobuttonsphp">trunk/src/wp-includes/block-patterns/two-buttons.php</a></li>
<li><a href="#trunksrcwpincludesblockpatternstwoimagesgalleryphp">trunk/src/wp-includes/block-patterns/two-images-gallery.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesblockpatternsheadingphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/heading.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/heading.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/heading.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,16 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Heading.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Heading', 'Block pattern title' ),
- 'categories' => array( 'text' ),
- 'blockTypes' => array( 'core/heading' ),
- 'content' => '<!-- wp:heading {"align":"wide","style":{"typography":{"fontSize":"48px","lineHeight":"1.1"}}} -->
- <h2 class="alignwide" style="font-size:48px;line-height:1.1">' . esc_html__( "We're a studio in Berlin with an international practice in architecture, urban planning and interior design. We believe in sharing knowledge and promoting dialogue to increase the creative potential of collaboration." ) . '</h2>
- <!-- /wp:heading -->',
- 'description' => _x( 'Heading text', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternslargeheaderleftphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/large-header-left.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/large-header-left.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/large-header-left.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,33 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Large header with left-aligned text.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Large header with left-aligned text', 'Block pattern title' ),
- 'categories' => array( 'header' ),
- 'content' => '<!-- wp:cover {"url":"https://s.w.org/images/core/5.8/forest.jpg","id":null,"dimRatio":60,"minHeight":800,"align":"full"} -->
- <div class="wp-block-cover alignfull has-background-dim-60 has-background-dim" style="min-height:800px"><img class="wp-block-cover__image-background " alt="" src="https://s.w.org/images/core/5.8/forest.jpg" data-object-fit="cover"/><div class="wp-block-cover__inner-container"><!-- wp:heading {"align":"wide","style":{"color":{"text":"#ffe074"},"typography":{"fontSize":"64px"}}} -->
- <h2 class="alignwide has-text-color" style="color:#ffe074;font-size:64px">' . esc_html__( 'Forest.' ) . '</h2>
- <!-- /wp:heading -->
-
- <!-- wp:columns {"align":"wide"} -->
- <div class="wp-block-columns alignwide"><!-- wp:column {"width":"55%"} -->
- <div class="wp-block-column" style="flex-basis:55%"><!-- wp:spacer {"height":330} -->
- <div style="height:330px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer -->
-
- <!-- wp:paragraph {"style":{"color":{"text":"#ffe074"},"typography":{"lineHeight":"1.3","fontSize":"12px"}}} -->
- <p class="has-text-color" style="color:#ffe074;font-size:12px;line-height:1.3"><em>' . esc_html__( 'Even a child knows how valuable the forest is. The fresh, breathtaking smell of trees. Echoing birds flying above that dense magnitude. A stable climate, a sustainable diverse life and a source of culture. Yet, forests and other ecosystems hang in the balance, threatened to become croplands, pasture, and plantations.' ) . '</em></p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column -->
-
- <!-- wp:column -->
- <div class="wp-block-column"></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns --></div></div>
- <!-- /wp:cover -->',
- 'description' => _x( 'Cover image with quote on top', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternslargeheadertextbuttonphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/large-header-text-button.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/large-header-text-button.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/large-header-text-button.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,35 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Large header with text and a button.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Large header with text and a button.', 'Block pattern title' ),
- 'categories' => array( 'header' ),
- 'content' => '<!-- wp:cover {"url":"https://s.w.org/images/core/5.8/art-01.jpg","id":null,"hasParallax":true,"dimRatio":40,"customOverlayColor":"#000000","minHeight":100,"minHeightUnit":"vh","contentPosition":"center center","align":"full"} -->
- <div class="wp-block-cover alignfull has-background-dim-40 has-background-dim has-parallax" style="background-color:#000000;background-image:url(https://s.w.org/images/core/5.8/art-01.jpg);min-height:100vh"><div class="wp-block-cover__inner-container"><!-- wp:heading {"style":{"typography":{"fontSize":"48px","lineHeight":"1.2"}},"className":"alignwide has-white-color has-text-color"} -->
- <h2 class="alignwide has-white-color has-text-color" style="font-size:48px;line-height:1.2"><strong><em>' . esc_html__( 'Overseas:' ) . '</em></strong><br><strong><em>' . esc_html__( '1500 — 1960' ) . '</em></strong></h2>
- <!-- /wp:heading -->
-
- <!-- wp:columns {"align":"wide"} -->
- <div class="wp-block-columns alignwide"><!-- wp:column {"width":"60%"} -->
- <div class="wp-block-column" style="flex-basis:60%"><!-- wp:paragraph {"style":{"color":{"text":"#ffffff"}}} -->
- <p class="has-text-color" style="color:#ffffff">' . wp_kses_post( __( 'An exhibition about the different representations of the ocean throughout time, between the sixteenth and the twentieth century. Taking place in our Open Room in <em>Floor 2</em>.' ) ) . '</p>
- <!-- /wp:paragraph -->
-
- <!-- wp:buttons -->
- <div class="wp-block-buttons"><!-- wp:button {"borderRadius":0,"style":{"color":{"text":"#ffffff","background":"#000000"}},"className":"is-style-outline"} -->
- <div class="wp-block-button is-style-outline"><a class="wp-block-button__link has-text-color has-background no-border-radius" style="background-color:#000000;color:#ffffff">' . esc_html__( 'Visit' ) . '</a></div>
- <!-- /wp:button --></div>
- <!-- /wp:buttons --></div>
- <!-- /wp:column -->
-
- <!-- wp:column -->
- <div class="wp-block-column"></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns --></div></div>
- <!-- /wp:cover -->',
- 'description' => _x( 'Large header with background image and text and button on top', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternsmediatextarquitecturephp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/media-text-arquitecture.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/media-text-arquitecture.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/media-text-arquitecture.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,21 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Media and text with image on the right.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Media and text with image on the right', 'Block pattern title' ),
- 'categories' => array( 'header' ),
- 'content' => '<!-- wp:media-text {"align":"full","mediaId":null,"mediaType":"image","verticalAlignment":"center"} -->
- <div class="wp-block-media-text alignfull is-stacked-on-mobile is-vertically-aligned-center"><figure class="wp-block-media-text__media"><img src="https://s.w.org/images/core/5.8/architecture-04.jpg" alt="' . esc_attr__( 'Close-up, abstract view of architecture.' ) . '"/></figure><div class="wp-block-media-text__content"><!-- wp:heading {"textAlign":"center","level":3,"style":{"color":{"text":"#000000"}}} -->
- <h3 class="has-text-align-center has-text-color" style="color:#000000"><strong>' . esc_html__( 'Open Spaces' ) . '</strong></h3>
- <!-- /wp:heading -->
-
- <!-- wp:paragraph {"align":"center","fontSize":"extra-small"} -->
- <p class="has-text-align-center has-extra-small-font-size"><a href="#">' . esc_html__( 'See case study ↗' ) . '</a></p>
- <!-- /wp:paragraph --></div></div>
- <!-- /wp:media-text -->',
- 'description' => _x( 'Media and text block with image to the left and text to the right', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternsmediatextartphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/media-text-art.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/media-text-art.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/media-text-art.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,21 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Media & text with image on the right.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Media & text with image on the right', 'Block pattern title' ),
- 'categories' => array( 'header' ),
- 'content' => '<!-- wp:media-text {"align":"full","mediaPosition":"right","mediaId":null,"mediaLink":"#","mediaType":"image","mediaWidth":56,"verticalAlignment":"center","className":"is-style-default"} -->
- <div class="wp-block-media-text alignfull has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center is-style-default" style="grid-template-columns:auto 56%"><figure class="wp-block-media-text__media"><img src="https://s.w.org/images/core/5.8/art-02.jpg" alt="' . esc_attr__( 'A green and brown rural landscape leading into a bright blue ocean and slightly cloudy sky, done in oil paints.' ) . '"/></figure><div class="wp-block-media-text__content"><!-- wp:heading {"style":{"color":{"text":"#000000"}}} -->
- <h2 class="has-text-color" style="color:#000000"><strong>' . esc_html__( 'Shore with Blue Sea' ) . '</strong></h2>
- <!-- /wp:heading -->
-
- <!-- wp:paragraph {"style":{"typography":{"lineHeight":"1.1","fontSize":"17px"},"color":{"text":"#636363"}}} -->
- <p class="has-text-color" style="color:#636363;font-size:17px;line-height:1.1">' . esc_html__( 'Eleanor Harris (American, 1901-1942)' ) . '</p>
- <!-- /wp:paragraph --></div></div>
- <!-- /wp:media-text -->',
- 'description' => _x( 'Media and text block with image to the right and text to the left', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternsmediatextnaturephp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/media-text-nature.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/media-text-nature.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/media-text-nature.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,28 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Media & text in a full height container.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Media & text in a full height container', 'Block pattern title' ),
- 'categories' => array( 'header' ),
- 'content' => '<!-- wp:cover {"customOverlayColor":"#ffffff","minHeight":100,"minHeightUnit":"vh","contentPosition":"center center","align":"full"} -->
- <div class="wp-block-cover alignfull has-background-dim" style="background-color:#ffffff;min-height:100vh"><div class="wp-block-cover__inner-container"><!-- wp:media-text {"mediaId":null,"mediaLink":"https://s.w.org/images/core/5.8/soil.jpg","mediaType":"image","mediaWidth":56,"verticalAlignment":"center","imageFill":true} -->
- <div class="wp-block-media-text alignwide is-stacked-on-mobile is-vertically-aligned-center is-image-fill" style="grid-template-columns:56% auto"><figure class="wp-block-media-text__media" style="background-image:url(https://s.w.org/images/core/5.8/soil.jpg);background-position:50% 50%"><img src="https://s.w.org/images/core/5.8/soil.jpg" alt="' . esc_attr__( 'Close-up of dried, cracked earth.' ) . '"/></figure><div class="wp-block-media-text__content"><!-- wp:heading {"style":{"typography":{"fontSize":"32px"},"color":{"text":"#000000"}}} -->
- <h2 class="has-text-color" style="color:#000000;font-size:32px"><strong>' . esc_html__( "What's the problem?" ) . '</strong></h2>
- <!-- /wp:heading -->
-
- <!-- wp:paragraph {"style":{"typography":{"fontSize":"17px"},"color":{"text":"#000000"}}} -->
- <p class="has-text-color" style="color:#000000;font-size:17px">' . esc_html__( 'Trees are more important today than ever before. More than 10,000 products are reportedly made from trees. Through chemistry, the humble woodpile is yielding chemicals, plastics and fabrics that were beyond comprehension when an axe first felled a Texas tree.' ) . '</p>
- <!-- /wp:paragraph -->
- <!-- wp:buttons -->
- <div class="wp-block-buttons"><!-- wp:button {"className":"is-style-fill"} -->
- <div class="wp-block-button is-style-fill"><a class="wp-block-button__link">' . esc_html__( 'Learn more' ) . '</a></div>
- <!-- /wp:button --></div>
- <!-- /wp:buttons --></div></div>
- <!-- /wp:media-text --></div></div>
- <!-- /wp:cover -->',
- 'description' => _x( 'Media and text block with image to the left and text and button to the right', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternsquotephp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/quote.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/quote.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/quote.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,30 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Quote.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Quote', 'Block pattern title' ),
- 'categories' => array( 'text' ),
- 'blockTypes' => array( 'core/quote' ),
- 'content' => '<!-- wp:group -->
- <div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:separator {"className":"is-style-default"} -->
- <hr class="wp-block-separator is-style-default"/>
- <!-- /wp:separator -->
-
- <!-- wp:image {"align":"center","id":null,"width":150,"height":150,"sizeSlug":"large","linkDestination":"none","className":"is-style-rounded"} -->
- <div class="wp-block-image is-style-rounded"><figure class="aligncenter size-large is-resized"><img src="https://s.w.org/images/core/5.8/portrait.jpg" alt="' . esc_attr__( 'A side profile of a woman in a russet-colored turtleneck and white bag. She looks up with her eyes closed.' ) . '" width="150" height="150"/></figure></div>
- <!-- /wp:image -->
-
- <!-- wp:quote {"align":"center","className":"is-style-large"} -->
- <blockquote class="wp-block-quote has-text-align-center is-style-large"><p>' . esc_html__( "\"Contributing makes me feel like I'm being useful to the planet.\"" ) . '</p><cite>' . wp_kses_post( __( '— Anna Wong, <em>Volunteer</em>' ) ) . '</cite></blockquote>
- <!-- /wp:quote -->
-
- <!-- wp:separator {"className":"is-style-default"} -->
- <hr class="wp-block-separator is-style-default"/>
- <!-- /wp:separator --></div></div>
- <!-- /wp:group -->',
- 'description' => _x( 'Testimonial quote with portrait', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternstexttwocolumnstitleoffsetphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/text-two-columns-title-offset.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/text-two-columns-title-offset.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/text-two-columns-title-offset.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,53 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Two columns of text with offset heading.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Two columns of text with offset heading', 'Block pattern title' ),
- 'categories' => array( 'columns', 'text' ),
- 'content' => '<!-- wp:group {"align":"full","style":{"color":{"background":"#f2f0e9"}}} -->
- <div class="wp-block-group alignfull has-background" style="background-color:#f2f0e9"><!-- wp:spacer {"height":70} -->
- <div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer -->
-
- <!-- wp:columns {"verticalAlignment":"center","align":"wide"} -->
- <div class="wp-block-columns alignwide are-vertically-aligned-center"><!-- wp:column {"width":"50%"} -->
- <div class="wp-block-column" style="flex-basis:50%"><!-- wp:paragraph {"style":{"typography":{"lineHeight":"1.1","fontSize":"30px"},"color":{"text":"#000000"}}} -->
- <p class="has-text-color" style="color:#000000;font-size:30px;line-height:1.1"><strong>' . esc_html__( 'Oceanic Inspiration' ) . '</strong></p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column -->
-
- <!-- wp:column {"width":"50%"} -->
- <div class="wp-block-column" style="flex-basis:50%"><!-- wp:separator {"customColor":"#000000","className":"is-style-wide"} -->
- <hr class="wp-block-separator has-text-color has-background is-style-wide" style="background-color:#000000;color:#000000"/>
- <!-- /wp:separator --></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns -->
-
- <!-- wp:columns {"align":"wide"} -->
- <div class="wp-block-columns alignwide"><!-- wp:column -->
- <div class="wp-block-column"></div>
- <!-- /wp:column -->
-
- <!-- wp:column -->
- <div class="wp-block-column"><!-- wp:paragraph {"style":{"color":{"text":"#000000"}},"fontSize":"extra-small"} -->
- <p class="has-text-color has-extra-small-font-size" style="color:#000000">' . esc_html__( 'Winding veils round their heads, the women walked on deck. They were now moving steadily down the river, passing the dark shapes of ships at anchor, and London was a swarm of lights with a pale yellow canopy drooping above it. There were the lights of the great theatres, the lights of the long streets, lights that indicated huge squares of domestic comfort, lights that hung high in air.' ) . '</p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column -->
-
- <!-- wp:column -->
- <div class="wp-block-column"><!-- wp:paragraph {"style":{"color":{"text":"#000000"}},"fontSize":"extra-small"} -->
- <p class="has-text-color has-extra-small-font-size" style="color:#000000">' . esc_html__( 'No darkness would ever settle upon those lamps, as no darkness had settled upon them for hundreds of years. It seemed dreadful that the town should blaze for ever in the same spot; dreadful at least to people going away to adventure upon the sea, and beholding it as a circumscribed mound, eternally burnt, eternally scarred. From the deck of the ship the great city appeared a crouched and cowardly figure, a sedentary miser.' ) . '</p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns -->
-
- <!-- wp:spacer {"height":40} -->
- <div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer --></div>
- <!-- /wp:group -->',
- 'description' => _x( 'Two columns of text with offset heading', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternstexttwocolumnstitlephp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/text-two-columns-title.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/text-two-columns-title.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/text-two-columns-title.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,31 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Two columns text and title.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Two columns text and title', 'Block pattern title' ),
- 'categories' => array( 'columns', 'text' ),
- 'content' => '<!-- wp:group -->
- <div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:heading {"style":{"typography":{"fontSize":38,"lineHeight":"1.4"}}} -->
- <h2 style="font-size:38px;line-height:1.4"><strong>' . esc_html__( 'The voyage had begun, and had begun happily with a soft blue sky, and a calm sea.' ) . '</strong></h2>
- <!-- /wp:heading -->
-
- <!-- wp:columns -->
- <div class="wp-block-columns"><!-- wp:column -->
- <div class="wp-block-column"><!-- wp:paragraph {"style":{"typography":{"fontSize":18}}} -->
- <p style="font-size:18px">' . esc_html__( 'They followed her on to the deck. All the smoke and the houses had disappeared, and the ship was out in a wide space of sea very fresh and clear though pale in the early light. They had left London sitting on its mud. A very thin line of shadow tapered on the horizon, scarcely thick enough to stand the burden of Paris, which nevertheless rested upon it. They were free of roads, free of mankind, and the same exhilaration at their freedom ran through them all.' ) . '</p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column -->
-
- <!-- wp:column -->
- <div class="wp-block-column"><!-- wp:paragraph {"style":{"typography":{"fontSize":18}}} -->
- <p style="font-size:18px">' . esc_html__( "The ship was making her way steadily through small waves which slapped her and then fizzled like effervescing water, leaving a little border of bubbles and foam on either side. The colourless October sky above was thinly clouded as if by the trail of wood-fire smoke, and the air was wonderfully salt and brisk. Indeed it was too cold to stand still. Mrs. Ambrose drew her arm within her husband's, and as they moved off it could be seen from the way in which her sloping cheek turned up to his that she had something private to communicate." ) . '</p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns --></div></div>
- <!-- /wp:group -->',
- 'description' => _x( 'Two columns text and title', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternstexttwocolumnsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/text-two-columns.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/text-two-columns.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/text-two-columns.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,44 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Two columns of text.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Two columns of text', 'Block pattern title' ),
- 'categories' => array( 'columns', 'text' ),
- 'content' => '<!-- wp:columns {"align":"full"} -->
- <div class="wp-block-columns"><!-- wp:column -->
- <div class="wp-block-column"><!-- wp:spacer -->
- <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer -->
- <!-- wp:paragraph {"style":{"typography":{"fontSize":"21px"}, "color":{"text":"#000000"}}} -->
- <p class="has-text-color" style="font-size:21px;color:#000000;"><strong>' . esc_html__( 'We have worked with:' ) . '</strong></p>
- <!-- /wp:paragraph -->
-
- <!-- wp:paragraph {"style":{"typography":{"fontSize":"24px","lineHeight":"1.2"}}} -->
- <p style="font-size:24px;line-height:1.2"><a href="https://wordpress.org">' . wp_kses_post( __( 'EARTHFUND™<br>ARCHWEEKLY<br>FUTURE ROADS<br>BUILDING NY' ) ) . '</a></p>
- <!-- /wp:paragraph -->
-
- <!-- wp:spacer -->
- <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer --></div>
- <!-- /wp:column -->
-
- <!-- wp:column -->
- <div class="wp-block-column"><!-- wp:spacer {"height":160} -->
- <div style="height:160px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer -->
-
- <!-- wp:paragraph {"style":{"typography":{"fontSize":"24px","lineHeight":"1.2"}}} -->
- <p style="font-size:24px;line-height:1.2"><a href="https://wordpress.org">' . wp_kses_post( __( 'DUBAI ROOFS<br>MAY WATSON STUDIO<br>Y.O.L<br>RUDIMENTAR' ) ) . '</a></p>
- <!-- /wp:paragraph -->
-
- <!-- wp:spacer -->
- <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer --></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns -->',
- 'description' => _x( 'Two columns of text', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternsthreecolumnsmediatextphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/three-columns-media-text.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/three-columns-media-text.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/three-columns-media-text.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,69 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Three columns with images and text.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Three columns with images and text', 'Block pattern title' ),
- 'categories' => array( 'columns' ),
- 'content' => '<!-- wp:group {"align":"full","style":{"color":{"background":"#f8f4e4"}}} -->
- <div class="wp-block-group alignfull has-background" style="background-color:#f8f4e4"><div class="wp-block-group__inner-container"><!-- wp:columns {"align":"wide"} -->
- <div class="wp-block-columns alignwide"><!-- wp:column -->
- <div class="wp-block-column"><!-- wp:spacer -->
- <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer -->
-
- <!-- wp:heading {"level":6,"style":{"color":{"text":"#000000"}}} -->
- <h6 class="has-text-color" style="color:#000000">' . esc_html__( 'ECOLOGY' ) . '</h6>
- <!-- /wp:heading -->
-
- <!-- wp:paragraph {"style":{"typography":{"lineHeight":"1.1","fontSize":"5vw"},"color":{"text":"#000000"}}} -->
- <p class="has-text-color" style="color:#000000;font-size:5vw;line-height:1.1"><strong>' . esc_html__( 'Natural resources.' ) . '</strong></p>
- <!-- /wp:paragraph --><!-- wp:spacer {"height":5} -->
- <div style="height:5px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer --></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns -->
-
- <!-- wp:columns {"align":"wide"} -->
- <div class="wp-block-columns alignwide"><!-- wp:column {"width":"33.38%"} -->
- <div class="wp-block-column" style="flex-basis:33.38%"><!-- wp:paragraph {"style":{"color":{"text":"#000000"}},"fontSize":"extra-small"} -->
- <p class="has-text-color has-extra-small-font-size" style="color:#000000">' . wp_kses_post( __( '<em>Nature</em>, in the common sense, refers to essences unchanged by man; space, the air, the river, the leaf. <em>Art</em> is applied to the mixture of his will with the same things, as in a house, a canal, a statue, a picture. But his operations taken together are so insignificant, a little chipping, baking, patching, and washing, that in an impression so grand as that of the world on the human mind, they do not vary the result.' ) ) . '</p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column -->
-
- <!-- wp:column {"width":"33%"} -->
- <div class="wp-block-column" style="flex-basis:33%"><!-- wp:spacer -->
- <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer -->
-
- <!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
- <figure class="wp-block-image size-large"><img src="https://s.w.org/images/core/5.8/outside-01.jpg" alt="' . esc_attr__( 'The sun setting through a dense forest of trees.' ) . '" /></figure>
- <!-- /wp:image --></div>
- <!-- /wp:column -->
-
- <!-- wp:column {"width":"33.62%"} -->
- <div class="wp-block-column" style="flex-basis:33.62%"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
- <figure class="wp-block-image size-large"><img src="https://s.w.org/images/core/5.8/outside-02.jpg" alt="' . esc_attr__( 'Wind turbines standing on a grassy plain, against a blue sky.' ) . '" /></figure>
- <!-- /wp:image --></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns -->
-
- <!-- wp:columns {"align":"wide"} -->
- <div class="wp-block-columns alignwide"><!-- wp:column {"width":"67%"} -->
- <div class="wp-block-column" style="flex-basis:67%"><!-- wp:image {"align":"right","id":null,"sizeSlug":"large","linkDestination":"none"} -->
- <div class="wp-block-image"><figure class="alignright size-large"><img src="https://s.w.org/images/core/5.8/outside-03.jpg" alt="' . esc_attr__( 'The sun shining over a ridge leading down into the shore. In the distance, a car drives down a road.' ) . '" /></figure></div>
- <!-- /wp:image --></div>
- <!-- /wp:column -->
-
- <!-- wp:column {"verticalAlignment":"center","width":"33%"} -->
- <div class="wp-block-column is-vertically-aligned-center" style="flex-basis:33%"><!-- wp:paragraph {"style":{"color":{"text":"#000000"}},"fontSize":"extra-small"} -->
- <p class="has-text-color has-extra-small-font-size" style="color:#000000">' . esc_html__( "Undoubtedly we have no questions to ask which are unanswerable. We must trust the perfection of the creation so far, as to believe that whatever curiosity the order of things has awakened in our minds, the order of things can satisfy. Every man's condition is a solution in hieroglyphic to those inquiries he would put." ) . '</p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns --></div></div>
- <!-- /wp:group -->',
- 'description' => _x( 'Three columns with images and text', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternsthreecolumnstextphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/three-columns-text.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/three-columns-text.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/three-columns-text.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,43 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Three columns of text.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Three columns of text', 'Block pattern title' ),
- 'categories' => array( 'columns', 'text' ),
- 'content' => '<!-- wp:columns {"align":"full","style":{"color":{"text":"#000000","background":"#ffffff"}}} -->
- <div class="wp-block-columns alignfull has-text-color has-background" style="background-color:#ffffff;color:#000000"><!-- wp:column -->
- <div class="wp-block-column"><!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px","lineHeight":"1.3"}}} -->
- <h3 style="font-size:24px;line-height:1.3"><strong><a href="http://wordpress.org">' . esc_html__( 'Virtual Tour ↗' ) . '</a></strong></h3>
- <!-- /wp:heading -->
-
- <!-- wp:paragraph -->
- <p>' . esc_html__( 'Get a virtual tour of the museum. Ideal for schools and events.' ) . '</p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column -->
-
- <!-- wp:column -->
- <div class="wp-block-column"><!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px","lineHeight":"1.3"}}} -->
- <h3 style="font-size:24px;line-height:1.3"><strong><a href="https://wordpress.org">' . esc_html__( 'Current Shows ↗' ) . '</a></strong></h3>
- <!-- /wp:heading -->
-
- <!-- wp:paragraph -->
- <p>' . esc_html__( 'Stay updated and see our current exhibitions here.' ) . '</p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column -->
-
- <!-- wp:column -->
- <div class="wp-block-column"><!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px","lineHeight":"1.3"}}} -->
- <h3 style="font-size:24px;line-height:1.3"><strong><a href="https://wordpress.org">' . esc_html__( 'Useful Info ↗' ) . '</a></strong></h3>
- <!-- /wp:heading -->
-
- <!-- wp:paragraph -->
- <p>' . esc_html__( 'Get to know our opening times, ticket prices and discounts.' ) . '</p>
- <!-- /wp:paragraph --></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns -->',
- 'description' => _x( 'Three columns of text', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternsthreeimagesgalleryphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/three-images-gallery.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/three-images-gallery.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/three-images-gallery.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,43 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Three columns with offset images.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Three columns with offset images', 'Block pattern title' ),
- 'categories' => array( 'gallery' ),
- 'content' => '<!-- wp:columns {"align":"wide"} -->
- <div class="wp-block-columns alignwide"><!-- wp:column {"width":"25%"} -->
- <div class="wp-block-column" style="flex-basis:25%"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
- <figure class="wp-block-image size-large is-style-default"><img src="https://s.w.org/images/core/5.8/architecture-01.jpg" alt="' . esc_attr__( 'Close-up, abstract view of geometric architecture.' ) . '" /></figure>
- <!-- /wp:image --></div>
- <!-- /wp:column -->
-
- <!-- wp:column {"width":"25%"} -->
- <div class="wp-block-column" style="flex-basis:25%"><!-- wp:spacer {"height":500} -->
- <div style="height:500px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer -->
-
- <!-- wp:spacer {"height":150} -->
- <div style="height:150px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer -->
-
- <!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
- <figure class="wp-block-image size-large"><img src="https://s.w.org/images/core/5.8/architecture-02.jpg" alt="' . esc_attr__( 'Close-up, angled view of a window on a white building.' ) . '" /></figure>
- <!-- /wp:image --></div>
- <!-- /wp:column -->
-
- <!-- wp:column {"width":"45%"} -->
- <div class="wp-block-column" style="flex-basis:45%"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
- <figure class="wp-block-image size-large is-style-default"><img src="https://s.w.org/images/core/5.8/architecture-03.jpg" alt="' . esc_attr__( 'Close-up of the corner of a white, geometric building with both sharp points and round corners.' ) . '" /></figure>
- <!-- /wp:image -->
-
- <!-- wp:spacer {"height":285} -->
- <div style="height:285px" aria-hidden="true" class="wp-block-spacer"></div>
- <!-- /wp:spacer --></div>
- <!-- /wp:column --></div>
- <!-- /wp:columns -->',
- 'description' => _x( 'Three columns with offset images', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternstwobuttonsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/two-buttons.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/two-buttons.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/two-buttons.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,22 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Two Buttons block pattern.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Two buttons', 'Block pattern title' ),
- 'content' => '<!-- wp:buttons {"contentJustification":"center"} -->
- <div class="wp-block-buttons is-content-justification-center"><!-- wp:button {"borderRadius":0} -->
- <div class="wp-block-button"><a class="wp-block-button__link no-border-radius">' . esc_html__( 'Our Work' ) . '</a></div>
- <!-- /wp:button -->
-
- <!-- wp:button {"borderRadius":1,"className":"is-style-outline"} -->
- <div class="wp-block-button is-style-outline"><a class="wp-block-button__link" style="border-radius:1px">' . esc_html__( 'Where We Are' ) . '</a></div>
- <!-- /wp:button --></div>
- <!-- /wp:buttons -->',
- 'viewportWidth' => 500,
- 'categories' => array( 'buttons' ),
- 'description' => _x( 'Two buttons, one filled and one outlined, side by side.', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternstwoimagesgalleryphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-patterns/two-images-gallery.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns/two-images-gallery.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns/two-images-gallery.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,15 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Two images side by side.
- *
- * @package WordPress
- */
-
-return array(
- 'title' => _x( 'Two images side by side', 'Block pattern title' ),
- 'categories' => array( 'gallery' ),
- 'content' => '<!-- wp:gallery {"ids":[null,null],"linkTo":"none","align":"wide"} -->
- <figure class="wp-block-gallery alignwide columns-2 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="https://s.w.org/images/core/5.8/nature-above-01.jpg" alt="' . esc_attr__( 'An aerial view of waves crashing against a shore.' ) . '" data-full-url="https://s.w.org/images/core/5.8/nature-above-01.jpg" data-link="#" /></figure></li><li class="blocks-gallery-item"><figure><img src="https://s.w.org/images/core/5.8/nature-above-02.jpg" alt="' . esc_attr__( 'An aerial view of a field. A road runs through the upper right corner.' ) . '" data-full-url="https://s.w.org/images/core/5.8/nature-above-02.jpg" data-link="#" /></figure></li></ul></figure>
- <!-- /wp:gallery -->',
- 'description' => _x( 'Two images side by side', 'Block pattern description' ),
-);
</del></span></pre></div>
<a id="trunksrcwpincludesblockpatternsphp"></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/block-patterns.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-patterns.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/block-patterns.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,21 +19,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $should_register_core_patterns ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $core_block_patterns = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'media-text-nature',
- 'two-images-gallery',
- 'three-columns-media-text',
- 'quote',
- 'large-header-left',
- 'large-header-text-button',
- 'media-text-art',
- 'text-two-columns-title',
- 'three-columns-text',
- 'text-two-columns-title-offset',
- 'heading',
- 'three-images-gallery',
- 'text-two-columns',
- 'media-text-arquitecture',
- 'two-buttons',
</del><span class="cx" style="display: block; padding: 0 10px"> 'query-standard-posts',
</span><span class="cx" style="display: block; padding: 0 10px"> 'query-medium-posts',
</span><span class="cx" style="display: block; padding: 0 10px"> 'query-small-posts',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,3 +43,43 @@
</span><span class="cx" style="display: block; padding: 0 10px"> register_block_pattern_category( 'text', array( 'label' => _x( 'Text', 'Block pattern category' ) ) );
</span><span class="cx" style="display: block; padding: 0 10px"> register_block_pattern_category( 'query', array( 'label' => __( 'Query', 'Block pattern category' ) ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Import patterns from wordpress.org/patterns.
+ */
+function _load_remote_block_patterns( $current_screen ) {
+ if ( ! $current_screen->is_block_editor ) {
+ return;
+ }
+
+ $supports_core_patterns = get_theme_support( 'core-block-patterns' );
+
+ /**
+ * Filter to disable remote block patterns.
+ *
+ * @since 5.8.0
+ *
+ * @param bool $should_load_remote
+ */
+ $should_load_remote = apply_filters( 'should_load_remote_block_patterns', true );
+
+ if ( $supports_core_patterns && $should_load_remote ) {
+ $patterns = get_transient( 'wp_remote_block_patterns' );
+ if ( ! $patterns ) {
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $core_keyword_id = 11; // 11 is the ID for "core".
+ $request->set_param( 'keyword', $core_keyword_id );
+ $response = rest_do_request( $request );
+ if ( $response->is_error() ) {
+ return;
+ }
+ $patterns = $response->get_data();
+ set_transient( 'wp_remote_block_patterns', $patterns, HOUR_IN_SECONDS );
+ }
+
+ foreach ( $patterns as $settings ) {
+ $pattern_name = 'core/' . sanitize_title( $settings['title'] );
+ register_block_pattern( $pattern_name, (array) $settings );
+ }
+ }
+}
</ins></span></pre></div>
<a id="trunksrcwpincludesdefaultfiltersphp"></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/default-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/default-filters.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/default-filters.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -315,6 +315,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'init', '_register_core_block_patterns_and_categories' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'current_screen', '_load_remote_block_patterns' );
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'init', 'check_theme_switched', 99 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'init', array( 'WP_Block_Supports', 'init' ), 22 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'after_switch_theme', '_wp_menus_changed' );
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestpatterndirectorycontrollerphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-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-pattern-directory-controller.php (rev 0)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,297 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Block Pattern Directory REST API: WP_REST_Pattern_Directory_Controller class
+ *
+ * @package WordPress
+ * @subpackage REST_API
+ * @since 5.8.0
+ */
+
+/**
+ * Controller which provides REST endpoint for block patterns.
+ *
+ * This simply proxies the endpoint at http://api.wordpress.org/patterns/1.0/. That isn't necessary for
+ * functionality, but is desired for privacy. It prevents api.wordpress.org from knowing the user's IP address.
+ *
+ * @since 5.8.0
+ *
+ * @see WP_REST_Controller
+ */
+class WP_REST_Pattern_Directory_Controller extends WP_REST_Controller {
+
+ /**
+ * Constructs the controller.
+ */
+ public function __construct() {
+ $this->namespace = 'wp/v2';
+ $this->rest_base = 'pattern-directory';
+ }
+
+ /**
+ * Registers the necessary REST API routes.
+ */
+ public function register_routes() {
+ register_rest_route(
+ $this->namespace,
+ '/' . $this->rest_base . '/patterns',
+ array(
+ array(
+ 'methods' => WP_REST_Server::READABLE,
+ 'callback' => array( $this, 'get_items' ),
+ 'permission_callback' => array( $this, 'get_items_permissions_check' ),
+ 'args' => $this->get_collection_params(),
+ ),
+ 'schema' => array( $this, 'get_public_item_schema' ),
+ )
+ );
+ }
+
+ /**
+ * Checks whether a given request has permission to view the local pattern directory.
+ *
+ * @since 5.8.0
+ *
+ * @param WP_REST_Request $request Full details about the request.
+ *
+ * @return WP_Error|bool True if the request has permission, WP_Error object otherwise.
+ */
+ public function get_items_permissions_check( $request ) {
+ if ( current_user_can( 'edit_posts' ) ) {
+ return true;
+ }
+
+ foreach ( get_post_types( array( 'show_in_rest' => true ), 'objects' ) as $post_type ) {
+ if ( current_user_can( $post_type->cap->edit_posts ) ) {
+ return true;
+ }
+ }
+
+ return new WP_Error(
+ 'rest_pattern_directory_cannot_view',
+ __( 'Sorry, you are not allowed to browse the local block pattern directory.' ),
+ array( 'status' => rest_authorization_required_code() )
+ );
+ }
+
+ /**
+ * Search and retrieve block patterns metadata
+ *
+ * @since 5.8.0
+ *
+ * @param WP_REST_Request $request Full details about the request.
+ *
+ * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
+ */
+ public function get_items( $request ) {
+ $query_args = array();
+ $category_id = $request['category'];
+ $keyword_id = $request['keyword'];
+ $search_term = $request['search'];
+
+ if ( $category_id ) {
+ $query_args['pattern-categories'] = $category_id;
+ }
+
+ if ( $keyword_id ) {
+ $query_args['pattern-keywords'] = $keyword_id;
+ }
+
+ if ( $search_term ) {
+ $query_args['search'] = $search_term;
+ }
+
+ $api_url = add_query_arg(
+ array_map( 'rawurlencode', $query_args ),
+ 'http://api.wordpress.org/patterns/1.0/'
+ );
+
+ if ( wp_http_supports( array( 'ssl' ) ) ) {
+ $api_url = set_url_scheme( $api_url, 'https' );
+ }
+
+ $wporg_response = wp_remote_get( $api_url );
+ $raw_patterns = json_decode( wp_remote_retrieve_body( $wporg_response ) );
+
+ if ( is_wp_error( $wporg_response ) ) {
+ $wporg_response->add_data( array( 'status' => 500 ) );
+
+ return $wporg_response;
+ }
+
+ // Make sure w.org returned valid data.
+ if ( ! is_array( $raw_patterns ) ) {
+ return new WP_Error(
+ 'pattern_api_failed',
+ sprintf(
+ /* translators: %s: Support forums URL. */
+ __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
+ __( 'https://wordpress.org/support/forums/' )
+ ),
+ array(
+ 'status' => 500,
+ 'response' => wp_remote_retrieve_body( $wporg_response ),
+ )
+ );
+ }
+
+ $response = array();
+
+ if ( $raw_patterns ) {
+ foreach ( $raw_patterns as $pattern ) {
+ $response[] = $this->prepare_response_for_collection(
+ $this->prepare_item_for_response( $pattern, $request )
+ );
+ }
+ }
+
+ return new WP_REST_Response( $response );
+ }
+
+ /**
+ * Prepare a raw pattern before it's output in an API response.
+ *
+ * @since 5.8.0
+ *
+ * @param object $raw_pattern A pattern from api.wordpress.org, before any changes.
+ * @param WP_REST_Request $request Request object.
+ *
+ * @return WP_REST_Response
+ */
+ public function prepare_item_for_response( $raw_pattern, $request ) {
+ $prepared_pattern = array(
+ 'id' => absint( $raw_pattern->id ),
+ 'title' => sanitize_text_field( $raw_pattern->title->rendered ),
+ 'content' => wp_kses_post( $raw_pattern->pattern_content ),
+ 'categories' => array_map( 'sanitize_title', $raw_pattern->category_slugs ),
+ 'keywords' => array_map( 'sanitize_title', $raw_pattern->keyword_slugs ),
+ 'description' => sanitize_text_field( $raw_pattern->meta->wpop_description ),
+ 'viewport_width' => absint( $raw_pattern->meta->wpop_viewport_width ),
+ );
+
+ $prepared_pattern = $this->add_additional_fields_to_object( $prepared_pattern, $request );
+
+ $response = new WP_REST_Response( $prepared_pattern );
+
+ /**
+ * Filters the REST API response for a pattern.
+ *
+ * @since 5.8.0
+ *
+ * @param WP_REST_Response $response The response object.
+ * @param object $raw_pattern The unprepared pattern.
+ * @param WP_REST_Request $request The request object.
+ */
+ return apply_filters( 'rest_prepare_block_pattern', $response, $raw_pattern, $request );
+ }
+
+ /**
+ * Retrieves the pattern's schema, conforming to JSON Schema.
+ *
+ * @since 5.8.0
+ *
+ * @return array Item schema data.
+ */
+ public function get_item_schema() {
+ if ( $this->schema ) {
+ return $this->add_additional_fields_schema( $this->schema );
+ }
+
+ $this->schema = array(
+ '$schema' => 'http://json-schema.org/draft-04/schema#',
+ 'title' => 'pattern-directory-item',
+ 'type' => 'object',
+ 'properties' => array(
+ 'id' => array(
+ 'description' => __( 'The pattern ID.' ),
+ 'type' => 'integer',
+ 'minimum' => 1,
+ 'context' => array( 'view', 'embed' ),
+ ),
+
+ 'title' => array(
+ 'description' => __( 'The pattern title, in human readable format.' ),
+ 'type' => 'string',
+ 'minLength' => 1,
+ 'context' => array( 'view', 'embed' ),
+ ),
+
+ 'content' => array(
+ 'description' => __( 'The pattern content.' ),
+ 'type' => 'string',
+ 'minLength' => 1,
+ 'context' => array( 'view', 'embed' ),
+ ),
+
+ 'categories' => array(
+ 'description' => __( "The pattern's category slugs." ),
+ 'type' => 'array',
+ 'uniqueItems' => true,
+ 'items' => array( 'type' => 'string' ),
+ 'context' => array( 'view', 'embed' ),
+ ),
+
+ 'keywords' => array(
+ 'description' => __( "The pattern's keyword slugs." ),
+ 'type' => 'array',
+ 'uniqueItems' => true,
+ 'items' => array( 'type' => 'string' ),
+ 'context' => array( 'view', 'embed' ),
+ ),
+
+ 'description' => array(
+ 'description' => __( 'A description of the pattern.' ),
+ 'type' => 'string',
+ 'minLength' => 1,
+ 'context' => array( 'view', 'embed' ),
+ ),
+
+ 'viewport_width' => array(
+ 'description' => __( 'The preferred width of the viewport when previewing a pattern, in pixels.' ),
+ 'type' => 'integer',
+ 'context' => array( 'view', 'embed' ),
+ ),
+ ),
+ );
+
+ return $this->add_additional_fields_schema( $this->schema );
+ }
+
+ /**
+ * Retrieves the search params for the patterns collection.
+ *
+ * @since 5.8.0
+ *
+ * @return array Collection parameters.
+ */
+ public function get_collection_params() {
+ $query_params = parent::get_collection_params();
+
+ // Pagination is not supported.
+ unset( $query_params['page'] );
+ unset( $query_params['per_page'] );
+
+ $query_params['search']['minLength'] = 1;
+ $query_params['context']['default'] = 'view';
+
+ $query_params['category'] = array(
+ 'description' => __( 'Limit results to those matching a category ID.' ),
+ 'type' => 'integer',
+ 'minimum' => 1,
+ );
+
+ $query_params['keyword'] = array(
+ 'description' => __( 'Limit results to those matching a keyword ID.' ),
+ 'type' => 'integer',
+ 'minimum' => 1,
+ );
+
+ /**
+ * Filter collection parameters for the pattern directory controller.
+ *
+ * @since 5.8.0
+ *
+ * @param array $query_params JSON Schema-formatted collection parameters.
+ */
+ return apply_filters( 'rest_pattern_directory_collection_params', $query_params );
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.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="trunksrcwpincludesrestapiphp"></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.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-includes/rest-api.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -329,6 +329,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $controller = new WP_REST_Block_Directory_Controller();
</span><span class="cx" style="display: block; padding: 0 10px"> $controller->register_routes();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Pattern Directory.
+ $controller = new WP_REST_Pattern_Directory_Controller();
+ $controller->register_routes();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Site Health.
</span><span class="cx" style="display: block; padding: 0 10px"> $site_health = WP_Site_Health::get_instance();
</span><span class="cx" style="display: block; padding: 0 10px"> $controller = new WP_REST_Site_Health_Controller( $site_health );
</span></span></pre></div>
<a id="trunksrcwpsettingsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-settings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-settings.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/src/wp-settings.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -268,6 +268,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-themes-controller.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-plugins-controller.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-directory-controller.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-application-passwords-controller.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-site-health-controller.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-sidebars-controller.php';
</span></span></pre></div>
<a id="trunktestsphpunitdatablockspatterndirectorybrowsealljson"></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/blocks/pattern-directory/browse-all.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/blocks/pattern-directory/browse-all.json (rev 0)
+++ trunk/tests/phpunit/data/blocks/pattern-directory/browse-all.json 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,50 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+[
+ {
+ "id": 31,
+ "title": { "rendered": "Heading and paragraph" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 class=\"has-large-font-size\"><span style=\"color:#ba0c49\" class=\"has-inline-color\"><strong>2</strong>.</span><br>Which treats of the first sally the ingenious Don Quixote made from home</h2>\n\n\n\n<p>These preliminaries settled, he did not care to put off any longer the execution of his design, urged on to it by the thought of all the world was losing by his delay, seeing what wrongs he intended to right, grievances to redress, injustices to repair, abuses to remove, and duties to discharge.</p>\n</div></div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "A heading preceded by a chapter number, and followed by a paragraph.",
+ "wpop_viewport_width": 1000
+ },
+ "category_slugs": [ "text" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:group -->\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\"><!-- wp:heading {\"fontSize\":\"large\"} -->\n<h2 class=\"has-large-font-size\"><span style=\"color:#ba0c49\" class=\"has-inline-color\"><strong>2</strong>.</span><br>Which treats of the first sally the ingenious Don Quixote made from home</h2>\n<!-- /wp:heading -->\n\n<!-- wp:paragraph -->\n<p>These preliminaries settled, he did not care to put off any longer the execution of his design, urged on to it by the thought of all the world was losing by his delay, seeing what wrongs he intended to right, grievances to redress, injustices to repair, abuses to remove, and duties to discharge.</p>\n<!-- /wp:paragraph --></div></div>\n<!-- /wp:group -->"
+ },
+ {
+ "id": 25,
+ "title": { "rendered": "Large header with a heading" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-cover alignwide has-background-dim-20 has-background-dim is-position-center-center\" style=\"background-image:url(https://s.w.org/images/core/5.5/don-quixote-06.jpg);min-height:375px;background-position:40% 26%\"><div class=\"wp-block-cover__inner-container\">\n<p class=\"has-text-align-center has-text-color\" style=\"color:#fffffa;font-size:74px;line-height:1.1\"><strong>Don Quixote</strong></p>\n</div></div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "A large hero section with an example background image and a heading in the center.",
+ "wpop_viewport_width": 1000
+ },
+ "category_slugs": [ "header" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:cover {\"url\":\"https:\\/\\/s.w.org\\/images\\/core\\/5.5\\/don-quixote-06.jpg\",\"id\":165,\"dimRatio\":15,\"focalPoint\":{\"x\":\"0.40\",\"y\":\"0.26\"},\"minHeight\":375,\"minHeightUnit\":\"px\",\"contentPosition\":\"center center\",\"align\":\"wide\",\"className\":\"is-position-center-center\"} -->\n<div class=\"wp-block-cover alignwide has-background-dim-20 has-background-dim is-position-center-center\" style=\"background-image:url(https://s.w.org/images/core/5.5/don-quixote-06.jpg);min-height:375px;background-position:40% 26%\"><div class=\"wp-block-cover__inner-container\"><!-- wp:paragraph {\"align\":\"center\",\"placeholder\":\"Write title\\u2026\",\"style\&
quot;:{\"typography\":{\"fontSize\":74,\"lineHeight\":\"1.1\"},\"color\":{\"text\":\"#fffffa\"}}} -->\n<p class=\"has-text-align-center has-text-color\" style=\"color:#fffffa;font-size:74px;line-height:1.1\"><strong>Don Quixote</strong></p>\n<!-- /wp:paragraph --></div></div>\n<!-- /wp:cover -->"
+ },
+ {
+ "id": 26,
+ "title": { "rendered": "Large header with a heading and a button" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-cover alignwide has-background-dim has-background-gradient is-position-center-center\" style=\"background:linear-gradient(135deg,rgb(249,72,72) 1%,rgb(179,22,22) 100%);min-height:575px\"><div class=\"wp-block-cover__inner-container\">\n<div class=\"wp-block-columns alignwide\">\n<div class=\"wp-block-column\" style=\"flex-basis:12%\">\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n</div>\n\n\n\n<div class=\"wp-block-column\">\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n\n\n\n<p class=\"has-text-align-left has-text-color\" style=\"color:#fffffa;font-size:68px;line-height:1.2\"><strong>Thou hast seen</strong><br><strong>
;nothing yet</strong></p>\n\n\n\n<div class=\"wp-block-buttons\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:3px;background-color:#fffffa;color:#00000a\">Read now</a></div>\n</div>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n</div>\n\n\n\n<div class=\"wp-block-column\" style=\"flex-basis:12%\">\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n</div>\n</div>\n</div></div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "A large hero section with a bright gradient background, a big heading and a filled button.",
+ "wpop_viewport_width": 1000
+ },
+ "category_slugs": [ "header" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:cover {\"minHeight\":575,\"minHeightUnit\":\"px\",\"customGradient\":\"linear-gradient(135deg,rgb(249,72,72) 1%,rgb(179,22,22) 100%)\",\"contentPosition\":\"center center\",\"align\":\"wide\",\"className\":\"is-position-center-center\"} -->\n<div class=\"wp-block-cover alignwide has-background-dim has-background-gradient is-position-center-center\" style=\"background:linear-gradient(135deg,rgb(249,72,72) 1%,rgb(179,22,22) 100%);min-height:575px\"><div class=\"wp-block-cover__inner-container\"><!-- wp:columns {\"align\":\"wide\"} -->\n<div class=\"wp-block-columns alignwide\"><!-- wp:column {\"width\":\"12%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:12%\"><!-- wp:spacer --&g
t;\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer --></div>\n<!-- /wp:column -->\n\n<!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:spacer -->\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer -->\n\n<!-- wp:paragraph {\"align\":\"left\",\"placeholder\":\"Write title\\u2026\",\"style\":{\"typography\":{\"fontSize\":68,\"lineHeight\":\"1.2\"},\"color\":{\"text\":\"#fffffa\"}}} -->\n<p class=\"has-text-align-left has-text-color\" style=\"color:#fffffa;font-size:68px;line-height:1.2\"><strong>Thou hast seen</strong><br><strong>nothing yet</strong></p>\n<
;!-- /wp:paragraph -->\n\n<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"borderRadius\":3,\"style\":{\"color\":{\"background\":\"#fffffa\",\"text\":\"#00000a\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:3px;background-color:#fffffa;color:#00000a\">Read now</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->\n\n<!-- wp:spacer -->\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer --></div>\n<!-- /wp:column -->\n\n<!-- wp:column {\"width\":\"12%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:12%\"><!-- wp:spacer -->\n<d
iv style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer --></div>\n<!-- /wp:column --></div>\n<!-- /wp:columns --></div></div>\n<!-- /wp:cover -->"
+ }
+]
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/blocks/pattern-directory/browse-all.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="trunktestsphpunitdatablockspatterndirectorybrowsecategory2json"></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/blocks/pattern-directory/browse-category-2.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/blocks/pattern-directory/browse-category-2.json (rev 0)
+++ trunk/tests/phpunit/data/blocks/pattern-directory/browse-category-2.json 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,34 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+[
+ {
+ "id": 15,
+ "title": { "rendered": "Three buttons" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-buttons aligncenter\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(135deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">About Cervantes</a></div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(317deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">Contact us</a></div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(42deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">Books</a></div>\n</div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "Three filled buttons with rounded corners, side by side.",
+ "wpop_viewport_width": 600
+ },
+ "category_slugs": [ "buttons" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:buttons {\"align\":\"center\"} -->\n<div class=\"wp-block-buttons aligncenter\"><!-- wp:button {\"borderRadius\":50,\"style\":{\"color\":{\"gradient\":\"linear-gradient(135deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%)\",\"text\":\"#fffffa\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(135deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">About Cervantes</a></div>\n<!-- /wp:button -->\n\n<!-- wp:button {\"borderRadius\":50,\"style\":{\"color\":{\"gradient\":\"linear-gradient(317deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%)\",\"text\":\"#fffffa\"}}} -->\n<div class=\"wp-blo
ck-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(317deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">Contact us</a></div>\n<!-- /wp:button -->\n\n<!-- wp:button {\"borderRadius\":50,\"style\":{\"color\":{\"gradient\":\"linear-gradient(42deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%)\",\"text\":\"#fffffa\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(42deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">Books</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->"
+ },
+ {
+ "id": 5,
+ "title": { "rendered": "Two buttons" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-buttons aligncenter\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:2px;background-color:#ba0c49;color:#fffffa\">Download now</a></div>\n\n\n\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\" style=\"border-radius:2px;color:#ba0c49\">About Cervantes</a></div>\n</div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "Two buttons, one filled and one outlined, side by side.",
+ "wpop_viewport_width": 500
+ },
+ "category_slugs": [ "buttons" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:buttons {\"align\":\"center\"} -->\n<div class=\"wp-block-buttons aligncenter\"><!-- wp:button {\"borderRadius\":2,\"style\":{\"color\":{\"background\":\"#ba0c49\",\"text\":\"#fffffa\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:2px;background-color:#ba0c49;color:#fffffa\">Download now</a></div>\n<!-- /wp:button -->\n\n<!-- wp:button {\"borderRadius\":2,\"style\":{\"color\":{\"text\":\"#ba0c49\"}},\"className\":\"is-style-outline\"} -->\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\" style=\"border-radius:2px;color:#ba0c49\&q
uot;>About Cervantes</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->"
+ }
+]
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/blocks/pattern-directory/browse-category-2.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="trunktestsphpunitdatablockspatterndirectorybrowsekeyword11json"></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/blocks/pattern-directory/browse-keyword-11.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/blocks/pattern-directory/browse-keyword-11.json (rev 0)
+++ trunk/tests/phpunit/data/blocks/pattern-directory/browse-keyword-11.json 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,50 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+[
+ {
+ "id": 31,
+ "title": { "rendered": "Heading and paragraph" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2 class=\"has-large-font-size\"><span style=\"color:#ba0c49\" class=\"has-inline-color\"><strong>2</strong>.</span><br>Which treats of the first sally the ingenious Don Quixote made from home</h2>\n\n\n\n<p>These preliminaries settled, he did not care to put off any longer the execution of his design, urged on to it by the thought of all the world was losing by his delay, seeing what wrongs he intended to right, grievances to redress, injustices to repair, abuses to remove, and duties to discharge.</p>\n</div></div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "A heading preceded by a chapter number, and followed by a paragraph.",
+ "wpop_viewport_width": 1000
+ },
+ "category_slugs": [ "text" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:group -->\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\"><!-- wp:heading {\"fontSize\":\"large\"} -->\n<h2 class=\"has-large-font-size\"><span style=\"color:#ba0c49\" class=\"has-inline-color\"><strong>2</strong>.</span><br>Which treats of the first sally the ingenious Don Quixote made from home</h2>\n<!-- /wp:heading -->\n\n<!-- wp:paragraph -->\n<p>These preliminaries settled, he did not care to put off any longer the execution of his design, urged on to it by the thought of all the world was losing by his delay, seeing what wrongs he intended to right, grievances to redress, injustices to repair, abuses to remove, and duties to discharge.</p>\n<!-- /wp:paragraph --></div></div>\n<!-- /wp:group -->"
+ },
+ {
+ "id": 25,
+ "title": { "rendered": "Large header with a heading" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-cover alignwide has-background-dim-20 has-background-dim is-position-center-center\" style=\"background-image:url(https://s.w.org/images/core/5.5/don-quixote-06.jpg);min-height:375px;background-position:40% 26%\"><div class=\"wp-block-cover__inner-container\">\n<p class=\"has-text-align-center has-text-color\" style=\"color:#fffffa;font-size:74px;line-height:1.1\"><strong>Don Quixote</strong></p>\n</div></div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "A large hero section with an example background image and a heading in the center.",
+ "wpop_viewport_width": 1000
+ },
+ "category_slugs": [ "header" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:cover {\"url\":\"https:\\/\\/s.w.org\\/images\\/core\\/5.5\\/don-quixote-06.jpg\",\"id\":165,\"dimRatio\":15,\"focalPoint\":{\"x\":\"0.40\",\"y\":\"0.26\"},\"minHeight\":375,\"minHeightUnit\":\"px\",\"contentPosition\":\"center center\",\"align\":\"wide\",\"className\":\"is-position-center-center\"} -->\n<div class=\"wp-block-cover alignwide has-background-dim-20 has-background-dim is-position-center-center\" style=\"background-image:url(https://s.w.org/images/core/5.5/don-quixote-06.jpg);min-height:375px;background-position:40% 26%\"><div class=\"wp-block-cover__inner-container\"><!-- wp:paragraph {\"align\":\"center\",\"placeholder\":\"Write title\\u2026\",\"style\&
quot;:{\"typography\":{\"fontSize\":74,\"lineHeight\":\"1.1\"},\"color\":{\"text\":\"#fffffa\"}}} -->\n<p class=\"has-text-align-center has-text-color\" style=\"color:#fffffa;font-size:74px;line-height:1.1\"><strong>Don Quixote</strong></p>\n<!-- /wp:paragraph --></div></div>\n<!-- /wp:cover -->"
+ },
+ {
+ "id": 26,
+ "title": { "rendered": "Large header with a heading and a button" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-cover alignwide has-background-dim has-background-gradient is-position-center-center\" style=\"background:linear-gradient(135deg,rgb(249,72,72) 1%,rgb(179,22,22) 100%);min-height:575px\"><div class=\"wp-block-cover__inner-container\">\n<div class=\"wp-block-columns alignwide\">\n<div class=\"wp-block-column\" style=\"flex-basis:12%\">\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n</div>\n\n\n\n<div class=\"wp-block-column\">\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n\n\n\n<p class=\"has-text-align-left has-text-color\" style=\"color:#fffffa;font-size:68px;line-height:1.2\"><strong>Thou hast seen</strong><br><strong>
;nothing yet</strong></p>\n\n\n\n<div class=\"wp-block-buttons\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:3px;background-color:#fffffa;color:#00000a\">Read now</a></div>\n</div>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n</div>\n\n\n\n<div class=\"wp-block-column\" style=\"flex-basis:12%\">\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n</div>\n</div>\n</div></div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "A large hero section with a bright gradient background, a big heading and a filled button.",
+ "wpop_viewport_width": 1000
+ },
+ "category_slugs": [ "header" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:cover {\"minHeight\":575,\"minHeightUnit\":\"px\",\"customGradient\":\"linear-gradient(135deg,rgb(249,72,72) 1%,rgb(179,22,22) 100%)\",\"contentPosition\":\"center center\",\"align\":\"wide\",\"className\":\"is-position-center-center\"} -->\n<div class=\"wp-block-cover alignwide has-background-dim has-background-gradient is-position-center-center\" style=\"background:linear-gradient(135deg,rgb(249,72,72) 1%,rgb(179,22,22) 100%);min-height:575px\"><div class=\"wp-block-cover__inner-container\"><!-- wp:columns {\"align\":\"wide\"} -->\n<div class=\"wp-block-columns alignwide\"><!-- wp:column {\"width\":\"12%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:12%\"><!-- wp:spacer --&g
t;\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer --></div>\n<!-- /wp:column -->\n\n<!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:spacer -->\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer -->\n\n<!-- wp:paragraph {\"align\":\"left\",\"placeholder\":\"Write title\\u2026\",\"style\":{\"typography\":{\"fontSize\":68,\"lineHeight\":\"1.2\"},\"color\":{\"text\":\"#fffffa\"}}} -->\n<p class=\"has-text-align-left has-text-color\" style=\"color:#fffffa;font-size:68px;line-height:1.2\"><strong>Thou hast seen</strong><br><strong>nothing yet</strong></p>\n<
;!-- /wp:paragraph -->\n\n<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"borderRadius\":3,\"style\":{\"color\":{\"background\":\"#fffffa\",\"text\":\"#00000a\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:3px;background-color:#fffffa;color:#00000a\">Read now</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->\n\n<!-- wp:spacer -->\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer --></div>\n<!-- /wp:column -->\n\n<!-- wp:column {\"width\":\"12%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:12%\"><!-- wp:spacer -->\n<d
iv style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer --></div>\n<!-- /wp:column --></div>\n<!-- /wp:columns --></div></div>\n<!-- /wp:cover -->"
+ }
+]
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/blocks/pattern-directory/browse-keyword-11.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="trunktestsphpunitdatablockspatterndirectorysearchbuttonjson"></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/blocks/pattern-directory/search-button.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/blocks/pattern-directory/search-button.json (rev 0)
+++ trunk/tests/phpunit/data/blocks/pattern-directory/search-button.json 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,66 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+[
+ {
+ "id": 26,
+ "title": { "rendered": "Large header with a heading and a button" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-cover alignwide has-background-dim has-background-gradient is-position-center-center\" style=\"background:linear-gradient(135deg,rgb(249,72,72) 1%,rgb(179,22,22) 100%);min-height:575px\"><div class=\"wp-block-cover__inner-container\">\n<div class=\"wp-block-columns alignwide\">\n<div class=\"wp-block-column\" style=\"flex-basis:12%\">\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n</div>\n\n\n\n<div class=\"wp-block-column\">\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n\n\n\n<p class=\"has-text-align-left has-text-color\" style=\"color:#fffffa;font-size:68px;line-height:1.2\"><strong>Thou hast seen</strong><br><strong>
;nothing yet</strong></p>\n\n\n\n<div class=\"wp-block-buttons\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:3px;background-color:#fffffa;color:#00000a\">Read now</a></div>\n</div>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n</div>\n\n\n\n<div class=\"wp-block-column\" style=\"flex-basis:12%\">\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n</div>\n</div>\n</div></div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "A large hero section with a bright gradient background, a big heading and a filled button.",
+ "wpop_viewport_width": 1000
+ },
+ "category_slugs": [ "header" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:cover {\"minHeight\":575,\"minHeightUnit\":\"px\",\"customGradient\":\"linear-gradient(135deg,rgb(249,72,72) 1%,rgb(179,22,22) 100%)\",\"contentPosition\":\"center center\",\"align\":\"wide\",\"className\":\"is-position-center-center\"} -->\n<div class=\"wp-block-cover alignwide has-background-dim has-background-gradient is-position-center-center\" style=\"background:linear-gradient(135deg,rgb(249,72,72) 1%,rgb(179,22,22) 100%);min-height:575px\"><div class=\"wp-block-cover__inner-container\"><!-- wp:columns {\"align\":\"wide\"} -->\n<div class=\"wp-block-columns alignwide\"><!-- wp:column {\"width\":\"12%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:12%\"><!-- wp:spacer --&g
t;\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer --></div>\n<!-- /wp:column -->\n\n<!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:spacer -->\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer -->\n\n<!-- wp:paragraph {\"align\":\"left\",\"placeholder\":\"Write title\\u2026\",\"style\":{\"typography\":{\"fontSize\":68,\"lineHeight\":\"1.2\"},\"color\":{\"text\":\"#fffffa\"}}} -->\n<p class=\"has-text-align-left has-text-color\" style=\"color:#fffffa;font-size:68px;line-height:1.2\"><strong>Thou hast seen</strong><br><strong>nothing yet</strong></p>\n<
;!-- /wp:paragraph -->\n\n<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"borderRadius\":3,\"style\":{\"color\":{\"background\":\"#fffffa\",\"text\":\"#00000a\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:3px;background-color:#fffffa;color:#00000a\">Read now</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->\n\n<!-- wp:spacer -->\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer --></div>\n<!-- /wp:column -->\n\n<!-- wp:column {\"width\":\"12%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:12%\"><!-- wp:spacer -->\n<d
iv style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer --></div>\n<!-- /wp:column --></div>\n<!-- /wp:columns --></div></div>\n<!-- /wp:cover -->"
+ },
+ {
+ "id": 28,
+ "title": { "rendered": "Three columns of text with buttons" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-group alignwide\"><div class=\"wp-block-group__inner-container\">\n<div class=\"wp-block-columns alignwide\">\n<div class=\"wp-block-column\">\n<p>Which treats of the character and pursuits of the famous Don Quixote of La Mancha.</p>\n\n\n\n<div class=\"wp-block-buttons\">\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\" style=\"border-radius:50px;color:#ba0c49\">Chapter One</a></div>\n</div>\n</div>\n\n\n\n<div class=\"wp-block-column\">\n<p>Which treats of the first sally the ingenious Don Quixote made from home.</p>\n\n\n\n<div class=\"wp-block-buttons\">\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\&quo
t; style=\"border-radius:50px;color:#ba0c49\">Chapter Two</a></div>\n</div>\n</div>\n\n\n\n<div class=\"wp-block-column\">\n<p>Wherein is related the droll way in which Don Quixote had himself dubbed a knight.</p>\n\n\n\n<div class=\"wp-block-buttons\">\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\" style=\"border-radius:50px;color:#ba0c49\">Chapter Three</a></div>\n</div>\n</div>\n</div>\n</div></div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "Three small columns of text, each with an outlined button with rounded corners at the bottom.",
+ "wpop_viewport_width": 1000
+ },
+ "category_slugs": [ "columns" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:group {\"align\":\"wide\"} -->\n<div class=\"wp-block-group alignwide\"><div class=\"wp-block-group__inner-container\"><!-- wp:columns {\"align\":\"wide\"} -->\n<div class=\"wp-block-columns alignwide\"><!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:paragraph -->\n<p>Which treats of the character and pursuits of the famous Don Quixote of La Mancha.</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"borderRadius\":50,\"style\":{\"color\":{\"text\":\"#ba0c49\"}},\"className\":\"is-style-outline\"} -->\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\" style=\"
;border-radius:50px;color:#ba0c49\">Chapter One</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons --></div>\n<!-- /wp:column -->\n\n<!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:paragraph -->\n<p>Which treats of the first sally the ingenious Don Quixote made from home.</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"borderRadius\":50,\"style\":{\"color\":{\"text\":\"#ba0c49\"}},\"className\":\"is-style-outline\"} -->\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\" style=\"border-radius:50px;color:#ba0c49\">Chapter Two</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons --></div>\n<!-- /wp:
column -->\n\n<!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:paragraph -->\n<p>Wherein is related the droll way in which Don Quixote had himself dubbed a knight.</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"borderRadius\":50,\"style\":{\"color\":{\"text\":\"#ba0c49\"}},\"className\":\"is-style-outline\"} -->\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\" style=\"border-radius:50px;color:#ba0c49\">Chapter Three</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons --></div>\n<!-- /wp:column --></div>\n<!-- /wp:columns --></div></div>\n<!-- /wp:group -->"
+ },
+ {
+ "id": 15,
+ "title": { "rendered": "Three buttons" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-buttons aligncenter\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(135deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">About Cervantes</a></div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(317deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">Contact us</a></div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(42deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">Books</a></div>\n</div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "Three filled buttons with rounded corners, side by side.",
+ "wpop_viewport_width": 600
+ },
+ "category_slugs": [ "buttons" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:buttons {\"align\":\"center\"} -->\n<div class=\"wp-block-buttons aligncenter\"><!-- wp:button {\"borderRadius\":50,\"style\":{\"color\":{\"gradient\":\"linear-gradient(135deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%)\",\"text\":\"#fffffa\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(135deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">About Cervantes</a></div>\n<!-- /wp:button -->\n\n<!-- wp:button {\"borderRadius\":50,\"style\":{\"color\":{\"gradient\":\"linear-gradient(317deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%)\",\"text\":\"#fffffa\"}}} -->\n<div class=\"wp-blo
ck-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(317deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">Contact us</a></div>\n<!-- /wp:button -->\n\n<!-- wp:button {\"borderRadius\":50,\"style\":{\"color\":{\"gradient\":\"linear-gradient(42deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%)\",\"text\":\"#fffffa\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:50px;background:linear-gradient(42deg,rgb(135,9,53) 0%,rgb(179,22,22) 100%);color:#fffffa\">Books</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->"
+ },
+ {
+ "id": 5,
+ "title": { "rendered": "Two buttons" },
+ "content": {
+ "rendered": "\n<div class=\"wp-block-buttons aligncenter\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:2px;background-color:#ba0c49;color:#fffffa\">Download now</a></div>\n\n\n\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\" style=\"border-radius:2px;color:#ba0c49\">About Cervantes</a></div>\n</div>\n",
+ "protected": false
+ },
+ "meta": {
+ "spay_email": "",
+ "wpop_description": "Two buttons, one filled and one outlined, side by side.",
+ "wpop_viewport_width": 500
+ },
+ "category_slugs": [ "buttons" ],
+ "keyword_slugs": [ "core" ],
+ "pattern_content": "<!-- wp:buttons {\"align\":\"center\"} -->\n<div class=\"wp-block-buttons aligncenter\"><!-- wp:button {\"borderRadius\":2,\"style\":{\"color\":{\"background\":\"#ba0c49\",\"text\":\"#fffffa\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-color has-background\" style=\"border-radius:2px;background-color:#ba0c49;color:#fffffa\">Download now</a></div>\n<!-- /wp:button -->\n\n<!-- wp:button {\"borderRadius\":2,\"style\":{\"color\":{\"text\":\"#ba0c49\"}},\"className\":\"is-style-outline\"} -->\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link has-text-color\" style=\"border-radius:2px;color:#ba0c49\&q
uot;>About Cervantes</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->"
+ }
+]
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/blocks/pattern-directory/search-button.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="trunktestsphpunittestsblocksblockeditorphp"></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/blocks/block-editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/block-editor.php 2021-05-26 00:28:50 UTC (rev 51020)
+++ trunk/tests/phpunit/tests/blocks/block-editor.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,8 +29,19 @@
</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"> $post = $this->factory()->post->create_and_get( $args );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ global $wp_rest_server;
+ $wp_rest_server = new Spy_REST_Server;
+ do_action( 'rest_api_init', $wp_rest_server );
</ins><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">+ public function tearDown() {
+ /** @var WP_REST_Server $wp_rest_server */
+ global $wp_rest_server;
+ $wp_rest_server = null;
+ parent::tearDown();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function filter_set_block_categories_post( $block_categories, $post ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $post ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $block_categories;
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestpatterndirectorycontrollerphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/tests/rest-api/rest-pattern-directory-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-pattern-directory-controller.php (rev 0)
+++ trunk/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,424 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Unit tests covering WP_REST_Pattern_Directory_Controller functionality.
+ *
+ * @package WordPress
+ * @subpackage REST API
+ */
+
+/**
+ * @group restapi
+ * @group pattern-directory
+ */
+class WP_REST_Pattern_Directory_Controller_Test extends WP_Test_REST_Controller_Testcase {
+
+ /**
+ * Contributor user id.
+ *
+ * @since 5.8.0
+ *
+ * @var int
+ */
+ protected static $contributor_id;
+
+ /**
+ * Set up class test fixtures.
+ *
+ * @since 5.8.0
+ *
+ * @param WP_UnitTest_Factory $factory WordPress unit test factory.
+ */
+ public static function wpSetUpBeforeClass( $factory ) {
+ self::$contributor_id = $factory->user->create(
+ array(
+ 'role' => 'contributor',
+ )
+ );
+ }
+
+ /**
+ * Asserts that the pattern matches the expected response schema.
+ *
+ * @param WP_REST_Response[] $pattern An individual pattern from the REST API response.
+ */
+ public function assertPatternMatchesSchema( $pattern ) {
+ $schema = ( new WP_REST_Pattern_Directory_Controller() )->get_item_schema();
+ $pattern_id = isset( $pattern->id ) ? $pattern->id : '{pattern ID is missing}';
+
+ $this->assertTrue(
+ rest_validate_value_from_schema( $pattern, $schema ),
+ "Pattern ID `$pattern_id` doesn't match the response schema."
+ );
+
+ $this->assertSame(
+ array_keys( $schema['properties'] ),
+ array_keys( $pattern ),
+ "Pattern ID `$pattern_id` doesn't contain all of the fields expected from the schema."
+ );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::register_routes
+ *
+ * @since 5.8.0
+ */
+ public function test_register_routes() {
+ $routes = rest_get_server()->get_routes();
+
+ $this->assertArrayHasKey( '/wp/v2/pattern-directory/patterns', $routes );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_context_param
+ *
+ * @since 5.8.0
+ */
+ public function test_context_param() {
+ $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/pattern-directory/patterns' );
+ $response = rest_get_server()->dispatch( $request );
+ $patterns = $response->get_data();
+
+ $this->assertSame( 'view', $patterns['endpoints'][0]['args']['context']['default'] );
+ $this->assertSame( array( 'view', 'embed' ), $patterns['endpoints'][0]['args']['context']['enum'] );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_items
+ *
+ * @since 5.8.0
+ */
+ public function test_get_items() {
+ wp_set_current_user( self::$contributor_id );
+ self::mock_successful_response( 'browse-all', true );
+
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $response = rest_do_request( $request );
+ $patterns = $response->get_data();
+
+ $this->assertNotWPError( $response->as_error() );
+ $this->assertSame( 200, $response->status );
+ $this->assertGreaterThan( 0, count( $patterns ) );
+
+ array_walk( $patterns, array( $this, 'assertPatternMatchesSchema' ) );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_items
+ *
+ * @since 5.8.0
+ */
+ public function test_get_items_by_category() {
+ wp_set_current_user( self::$contributor_id );
+ self::mock_successful_response( 'browse-category', true );
+
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $request->set_query_params( array( 'category' => 2 ) );
+ $response = rest_do_request( $request );
+ $patterns = $response->get_data();
+
+ $this->assertNotWPError( $response->as_error() );
+ $this->assertSame( 200, $response->status );
+ $this->assertGreaterThan( 0, count( $patterns ) );
+
+ array_walk( $patterns, array( $this, 'assertPatternMatchesSchema' ) );
+
+ foreach ( $patterns as $pattern ) {
+ $this->assertContains( 'buttons', $pattern['categories'] );
+ }
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_items
+ *
+ * @since 5.8.0
+ */
+ public function test_get_items_by_keyword() {
+ wp_set_current_user( self::$contributor_id );
+ self::mock_successful_response( 'browse-keyword', true );
+
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $request->set_query_params( array( 'keyword' => 11 ) );
+ $response = rest_do_request( $request );
+ $patterns = $response->get_data();
+
+ $this->assertNotWPError( $response->as_error() );
+ $this->assertSame( 200, $response->status );
+ $this->assertGreaterThan( 0, count( $patterns ) );
+
+ array_walk( $patterns, array( $this, 'assertPatternMatchesSchema' ) );
+
+ foreach ( $patterns as $pattern ) {
+ $this->assertContains( 'core', $pattern['keywords'] );
+ }
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_items
+ *
+ * @since 5.8.0
+ */
+ public function test_get_items_search() {
+ wp_set_current_user( self::$contributor_id );
+ self::mock_successful_response( 'search', true );
+
+ $search_term = 'button';
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $request->set_query_params( array( 'search' => $search_term ) );
+ $response = rest_do_request( $request );
+ $patterns = $response->get_data();
+
+ $this->assertNotWPError( $response->as_error() );
+ $this->assertSame( 200, $response->status );
+ $this->assertGreaterThan( 0, count( $patterns ) );
+
+ array_walk( $patterns, array( $this, 'assertPatternMatchesSchema' ) );
+
+ foreach ( $patterns as $pattern ) {
+ $search_field_values = $pattern['title'] . ' ' . $pattern['description'];
+
+ $this->assertNotFalse( stripos( $search_field_values, $search_term ) );
+ }
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_items
+ *
+ * @since 5.8.0
+ */
+ public function test_get_items_wdotorg_unavailable() {
+ wp_set_current_user( self::$contributor_id );
+ self::prevent_requests_to_host( 'api.wordpress.org' );
+
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $response = rest_do_request( $request );
+
+ $this->assertErrorResponse( 'patterns_api_failed', $response, 500 );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_items
+ *
+ * @since 5.8.0
+ */
+ public function test_get_items_logged_out() {
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $request->set_query_params( array( 'search' => 'button' ) );
+ $response = rest_do_request( $request );
+
+ $this->assertErrorResponse( 'rest_pattern_directory_cannot_view', $response );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_items
+ *
+ * @since 5.8.0
+ */
+ public function test_get_items_no_results() {
+ wp_set_current_user( self::$contributor_id );
+ self::mock_successful_response( 'browse-all', false );
+
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $request->set_query_params( array( 'category' => PHP_INT_MAX ) );
+ $response = rest_do_request( $request );
+ $patterns = $response->get_data();
+
+ $this->assertSame( 200, $response->status );
+ $this->assertSame( array(), $patterns );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_items
+ *
+ * @since 5.8.0
+ */
+ public function test_get_items_search_no_results() {
+ wp_set_current_user( self::$contributor_id );
+ self::mock_successful_response( 'search', false );
+
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $request->set_query_params( array( 'search' => '0c4549ee68f24eaaed46a49dc983ecde' ) );
+ $response = rest_do_request( $request );
+ $patterns = $response->get_data();
+
+ $this->assertSame( 200, $response->status );
+ $this->assertSame( array(), $patterns );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_items
+ *
+ * @since 5.8.0
+ */
+ public function test_get_items_invalid_response_data() {
+ wp_set_current_user( self::$contributor_id );
+ self::mock_successful_response( 'invalid-data', true );
+
+ $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
+ $response = rest_do_request( $request );
+
+ $this->assertSame( 500, $response->status );
+ $this->assertWPError( $response->as_error() );
+ }
+
+ public function test_get_item() {
+ $this->markTestSkipped( 'Controller does not have get_item route.' );
+ }
+
+ public function test_create_item() {
+ $this->markTestSkipped( 'Controller does not have create_item route.' );
+ }
+
+ public function test_update_item() {
+ $this->markTestSkipped( 'Controller does not have update_item route.' );
+ }
+
+ public function test_delete_item() {
+ $this->markTestSkipped( 'Controller does not have delete_item route.' );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::prepare_item_for_response
+ *
+ * @since 5.8.0
+ */
+ public function test_prepare_item() {
+ $controller = new WP_REST_Pattern_Directory_Controller();
+ $raw_patterns = json_decode( self::get_raw_response( 'browse-all' ) );
+ $raw_patterns[0]->extra_field = 'this should be removed';
+
+ $prepared_pattern = $controller->prepare_response_for_collection(
+ $controller->prepare_item_for_response( $raw_patterns[0], new WP_REST_Request() )
+ );
+
+ $this->assertPatternMatchesSchema( $prepared_pattern );
+ $this->assertArrayNotHasKey( 'extra_field', $prepared_pattern );
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::prepare_item_for_response
+ *
+ * @since 5.8.0
+ */
+ public function test_prepare_item_search() {
+ $controller = new WP_REST_Pattern_Directory_Controller();
+ $raw_patterns = json_decode( self::get_raw_response( 'search' ) );
+ $raw_patterns[0]->extra_field = 'this should be removed';
+
+ $prepared_pattern = $controller->prepare_response_for_collection(
+ $controller->prepare_item_for_response( $raw_patterns[0], new WP_REST_Request() )
+ );
+
+ $this->assertPatternMatchesSchema( $prepared_pattern );
+ $this->assertArrayNotHasKey( 'extra_field', $prepared_pattern );
+ }
+
+ /**
+ * Get a mocked raw response from api.wordpress.org.
+ *
+ * @return string
+ */
+ private static function get_raw_response( $action ) {
+ $fixtures_dir = DIR_TESTDATA . '/blocks/pattern-directory';
+
+ switch ( $action ) {
+ default:
+ case 'browse-all':
+ // Response from https://api.wordpress.org/patterns/1.0/.
+ $response = file_get_contents( $fixtures_dir . '/browse-all.json' );
+ break;
+
+ case 'browse-category':
+ // Response from https://api.wordpress.org/patterns/1.0/?pattern-categories=2.
+ $response = file_get_contents( $fixtures_dir . '/browse-category-2.json' );
+ break;
+
+ case 'browse-keyword':
+ // Response from https://api.wordpress.org/patterns/1.0/?pattern-keywords=11.
+ $response = file_get_contents( $fixtures_dir . '/browse-keyword-11.json' );
+ break;
+
+ case 'search':
+ // Response from https://api.wordpress.org/patterns/1.0/?search=button.
+ $response = file_get_contents( $fixtures_dir . '/search-button.json' );
+ break;
+
+ case 'invalid-data':
+ $response = ''; // Any HTTP 200 response from w.org should be in JSON, even if it contains an error message.
+ break;
+ }
+
+ return $response;
+ }
+
+ /**
+ * @covers WP_REST_Pattern_Directory_Controller::get_item_schema
+ *
+ * @since 5.8.0
+ */
+ public function test_get_item_schema() {
+ $this->markTestSkipped( "The controller's schema is hardcoded, so tests would not be meaningful." );
+ }
+
+ /**
+ * Simulate a successful outbound HTTP requests, to keep tests pure and performant.
+ *
+ * @param string $action Pass a case from `get_raw_response()` to determine returned data.
+ * @param bool $expects_results Pass `true` to get results, or `false` to get 0 results.
+ *
+ * @since 5.8.0
+ */
+ private static function mock_successful_response( $action, $expects_results ) {
+ add_filter(
+ 'pre_http_request',
+ static function ( $preempt, $args, $url ) use ( $action, $expects_results ) {
+
+ if ( 'api.wordpress.org' !== wp_parse_url( $url, PHP_URL_HOST ) ) {
+ return $preempt;
+ }
+
+ $response = array(
+ 'headers' => array(),
+ 'response' => array(
+ 'code' => 200,
+ 'message' => 'OK',
+ ),
+ 'body' => $expects_results ? self::get_raw_response( $action ) : '[]',
+ 'cookies' => array(),
+ 'filename' => null,
+ );
+
+ return $response;
+ },
+ 10,
+ 3
+ );
+ }
+
+ /**
+ * Simulate a network failure on outbound http requests to a given hostname.
+ *
+ * @since 5.8.0
+ *
+ * @param string $blocked_host The host to block connections to.
+ */
+ private static function prevent_requests_to_host( $blocked_host = 'api.wordpress.org' ) {
+ add_filter(
+ 'pre_http_request',
+ static function ( $return, $args, $url ) use ( $blocked_host ) {
+
+ if ( wp_parse_url( $url, PHP_URL_HOST ) === $blocked_host ) {
+ return new WP_Error(
+ 'patterns_api_failed',
+ "An expected error occurred connecting to $blocked_host because of a unit test.",
+ "cURL error 7: Failed to connect to $blocked_host port 80: Connection refused"
+ );
+
+ }
+
+ return $return;
+ },
+ 10,
+ 3
+ );
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.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="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-05-26 00:28:50 UTC (rev 51020)
+++ trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php 2021-05-26 01:10:57 UTC (rev 51021)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -95,6 +95,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/pages/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/pages/(?P<id>[\\d]+)/autosaves',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/pages/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '/wp/v2/pattern-directory/patterns',
</ins><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/media',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/media/(?P<id>[\\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px"> '/wp/v2/media/(?P<id>[\\d]+)/post-process',
</span></span></pre>
</div>
</div>
</body>
</html>