Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve discoverability of Plugin Previews #360

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -590,12 +590,12 @@ function the_plugin_self_toggle_preview_button() {
return;
}

echo '<h4>' . esc_html__( 'Toggle Live Preview', 'wporg-plugins' ) . '</h4>';
echo '<h4 id="live-preview">' . esc_html__( 'Toggle Live Preview', 'wporg-plugins' ) . '</h4>';
$preview_status = get_post_meta( $post->ID, '_public_preview', true ) ? 'enabled' : 'disabled';
if ( 'enabled' === $preview_status ) {
echo '<p>' . esc_html__( 'The Live Preview link to Playground is currently enabled. Use the toggle button to disable it.', 'wporg-plugins' ) . '</p>';
echo '<p>' . wp_kses( sprintf( __( 'The <a href="%s">Live Preview link to Playground</a> is currently enabled. Use the toggle button to disable it.', 'wporg-plugins' ), 'https://developer.wordpress.org/plugins/wordpress-org/previews-and-blueprints/' ), array( 'a' => array( 'href' => array() ) ) ) . '</p>';
} else {
echo '<p>' . esc_html__( 'The Live Preview link to Playground is currently disabled. Use the toggle button to enable it.', 'wporg-plugins' ) . '</p>';
echo '<p>' . wp_kses( sprintf( __( 'The <a href="%s">Live Preview link to Playground</a> is currently disabled. Use the toggle button to enable it.', 'wporg-plugins' ), 'https://developer.wordpress.org/plugins/wordpress-org/previews-and-blueprints/#committing-a-blueprint-to-subversion' ), array( 'a' => array( 'href' => array() ) ) ) . '</p>';
}

$blueprints = get_post_meta( $post->ID, 'assets_blueprints', true );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@
<div class="wp-block-button is-small is-style-outline plugin-preview download-button"><a class="wp-block-button__link wp-element-button" href="%1$s">%2$s</a></div>
<!-- /wp:button -->',
esc_attr( add_query_arg( array( 'preview' => 1 ), get_the_permalink() ) ),
esc_html__( 'Test Preview', 'wporg-plugins' )
esc_html__( 'Test Preview', 'wporg-plugins' ) . ' <span class="dashicons dashicons-hidden" title="' . esc_attr__( 'Only visible to you', 'wporg-plugins' ) . '"></span>'
);
} elseif ( current_user_can( 'plugin_admin_edit', $post ) ) {
$buttons .= sprintf(
'<!-- wp:button {"className":"is-small is-style-outline plugin-preview download-button"} -->
<div class="wp-block-button is-small is-style-outline plugin-preview download-button"><a class="wp-block-button__link wp-element-button" href="%1$s">%2$s</a></div>
<!-- /wp:button -->',
esc_attr( get_the_permalink() . 'advanced/#live-preview' ),
esc_html__( 'Preview Not Available', 'wporg-plugins' ) . ' <span class="dashicons dashicons-hidden" title="' . esc_attr__( 'Only visible to you', 'wporg-plugins' ) . '"></span>'
);
}
echo do_blocks( $buttons ); // phpcs:ignore -- Output escaped while building string.
Expand Down