| 1 |
<?php |
| 2 |
/** |
| 3 |
* «What's new» admin page — release notes of the installed version, parsed from |
| 4 |
* the bundled readme.txt by WhatsNew::changelog(). |
| 5 |
* |
| 6 |
* @var string $version version whose notes are shown (e.g. 1.9.6) |
| 7 |
* @var array|null $current ['date' => string, 'items' => [...]] or null when the readme has no changelog |
| 8 |
* @var array $earlier version => release, older entries from the bundled readme |
| 9 |
* @var string $changelog_url full changelog on filtereverything.pro |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined('ABSPATH') ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
$flrt_render_items = static function ( array $items ) { |
| 17 |
foreach ( $items as $item ) { |
| 18 |
echo '<li>'; |
| 19 |
if ( ! empty( $item['new'] ) ) { |
| 20 |
echo '<span class="wpc-whats-new-tag wpc-whats-new-tag-new">' . esc_html__( 'New', 'filter-everything' ) . '</span>'; |
| 21 |
} elseif ( ! empty( $item['label'] ) ) { |
| 22 |
echo '<span class="wpc-whats-new-tag">' . esc_html( $item['label'] ) . '</span>'; |
| 23 |
} |
| 24 |
echo esc_html( $item['text'] ); |
| 25 |
echo '</li>'; |
| 26 |
} |
| 27 |
}; |
| 28 |
?> |
| 29 |
<div class="wrap wpc-whats-new"> |
| 30 |
<h1><?php |
| 31 |
/* translators: %s: plugin name with version, e.g. "Filter Everything 1.9.6" */ |
| 32 |
printf( esc_html__( "What's new in %s", 'filter-everything' ), esc_html( 'Filter Everything ' . $version ) ); |
| 33 |
?></h1> |
| 34 |
|
| 35 |
<?php if ( $current && ! empty( $current['items'] ) ) : ?> |
| 36 |
<?php if ( ! empty( $current['date'] ) ) : ?> |
| 37 |
<p class="wpc-whats-new-date"><?php |
| 38 |
/* translators: %s: release date as written in the changelog */ |
| 39 |
printf( esc_html__( 'Release date: %s', 'filter-everything' ), esc_html( $current['date'] ) ); |
| 40 |
?></p> |
| 41 |
<?php endif; ?> |
| 42 |
<ul class="wpc-whats-new-list"> |
| 43 |
<?php $flrt_render_items( $current['items'] ); ?> |
| 44 |
</ul> |
| 45 |
<?php else : ?> |
| 46 |
<p class="description"><?php esc_html_e( 'No release notes were found for this version.', 'filter-everything' ); ?></p> |
| 47 |
<?php endif; ?> |
| 48 |
|
| 49 |
<p> |
| 50 |
<a class="button button-secondary" href="<?php echo esc_url( add_query_arg( [ 'utm_source' => 'plugin', 'utm_medium' => 'whats_new', 'utm_campaign' => 'release_' . $version ], $changelog_url ) ); ?>" target="_blank" rel="noopener"> |
| 51 |
<?php esc_html_e( 'Full changelog', 'filter-everything' ); ?> ↗ |
| 52 |
</a> |
| 53 |
</p> |
| 54 |
|
| 55 |
<?php if ( ! empty( $earlier ) ) : ?> |
| 56 |
<details class="wpc-whats-new-earlier"> |
| 57 |
<summary><?php esc_html_e( 'Earlier releases', 'filter-everything' ); ?></summary> |
| 58 |
<?php foreach ( $earlier as $ver => $release ) : ?> |
| 59 |
<?php if ( empty( $release['items'] ) ) { continue; } ?> |
| 60 |
<h3><?php echo esc_html( $ver ); ?><?php if ( ! empty( $release['date'] ) ) : ?> <small><?php echo esc_html( $release['date'] ); ?></small><?php endif; ?></h3> |
| 61 |
<ul> |
| 62 |
<?php $flrt_render_items( $release['items'] ); ?> |
| 63 |
</ul> |
| 64 |
<?php endforeach; ?> |
| 65 |
</details> |
| 66 |
<?php endif; ?> |
| 67 |
</div> |
| 68 |
|