improve typing;WIP rm template partial

This commit is contained in:
Leon Stafford 2023-01-01 19:40:56 +11:00
parent 281e2c451c
commit 9b429799ce
6 changed files with 124 additions and 27 deletions

View file

@ -44,7 +44,4 @@ parameters:
- message: "#^Cannot access property \\$\\S+ on mixed\\.$#"
path: views/addons-page.php
count: 7
- message: "#^Variable \\$\\S+ might not be defined\\.$#"
path: views/_paginator.php
count: 10
- '/^Parameter #2 \$callable of static method WP_CLI::add_command\(\) expects callable\(\): mixed, \S+ given\.$/'

View file

@ -131,7 +131,6 @@ class ViewRenderer {
$paginator = new Paginator( $urls, $page_size, $page );
$view = [
'paginatorPage' => $paginator->page(),
'paginatorRender' => $paginator->render(),
'paginatorTotalRecords' => $paginator->totalRecords(),
'paginatorRecords' => $paginator->records(),
];
@ -163,7 +162,6 @@ class ViewRenderer {
$paginator = new Paginator( $paths, $page_size, $page );
$view = [
'paginatorPage' => $paginator->page(),
'paginatorRender' => $paginator->render(),
'paginatorTotalRecords' => $paginator->totalRecords(),
'paginatorRecords' => $paginator->records(),
];
@ -195,7 +193,6 @@ class ViewRenderer {
$paginator = new Paginator( $paths, $page_size, $page );
$view = [
'paginatorPage' => $paginator->page(),
'paginatorRender' => $paginator->render(),
'paginatorTotalRecords' => $paginator->totalRecords(),
'paginatorRecords' => $paginator->records(),
];
@ -229,7 +226,6 @@ class ViewRenderer {
$paginator = new Paginator( $paths, $page_size, $page );
$view = [
'paginatorPage' => $paginator->page(),
'paginatorRender' => $paginator->render(),
'paginatorTotalRecords' => $paginator->totalRecords(),
'paginatorRecords' => $paginator->records(),
];

View file

@ -2,6 +2,8 @@
// phpcs:disable Generic.Files.LineLength.MaxExceeded
// phpcs:disable Generic.Files.LineLength.TooLong
use WP2Static\URLHelper;
/**
* @var mixed[] $view
*/
@ -45,11 +47,35 @@ $search_term = filter_input( INPUT_GET, 's', FILTER_SANITIZE_URL ) ?? '';
<input type="submit" id="doaction" class="button action" value="Apply">
</div>
<?php
// outputs paginator template
/** @phpstan-ignore-next-line */
$view['paginatorRender'];
?>
<!-- start Paginator template partial -->
<h2 class="screen-reader-text">Crawl Queue list navigation</h2>
<div class="tablenav-pages">
<span class="displaying-num"><?php echo number_format( $paginator_total_records ); ?> items</span>
<span class="pagination-links">
<?php if ( $paginator_page === $paginator_first_page ) : ?>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">«</span>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true"></span>
<?php else : ?>
<a class="first-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => 1 ] ); ?>"><span class="screen-reader-text">First page</span><span aria-hidden="true">«</span></a>
<a class="prev-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_page - 1 ] ); ?>"><span class="screen-reader-text">Previous page</span><span aria-hidden="true"></span></a>
<?php endif; ?>
<span class="paging-input">
<label for="current-page-selector" class="screen-reader-text">Current Page</label>
<input class="current-page" id="current-page-selector" type="text" name="paged" value="<?php echo $paginator_page; ?>" size="3" aria-describedby="table-paging">
<span class="tablenav-paging-text"> of
<span class="total-pages"><?php echo $paginator_last_page; ?></span>
</span>
</span>
<?php if ( $paginator_page === $paginator_last_page ) : ?>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true"></span>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">»</span>
<?php else : ?>
<a class="next-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_page + 1 ] ); ?>"><span class="screen-reader-text">Next page</span><span aria-hidden="true"></span></a>
<a class="last-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_last_page ] ); ?>"><span class="screen-reader-text">Last page</span><span aria-hidden="true">»</span></a>
<?php endif; ?>
</span>
</div>
<!-- end Paginator template partial -->
<br class="clear">
</div>

View file

@ -2,6 +2,8 @@
// phpcs:disable Generic.Files.LineLength.MaxExceeded
// phpcs:disable Generic.Files.LineLength.TooLong
use WP2Static\URLHelper;
/**
* @var mixed[] $view
*/
@ -44,11 +46,35 @@ $search_term = filter_input( INPUT_GET, 's', FILTER_SANITIZE_URL ) ?? '';
<input type="submit" id="doaction" class="button action" value="Apply">
</div>
<?php
// outputs paginator template
/** @phpstan-ignore-next-line */
$view['paginatorRender'];
?>
<!-- start Paginator template partial -->
<h2 class="screen-reader-text">Crawl Queue list navigation</h2>
<div class="tablenav-pages">
<span class="displaying-num"><?php echo number_format( $paginator_total_records ); ?> items</span>
<span class="pagination-links">
<?php if ( $paginator_page === $paginator_first_page ) : ?>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">«</span>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true"></span>
<?php else : ?>
<a class="first-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => 1 ] ); ?>"><span class="screen-reader-text">First page</span><span aria-hidden="true">«</span></a>
<a class="prev-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_page - 1 ] ); ?>"><span class="screen-reader-text">Previous page</span><span aria-hidden="true"></span></a>
<?php endif; ?>
<span class="paging-input">
<label for="current-page-selector" class="screen-reader-text">Current Page</label>
<input class="current-page" id="current-page-selector" type="text" name="paged" value="<?php echo $paginator_page; ?>" size="3" aria-describedby="table-paging">
<span class="tablenav-paging-text"> of
<span class="total-pages"><?php echo $paginator_last_page; ?></span>
</span>
</span>
<?php if ( $paginator_page === $paginator_last_page ) : ?>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true"></span>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">»</span>
<?php else : ?>
<a class="next-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_page + 1 ] ); ?>"><span class="screen-reader-text">Next page</span><span aria-hidden="true"></span></a>
<a class="last-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_last_page ] ); ?>"><span class="screen-reader-text">Last page</span><span aria-hidden="true">»</span></a>
<?php endif; ?>
</span>
</div>
<!-- end Paginator template partial -->
<br class="clear">
</div>

View file

@ -2,6 +2,8 @@
// phpcs:disable Generic.Files.LineLength.MaxExceeded
// phpcs:disable Generic.Files.LineLength.TooLong
use WP2Static\URLHelper;
/**
* @var mixed[] $view
*/
@ -44,11 +46,35 @@ $search_term = filter_input( INPUT_GET, 's', FILTER_SANITIZE_URL ) ?? '';
<input type="submit" id="doaction" class="button action" value="Apply">
</div>
<?php
// outputs paginator template
/** @phpstan-ignore-next-line */
$view['paginatorRender'];
?>
<!-- start Paginator template partial -->
<h2 class="screen-reader-text">Crawl Queue list navigation</h2>
<div class="tablenav-pages">
<span class="displaying-num"><?php echo number_format( $paginator_total_records ); ?> items</span>
<span class="pagination-links">
<?php if ( $paginator_page === $paginator_first_page ) : ?>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">«</span>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true"></span>
<?php else : ?>
<a class="first-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => 1 ] ); ?>"><span class="screen-reader-text">First page</span><span aria-hidden="true">«</span></a>
<a class="prev-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_page - 1 ] ); ?>"><span class="screen-reader-text">Previous page</span><span aria-hidden="true"></span></a>
<?php endif; ?>
<span class="paging-input">
<label for="current-page-selector" class="screen-reader-text">Current Page</label>
<input class="current-page" id="current-page-selector" type="text" name="paged" value="<?php echo $paginator_page; ?>" size="3" aria-describedby="table-paging">
<span class="tablenav-paging-text"> of
<span class="total-pages"><?php echo $paginator_last_page; ?></span>
</span>
</span>
<?php if ( $paginator_page === $paginator_last_page ) : ?>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true"></span>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">»</span>
<?php else : ?>
<a class="next-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_page + 1 ] ); ?>"><span class="screen-reader-text">Next page</span><span aria-hidden="true"></span></a>
<a class="last-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_last_page ] ); ?>"><span class="screen-reader-text">Last page</span><span aria-hidden="true">»</span></a>
<?php endif; ?>
</span>
</div>
<!-- end Paginator template partial -->
<br class="clear">
</div>

View file

@ -2,6 +2,8 @@
// phpcs:disable Generic.Files.LineLength.MaxExceeded
// phpcs:disable Generic.Files.LineLength.TooLong
use WP2Static\URLHelper;
/**
* @var mixed[] $view
*/
@ -44,11 +46,35 @@ $search_term = filter_input( INPUT_GET, 's', FILTER_SANITIZE_URL ) ?? '';
<input type="submit" id="doaction" class="button action" value="Apply">
</div>
<?php
// outputs paginator template
/** @phpstan-ignore-next-line */
$view['paginatorRender'];
?>
<!-- start Paginator template partial -->
<h2 class="screen-reader-text">Crawl Queue list navigation</h2>
<div class="tablenav-pages">
<span class="displaying-num"><?php echo number_format( $paginator_total_records ); ?> items</span>
<span class="pagination-links">
<?php if ( $paginator_page === $paginator_first_page ) : ?>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">«</span>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true"></span>
<?php else : ?>
<a class="first-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => 1 ] ); ?>"><span class="screen-reader-text">First page</span><span aria-hidden="true">«</span></a>
<a class="prev-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_page - 1 ] ); ?>"><span class="screen-reader-text">Previous page</span><span aria-hidden="true"></span></a>
<?php endif; ?>
<span class="paging-input">
<label for="current-page-selector" class="screen-reader-text">Current Page</label>
<input class="current-page" id="current-page-selector" type="text" name="paged" value="<?php echo $paginator_page; ?>" size="3" aria-describedby="table-paging">
<span class="tablenav-paging-text"> of
<span class="total-pages"><?php echo $paginator_last_page; ?></span>
</span>
</span>
<?php if ( $paginator_page === $paginator_last_page ) : ?>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true"></span>
<span class="tablenav-pages-navspan button disabled" aria-hidden="true">»</span>
<?php else : ?>
<a class="next-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_page + 1 ] ); ?>"><span class="screen-reader-text">Next page</span><span aria-hidden="true"></span></a>
<a class="last-page button" href="<?php echo URLHelper::modifyUrl( [ 'paged' => $paginator_last_page ] ); ?>"><span class="screen-reader-text">Last page</span><span aria-hidden="true">»</span></a>
<?php endif; ?>
</span>
</div>
<!-- end Paginator template partial -->
<br class="clear">
</div>