| @@ -26,32 +26,36 @@ | ||
| 26 | 26 | $plugins = array(); |
| 27 | 27 | $required_php_version = '7.4'; |
| 28 | 28 | |
| 29 | 29 | if ( version_compare( phpversion(), $required_php_version, '<' ) ) { |
| 30 | - echo '<div class="error fade"><p><strong>'; | |
| 31 | - // translators: %s: required PHP version number. | |
| 32 | - echo esc_html( sprintf( __( 'Code Snippets requires PHP %s or later.', 'code-snippets' ), $required_php_version ) ); | |
| 33 | - echo '</strong><br>'; | |
| 30 | + $plugins[] = plugin_basename( dirname( dirname( __FILE__ ) ) . '/code-snippets.php' ); | |
| 34 | 31 | |
| 32 | + printf( | |
| 33 | + '<div class="code-snippets-notice error fade" role="region" aria-label="%s"><p><strong>%s</strong>', | |
| 34 | + esc_attr__( 'Code Snippets PHP version notice', 'code-snippets' ), | |
| 35 | + // translators: %s: required PHP version number. | |
| 36 | + esc_html( sprintf( __( 'Code Snippets requires PHP %s or later.', 'code-snippets' ), $required_php_version ) ) | |
| 37 | + ); | |
| 38 | + | |
| 35 | 39 | $update_url = function_exists( 'wp_get_default_update_php_url' ) ? |
| 36 | 40 | wp_get_default_update_php_url() : |
| 37 | 41 | 'https://wordpress.org/support/update-php/'; |
| 38 | 42 | |
| 39 | 43 | // translators: %s: Update PHP URL. |
| 40 | - $text = __( 'Please <a href="%s">upgrade your server to the latest version of PHP</a> to continue using Code Snippets.', 'code-snippets' ); | |
| 44 | + $update_text = __( 'Please <a href="%s">upgrade your server to the latest version of PHP</a> to continue using Code Snippets.', 'code-snippets' ); | |
| 41 | 45 | |
| 42 | - echo wp_kses( sprintf( $text, $update_url ), array( 'a' => array( 'href' => array() ) ) ); | |
| 46 | + echo '<br>', wp_kses( sprintf( $update_text, $update_url ), array( 'a' => array( 'href' => array() ) ) ); | |
| 43 | 47 | echo '</p></div>'; |
| 44 | - | |
| 45 | - $plugins[] = plugin_basename( dirname( dirname( __FILE__ ) ) . '/code-snippets.php' ); | |
| 46 | 48 | } |
| 47 | 49 | |
| 48 | 50 | if ( defined( 'CODE_SNIPPETS_FILE' ) ) { |
| 49 | - echo '<div class="error fade"><p>'; | |
| 50 | - esc_html_e( 'Another version of Code Snippets appears to be installed. Deactivating this version.', 'code-snippets' ); | |
| 51 | - echo '</p></div>'; | |
| 51 | + $plugins[] = 'code-snippets/code-snippets.php'; | |
| 52 | 52 | |
| 53 | - $plugins[] = 'code-snippets/code-snippets.php'; | |
| 53 | + printf( | |
| 54 | + '<div class="code-snippets-notice error fade" role="region" aria-label="%s"><p>%s</p></div>', | |
| 55 | + esc_attr__( 'Code Snippets duplicate plugin notice', 'code-snippets' ), | |
| 56 | + esc_html__( 'Another version of Code Snippets appears to be installed. Deactivating this version.', 'code-snippets' ) | |
| 57 | + ); | |
| 54 | 58 | } |
| 55 | 59 | |
| 56 | 60 | if ( $plugins ) { |
| 57 | 61 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |