This commit is contained in:
Javier Casares 2026-08-17 16:01:48 +00:00
commit e7a4a45a74
9 changed files with 170 additions and 89 deletions

View file

@ -2,10 +2,10 @@
/**
* Admin page view: ROBOTSTXT Plugins catalog.
*
* Available variables:
* $catalog list<array<string,mixed>> Catalog entries from Core.
* $local array<string, array{installed:bool, active:bool, version:string}>
* Local install state, keyed by slug.
* Catalog table (Plugin · Version · Requires WP · Requires PHP · Price ·
* Action · Status) with an always-open detail row under each plugin
* (website link + description), an intro paragraph, and Support /
* Payments sections below the table.
*
* @package Robotstxt_Manager
*/
@ -57,6 +57,10 @@ $compat_warnings = 0;
<div class="wrap">
<h1><?php esc_html_e( 'Manager (by ROBOTSTXT) — Plugins', 'robotstxt-manager' ); ?></h1>
<p class="description">
<?php esc_html_e( 'This is the ROBOTSTXT plugin store: the catalog of plugins published by ROBOTSTXT, installable and updatable straight from your own wp-admin. Free plugins install with one click; premium plugins require an annual subscription that you purchase on our website.', 'robotstxt-manager' ); ?>
</p>
<?php if ( $refreshed ) : ?>
<div class="notice notice-success is-dismissible"><p><?php esc_html_e( 'Catalog refreshed.', 'robotstxt-manager' ); ?></p></div>
<?php endif; ?>
@ -95,12 +99,12 @@ $compat_warnings = 0;
<thead>
<tr>
<th scope="col"><?php esc_html_e( 'Plugin', 'robotstxt-manager' ); ?></th>
<th scope="col"><?php esc_html_e( 'Type', 'robotstxt-manager' ); ?></th>
<th scope="col"><?php esc_html_e( 'Price', 'robotstxt-manager' ); ?></th>
<th scope="col"><?php esc_html_e( 'Version', 'robotstxt-manager' ); ?></th>
<th scope="col"><?php esc_html_e( 'Requires WP', 'robotstxt-manager' ); ?></th>
<th scope="col"><?php esc_html_e( 'Requires PHP', 'robotstxt-manager' ); ?></th>
<th scope="col"><?php esc_html_e( 'Local state', 'robotstxt-manager' ); ?></th>
<th scope="col"><?php esc_html_e( 'Price', 'robotstxt-manager' ); ?></th>
<th scope="col"><?php esc_html_e( 'Action', 'robotstxt-manager' ); ?></th>
<th scope="col"><?php esc_html_e( 'Status', 'robotstxt-manager' ); ?></th>
</tr>
</thead>
<tbody>
@ -129,8 +133,7 @@ $compat_warnings = 0;
$req_php = is_string( $raw_rphp ) ? $raw_rphp : '';
$website_url = '' !== $page_url ? $page_url : $homepage;
$expandable = ( '' !== $desc || '' !== $website_url );
$toggle_id = 'robotstxt-manager-toggle-' . esc_attr( $slug );
$has_detail = ( '' !== $website_url || '' !== $desc );
// Compatibility checks.
$wp_ok = '' === $req_wp || version_compare( $local_wp_version, $req_wp, '>=' );
@ -157,25 +160,9 @@ $compat_warnings = 0;
?>
<tr class="<?php echo esc_attr( ltrim( $row_class ) ); ?>">
<td class="robotstxt-manager-name-cell">
<?php if ( $expandable ) : ?>
<input type="checkbox" class="robotstxt-manager-toggle" id="<?php echo esc_attr( $toggle_id ); ?>" aria-label="<?php esc_attr_e( 'Show more information', 'robotstxt-manager' ); ?>" />
<label class="robotstxt-manager-toggle-label" for="<?php echo esc_attr( $toggle_id ); ?>"><span class="robotstxt-manager-toggle-arrow"></span></label>
<?php endif; ?>
<strong><?php echo esc_html( $name ); ?></strong>
<?php if ( '' !== $remote_v ) : ?>
<br /><span class="description"><?php echo esc_html( sprintf( 'v%s', $remote_v ) ); ?></span>
<?php endif; ?>
</td>
<td><?php echo esc_html( 'premium' === $kind ? __( 'Premium', 'robotstxt-manager' ) : __( 'Free', 'robotstxt-manager' ) ); ?></td>
<td>
<?php
if ( $cost > 0.0 ) {
echo esc_html( sprintf( '€%s / year', number_format_i18n( $cost, 0 ) ) );
} else {
echo '&mdash;';
}
?>
</td>
<td><?php echo '' !== $remote_v ? esc_html( $remote_v ) : '&mdash;'; ?></td>
<td>
<?php if ( '' !== $req_wp ) : ?>
<span class="<?php echo $wp_ok ? 'robotstxt-manager-compat--ok' : 'robotstxt-manager-compat--fail'; ?>">
@ -200,6 +187,40 @@ $compat_warnings = 0;
&mdash;
<?php endif; ?>
</td>
<td>
<?php
if ( $cost > 0.0 || 'premium' === $kind ) {
echo esc_html(
sprintf(
/* translators: %s: formatted price number. */
__( '€%s / year', 'robotstxt-manager' ),
number_format_i18n( $cost, 0 )
)
);
} else {
echo esc_html__( 'Free', 'robotstxt-manager' );
}
?>
</td>
<td>
<?php if ( ! $l_installed ) : ?>
<?php if ( ! $wp_ok || ! $php_ok ) : ?>
<span class="description"><?php esc_html_e( 'Incompatible', 'robotstxt-manager' ); ?></span>
<?php else : ?>
<?php if ( $cost > 0.0 && '' !== $page_url ) : ?>
<a class="button button-secondary" href="<?php echo esc_url( $page_url ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Buy', 'robotstxt-manager' ); ?></a>
<?php endif; ?>
<?php
$install_class = ( $cost > 0.0 && '' !== $page_url ) ? 'button-secondary' : 'button-primary';
?>
<a class="button <?php echo esc_attr( $install_class ); ?>" href="<?php echo esc_url( Robotstxt_Manager_Admin::action_url( 'install', $slug ) ); ?>"><?php esc_html_e( 'Install', 'robotstxt-manager' ); ?></a>
<?php endif; ?>
<?php elseif ( ! $l_active ) : ?>
<a class="button button-primary" href="<?php echo esc_url( Robotstxt_Manager_Admin::action_url( 'activate', $slug ) ); ?>"><?php esc_html_e( 'Activate', 'robotstxt-manager' ); ?></a>
<?php elseif ( $update_available ) : ?>
<a class="button button-secondary" href="<?php echo esc_url( Robotstxt_Manager_Admin::action_url( 'update', $slug ) ); ?>"><?php esc_html_e( 'Update', 'robotstxt-manager' ); ?></a>
<?php endif; ?>
</td>
<td>
<?php
if ( ! $l_installed ) {
@ -220,35 +241,16 @@ $compat_warnings = 0;
}
?>
</td>
<td>
<?php if ( ! $l_installed ) : ?>
<?php if ( ! $wp_ok || ! $php_ok ) : ?>
<span class="description"><?php esc_html_e( 'Incompatible', 'robotstxt-manager' ); ?></span>
<?php else : ?>
<?php if ( $cost > 0.0 && '' !== $page_url ) : ?>
<a class="button button-secondary" href="<?php echo esc_url( $page_url ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Buy', 'robotstxt-manager' ); ?></a>
<?php endif; ?>
<?php
$install_class = ( $cost > 0.0 && '' !== $page_url ) ? 'button-secondary' : 'button-primary';
?>
<a class="button <?php echo esc_attr( $install_class ); ?>" href="<?php echo esc_url( Robotstxt_Manager_Admin::action_url( 'install', $slug ) ); ?>"><?php esc_html_e( 'Install', 'robotstxt-manager' ); ?></a>
<?php endif; ?>
<?php elseif ( ! $l_active ) : ?>
<a class="button button-primary" href="<?php echo esc_url( Robotstxt_Manager_Admin::action_url( 'activate', $slug ) ); ?>"><?php esc_html_e( 'Activate', 'robotstxt-manager' ); ?></a>
<?php elseif ( $update_available ) : ?>
<a class="button button-secondary" href="<?php echo esc_url( Robotstxt_Manager_Admin::action_url( 'update', $slug ) ); ?>"><?php esc_html_e( 'Update', 'robotstxt-manager' ); ?></a>
<?php endif; ?>
</td>
</tr>
<?php if ( $expandable ) : ?>
<?php if ( $has_detail ) : ?>
<tr class="robotstxt-manager-detail-row">
<td colspan="7">
<?php if ( '' !== $desc ) : ?>
<p class="robotstxt-manager-detail-description"><?php echo esc_html( $desc ); ?></p>
<?php endif; ?>
<?php if ( '' !== $website_url ) : ?>
<a href="<?php echo esc_url( $website_url ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Visit website', 'robotstxt-manager' ); ?> <span class="screen-reader-text"><?php echo esc_html( sprintf( /* translators: %s: plugin name. */ __( '(about %s)', 'robotstxt-manager' ), $name ) ); ?></span></a>
<?php endif; ?>
<?php if ( '' !== $desc ) : ?>
<span class="robotstxt-manager-detail-description"><?php echo esc_html( $desc ); ?></span>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
@ -256,6 +258,16 @@ $compat_warnings = 0;
</tbody>
</table>
<h2><?php esc_html_e( 'Support', 'robotstxt-manager' ); ?></h2>
<p class="description">
<?php esc_html_e( 'Need help with a ROBOTSTXT plugin? Visit the plugin\'s website (the link in its row above) for documentation and guides, or contact us through our website — we are happy to help.', 'robotstxt-manager' ); ?>
</p>
<h2><?php esc_html_e( 'Payments, and how it works', 'robotstxt-manager' ); ?></h2>
<p class="description">
<?php esc_html_e( 'Free plugins install instantly at no cost. Premium plugins are annual subscriptions: you pay once on our website and the subscription renews automatically every year until you cancel. You can cancel at any time from your ROBOTSTXT account page — access keeps working until the end of the paid period. All payments are processed securely by Mollie; we never see or store your card details.', 'robotstxt-manager' ); ?>
</p>
<?php if ( $compat_warnings > 0 ) : ?>
<div class="notice notice-warning inline" style="margin-top:1em">
<p>
@ -290,12 +302,7 @@ $compat_warnings = 0;
.robotstxt-manager-compat-warning { cursor: help; }
.robotstxt-manager-row--incompatible { background-color: #fef7f0 !important; }
/* Expandable detail rows (CSS-only toggle). */
.robotstxt-manager-toggle { display: none; }
.robotstxt-manager-toggle-label { cursor: pointer; display: inline-block; width: 1.4em; }
.robotstxt-manager-toggle-arrow::before { content: "\25B8"; /* ▸ */ }
.robotstxt-manager-detail-row { display: none; }
.robotstxt-manager-detail-row td { border-top: none !important; }
tr:has(.robotstxt-manager-toggle:checked) + tr.robotstxt-manager-detail-row { display: table-row; }
tr:has(.robotstxt-manager-toggle:checked) .robotstxt-manager-toggle-arrow::before { content: "\25BE"; /* ▾ */ }
/* Detail rows (always open): muted, attached to the row above. */
.robotstxt-manager-detail-row td { border-top: none !important; padding-top: 0; }
.robotstxt-manager-detail-description { color: #50575e; }
</style>