'; /** * Decide whether the modal should be displayed. * We want to show it when the user clicks on the Mastodon share button, * thus loading a page with ?share=mastodon&nb=1. * * @return bool */ public static function should_display_modal() { if ( // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Only used to display the modal. isset( $_GET['share'] ) && 'mastodon' === sanitize_text_field( wp_unslash( $_GET['share'] ) ) && isset( $_GET['nb'] ) && 1 === (int) $_GET['nb'] // phpcs:enable ) { return true; } return false; } /** * Hook the modal render into WordPress. */ public static function modal() { if ( ! self::should_display_modal() ) { return; } // Render the modal. self::render_modal(); die( 0 ); } /** * Render the modal. */ public static function render_modal() { ?> > <?php esc_html_e( 'Share to Mastodon', 'jetpack' ); ?>