Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"phpcompatibility/phpcompatibility-wp": "*",
"phpunit/phpunit": "^9.5",
"rmccue/requests": "^1.8.1",
"wp-coding-standards/wpcs": "2.*",
"wp-coding-standards/wpcs": "^3.4.1",
"wp-phpunit/wp-phpunit": "~6.0",
"wporg/wporg-parent-2021": "dev-build",
"yoast/phpunit-polyfills": "^1.1"
Expand Down
231 changes: 208 additions & 23 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

<rule ref="WordPress.NamingConventions.ValidVariableName">
<properties>
<property name="customPropertiesWhitelist" type="array">
<property name="allowed_custom_properties" type="array">
<element value="nodeValue"/>
<element value="parentNode"/>
</property>
Expand Down Expand Up @@ -151,4 +151,8 @@
<property name="text_domain" type="array" value="wporg-patterns" />
</properties>
</rule>
<!-- Short ternaries are used deliberately throughout; expanding them is a style call for maintainers. -->
<rule ref="Universal.Operators.DisallowShortTernary">
<severity>0</severity>
</rule>
</ruleset>
Original file line number Diff line number Diff line change
Expand Up @@ -109,31 +109,31 @@ function render_latest_comments( $block_content, $block, $block_instance ) {

/* Note: This is not translated (for now) because the post content is also not translated. */
$comments = array(
[
array(
'author' => 'Noah',
'post_title' => 'Jupiter',
'date' => strtotime( '5 days ago' ),
'content' => 'Since its orbital revolution occupies nearly twelve years, Jupiter comes back into opposition with the Sun every 399 days.',
],
[
),
array(
'author' => 'Sabrina',
'post_title' => 'Jupiter',
'date' => strtotime( '1 week ago' ),
'content' => 'Most conspicuous upon this globe are the larger or smaller bands or markings (gray and white, sometimes tinted yellow, or of a maroon or chocolate hue) by which its surface is streaked, particularly in the vicinity of the equator.',
],
[
),
array(
'author' => 'Yvonne',
'post_title' => 'The November Meteors',
'date' => strtotime( '2 weeks ago' ),
'content' => 'One or two unknown planets, some wandering comets, and swarms of meteors, doubtless traverse those unknown spaces, but all invisible to us.',
],
),
);

$comments = array_slice( $comments, 0, min( 3, $attributes['commentsToShow'] ) );
foreach ( $comments as $comment ) {
$list_items_markup .= '<li class="wp-block-latest-comments__comment">';
if ( $attributes['displayAvatar'] ) {
$list_items_markup .= get_avatar( null, 48, '', '', [ 'class' => 'wp-block-latest-comments__comment-avatar' ] );
$list_items_markup .= get_avatar( null, 48, '', '', array( 'class' => 'wp-block-latest-comments__comment-avatar' ) );
}

$list_items_markup .= '<article>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Openverse_Client {
/**
* Openverse_Client constructor.
*/
public function __construct( array $params = [] ) {
public function __construct( array $params = array() ) {
$defaults = array(
'per_page' => 30,
'page' => 1,
Expand Down Expand Up @@ -228,7 +228,7 @@ public function search() {
trigger_error( $results->get_error_code() . ' ' . $results->get_error_message(), E_USER_WARNING ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

// Set a short timeout to avoid hammering the API during outages.
set_transient( $cache_key, [], 0.5 * MINUTE_IN_SECONDS );
set_transient( $cache_key, array(), 0.5 * MINUTE_IN_SECONDS );

return new WP_Error(
'search-request-failed',
Expand Down
Loading
Loading