Upgrade to version 11.0.1 #1

Merged
steve merged 60 commits from v11.0.1 into main 2025-10-30 22:14:46 +00:00
6 changed files with 20 additions and 80 deletions
Showing only changes of commit 5ffb5636b2 - Show all commits

View File

@@ -16,23 +16,9 @@ class App extends Composer
]; ];
/** /**
* Data to be passed to view before rendering. * Retrieve the site name.
*
* @return array
*/ */
public function with() public function siteName(): string
{
return [
'siteName' => $this->siteName(),
];
}
/**
* Returns the site name.
*
* @return string
*/
public function siteName()
{ {
return get_bloginfo('name', 'display'); return get_bloginfo('name', 'display');
} }

View File

@@ -15,29 +15,10 @@ class Comments extends Composer
'partials.comments', 'partials.comments',
]; ];
/**
* Data to be passed to view before rendering.
*
* @return array
*/
public function with()
{
return [
'title' => $this->title(),
'responses' => $this->responses(),
'previous' => $this->previous(),
'next' => $this->next(),
'paginated' => $this->paginated(),
'closed' => $this->closed(),
];
}
/** /**
* The comment title. * The comment title.
*
* @return string
*/ */
public function title() public function title(): string
{ {
return sprintf( return sprintf(
/* translators: %1$s is replaced with the number of comments and %2$s with the post title */ /* translators: %1$s is replaced with the number of comments and %2$s with the post title */
@@ -49,13 +30,11 @@ class Comments extends Composer
/** /**
* Retrieve the comments. * Retrieve the comments.
*
* @return string
*/ */
public function responses() public function responses(): ?string
{ {
if (! have_comments()) { if (! have_comments()) {
return; return null;
} }
return wp_list_comments([ return wp_list_comments([
@@ -67,13 +46,11 @@ class Comments extends Composer
/** /**
* The previous comments link. * The previous comments link.
*
* @return string
*/ */
public function previous() public function previous(): ?string
{ {
if (! get_previous_comments_link()) { if (! get_previous_comments_link()) {
return; return null;
} }
return get_previous_comments_link( return get_previous_comments_link(
@@ -83,13 +60,11 @@ class Comments extends Composer
/** /**
* The next comments link. * The next comments link.
*
* @return string
*/ */
public function next() public function next(): ?string
{ {
if (! get_next_comments_link()) { if (! get_next_comments_link()) {
return; return null;
} }
return get_next_comments_link( return get_next_comments_link(
@@ -99,20 +74,16 @@ class Comments extends Composer
/** /**
* Determine if the comments are paginated. * Determine if the comments are paginated.
*
* @return bool
*/ */
public function paginated() public function paginated(): bool
{ {
return get_comment_pages_count() > 1 && get_option('page_comments'); return get_comment_pages_count() > 1 && get_option('page_comments');
} }
/** /**
* Determine if the comments are closed. * Determine if the comments are closed.
*
* @return bool
*/ */
public function closed() public function closed(): bool
{ {
return ! comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments'); return ! comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments');
} }

View File

@@ -17,25 +17,10 @@ class Post extends Composer
'partials.content-*', 'partials.content-*',
]; ];
/**
* Data to be passed to view before rendering, but after merging.
*
* @return array
*/
public function override()
{
return [
'title' => $this->title(),
'pagination' => $this->pagination(),
];
}
/** /**
* Retrieve the post title. * Retrieve the post title.
*
* @return string
*/ */
public function title() public function title(): string
{ {
if ($this->view->name() !== 'partials.page-header') { if ($this->view->name() !== 'partials.page-header') {
return get_the_title(); return get_the_title();
@@ -70,10 +55,8 @@ class Post extends Composer
/** /**
* Retrieve the pagination links. * Retrieve the pagination links.
*
* @return string
*/ */
public function pagination() public function pagination(): string
{ {
return wp_link_pages([ return wp_link_pages([
'echo' => 0, 'echo' => 0,

View File

@@ -1,6 +1,6 @@
@if (! post_password_required()) @if (! post_password_required())
<section id="comments" class="comments"> <section id="comments" class="comments">
@if ($responses) @if ($responses())
<h2> <h2>
{!! $title !!} {!! $title !!}
</h2> </h2>
@@ -9,16 +9,16 @@
{!! $responses !!} {!! $responses !!}
</ol> </ol>
@if ($paginated) @if ($paginated())
<nav aria-label="Comment"> <nav aria-label="Comment">
<ul class="pager"> <ul class="pager">
@if ($previous) @if ($previous())
<li class="previous"> <li class="previous">
{!! $previous !!} {!! $previous !!}
</li> </li>
@endif @endif
@if ($next) @if ($next())
<li class="next"> <li class="next">
{!! $next !!} {!! $next !!}
</li> </li>
@@ -28,7 +28,7 @@
@endif @endif
@endif @endif
@if ($closed) @if ($closed())
<x-alert type="warning"> <x-alert type="warning">
{!! __('Comments are closed.', 'sage') !!} {!! __('Comments are closed.', 'sage') !!}
</x-alert> </x-alert>

View File

@@ -1,6 +1,6 @@
@php(the_content()) @php(the_content())
@if ($pagination) @if ($pagination())
<nav class="page-nav" aria-label="Page"> <nav class="page-nav" aria-label="Page">
{!! $pagination !!} {!! $pagination !!}
</nav> </nav>

View File

@@ -11,7 +11,7 @@
@php(the_content()) @php(the_content())
</div> </div>
@if ($pagination) @if ($pagination())
<footer> <footer>
<nav class="page-nav" aria-label="Page"> <nav class="page-nav" aria-label="Page">
{!! $pagination !!} {!! $pagination !!}